KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_sym_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) 2017 Wayne Stambaugh <[email protected]>
5 * Copyright (C) 2021 CERN
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * 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, see <https://www.gnu.org/licenses/>.
20 */
21
22#include <set>
23#include <wx/regex.h>
24
25#include <build_version.h>
26#include <common.h> // For ExpandEnvVarSubstitutions
28#include <project.h>
29#include <panel_sym_lib_table.h>
30#include <lib_id.h>
34#include <widgets/wx_grid.h>
38#include <confirm.h>
39#include <bitmaps.h>
42#include <env_paths.h>
43#include <functional>
44#include <eeschema_id.h>
45#include <env_vars.h>
46#include <sch_io/sch_io.h>
47#include <symbol_edit_frame.h>
48#include <sch_edit_frame.h>
49#include <kiway.h>
50#include <paths.h>
51#include <kiplatform/ui.h>
52#include <pgm_base.h>
54#include <wx/dir.h>
55#include <wx/dirdlg.h>
56#include <wx/filedlg.h>
57#include <wx/msgdlg.h>
58#include <project_sch.h>
62
67{
68 wxString m_Description;
69 wxString m_FileFilter;
70
73 bool m_IsFile;
74 SCH_IO_MGR::SCH_FILE_T m_Plugin;
75};
76
77
82static constexpr int FIRST_MENU_ID = 1000;
83// This must not collide with any SCH_FILE_T enum values so we offset it below.
85
86
88{
89public:
90 SYMBOL_LIB_TABLE_GRID_DATA_MODEL( DIALOG_SHIM* aParent, WX_GRID* aGrid, const LIBRARY_TABLE& aTableToEdit,
91 SYMBOL_LIBRARY_ADAPTER* aAdapter, const wxArrayString& aPluginChoices,
92 wxString* aMRUDirectory, const wxString& aProjectPath ) :
93 LIB_TABLE_GRID_DATA_MODEL( aParent, aGrid, aTableToEdit, aAdapter, aPluginChoices, aMRUDirectory,
94 aProjectPath )
95 {
96 }
97
98 void SetValue( int aRow, int aCol, const wxString &aValue ) override
99 {
100 wxCHECK( aRow < (int) size(), /* void */ );
101
102 LIB_TABLE_GRID_DATA_MODEL::SetValue( aRow, aCol, aValue );
103
104 // If setting a filepath, attempt to auto-detect the format
105 if( aCol == COL_URI )
106 {
107 LIBRARY_TABLE_ROW& row = at( static_cast<size_t>( aRow ) );
108 wxString uri = LIBRARY_MANAGER::ExpandURI( row.URI(), Pgm().GetSettingsManager().Prj() );
109 SCH_IO_MGR::SCH_FILE_T pluginType = SCH_IO_MGR::GuessPluginTypeFromLibPath( uri );
110
111 if( pluginType != SCH_IO_MGR::SCH_FILE_UNKNOWN )
112 SetValue( aRow, COL_TYPE, SCH_IO_MGR::ShowType( pluginType ) );
113 }
114 }
115
116protected:
117 wxString getFileTypes( WX_GRID* aGrid, int aRow ) override
118 {
119 LIB_TABLE_GRID_DATA_MODEL* table = static_cast<LIB_TABLE_GRID_DATA_MODEL*>( aGrid->GetTable() );
120 LIBRARY_TABLE_ROW& tableRow = table->At( aRow );
121
122 if( tableRow.Type() == LIBRARY_TABLE_ROW::TABLE_TYPE_NAME )
123 {
124 wxString filter = _( "Symbol Library Tables" );
125#ifndef __WXOSX__
126 filter << wxString::Format( _( " (%s)|%s" ), FILEEXT::SymbolLibraryTableFileName,
128#else
129 filter << wxString::Format( _( " (%s)|%s" ), wxFileSelectorDefaultWildcardStr,
130 wxFileSelectorDefaultWildcardStr );
131#endif
132 return filter;
133 }
134
135 SCH_IO_MGR::SCH_FILE_T pi_type = SCH_IO_MGR::EnumFromStr( tableRow.Type() );
136 IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( pi_type ) );
137
138 if( pi )
139 {
140 const IO_BASE::IO_FILE_DESC& desc = pi->GetLibraryDesc();
141
142 if( desc.m_IsFile )
143 return desc.FileFilter();
144 }
145
146 return wxEmptyString;
147 }
148};
149
150
152{
153public:
155 std::function<void( wxCommandEvent& )> aAddHandler ) :
156 LIB_TABLE_GRID_TRICKS( aGrid, aAddHandler ),
157 m_panel( aPanel )
158 {
160 }
161
163 {
164 return true;
165 }
166
167protected:
168 void optionsEditor( int aRow ) override
169 {
170 LIB_TABLE_GRID_DATA_MODEL* tbl = static_cast<LIB_TABLE_GRID_DATA_MODEL*>( m_grid->GetTable() );
171
172 if( tbl->GetNumberRows() > aRow )
173 {
174 LIBRARY_TABLE_ROW& row = tbl->At( static_cast<size_t>( aRow ) );
175 const wxString& options = row.Options();
176 wxString result = options;
177 std::map<std::string, UTF8> choices;
178
179 SCH_IO_MGR::SCH_FILE_T pi_type = SCH_IO_MGR::EnumFromStr( row.Type() );
180 IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( pi_type ) );
181 pi->GetLibraryOptions( &choices );
182
183 DIALOG_PLUGIN_OPTIONS dlg( wxGetTopLevelParent( m_grid ), row.Nickname(), choices, options, &result );
184 dlg.ShowModal();
185
186 if( options != result )
187 {
188 row.SetOptions( result );
189 m_grid->Refresh();
190 }
191 }
192 }
193
194 void openTable( const LIBRARY_TABLE_ROW& aRow ) override
195 {
196 wxFileName fn( LIBRARY_MANAGER::ExpandURI( aRow.URI(), Pgm().GetSettingsManager().Prj() ) );
197 std::shared_ptr<LIBRARY_TABLE> child = std::make_shared<LIBRARY_TABLE>( fn, LIBRARY_TABLE_SCOPE::GLOBAL, LIBRARY_TABLE_TYPE::SYMBOL );
198
199 if( !child->IsOk() )
200 {
201 wxMessageBox( _( "Unable to load library table." ) );
202 }
203 else
204 {
206
207 m_panel->OpenTable( child, aRow.Nickname() );
208 }
209 }
210
211 wxString getTablePreamble() override
212 {
213 return wxT( "(sym_lib_table" );
214 }
215
220
221protected:
223};
224
225
226void PANEL_SYM_LIB_TABLE::OpenTable( const std::shared_ptr<LIBRARY_TABLE>& aTable, const wxString& aTitle )
227{
228 wxString tabTitle = aTitle;
229
230 if( aTable->IsReadOnly() )
231 tabTitle += wxS( " " ) + _( "(read-only)" );
232
233 for( int ii = 2; ii < (int) m_notebook->GetPageCount(); ++ii )
234 {
235 if( m_notebook->GetPageText( ii ) == tabTitle )
236 {
237 // Something is pretty fishy with wxAuiNotebook::ChangeSelection(); on Mac at least it
238 // results in a re-entrant call where the second call is one page behind.
239 for( int attempts = 0; attempts < 3; ++attempts )
240 m_notebook->ChangeSelection( ii );
241
242 return;
243 }
244 }
245
246 m_nestedTables.push_back( aTable );
247 AddTable( aTable.get(), tabTitle, true );
248
249 // Something is pretty fishy with wxAuiNotebook::ChangeSelection(); on Mac at least it
250 // results in a re-entrant call where the second call is one page behind.
251 for( int attempts = 0; attempts < 3; ++attempts )
252 m_notebook->ChangeSelection( m_notebook->GetPageCount() - 1 );
253}
254
255
256void PANEL_SYM_LIB_TABLE::AddTable( LIBRARY_TABLE* table, const wxString& aTitle, bool aClosable )
257{
259 wxString projectPath = m_project->GetProjectPath();
260
262
263 WX_GRID* grid = get_grid( (int) m_notebook->GetPageCount() - 1 );
264
265 if( table->Path().StartsWith( projectPath ) )
266 {
268 &m_lastProjectLibDir, projectPath ),
269 true /* take ownership */ );
270 }
271 else
272 {
273 wxString* lastGlobalLibDir = nullptr;
274
276 {
277 if( cfg->m_lastSymbolLibDir.IsEmpty() )
278 cfg->m_lastSymbolLibDir = PATHS::GetDefaultUserSymbolsPath();
279
280 lastGlobalLibDir = &cfg->m_lastSymbolLibDir;
281 }
282
284 lastGlobalLibDir, wxEmptyString ),
285 true /* take ownership */ );
286 }
287
288 static_cast<LIB_TABLE_GRID_DATA_MODEL*>( grid->GetTable() )->RecheckRows();
289
290 LIB_TABLE_NOTEBOOK_PANEL* notebookPanel =
291 static_cast<LIB_TABLE_NOTEBOOK_PANEL*>( m_notebook->GetPage( m_notebook->GetPageCount() - 1 ) );
292
293 static_cast<LIB_TABLE_GRID_DATA_MODEL*>( grid->GetTable() )
295 [notebookPanel]()
296 {
297 notebookPanel->MarkDirty();
298 } );
299
300 // add Cut, Copy, and Paste to wxGrids
301 grid->PushEventHandler( new SYMBOL_GRID_TRICKS( this, grid,
302 [this]( wxCommandEvent& event )
303 {
304 appendRowHandler( event );
305 } ) );
306
307 auto autoSizeCol =
308 [&]( int aCol )
309 {
310 int prevWidth = grid->GetColSize( aCol );
311
312 grid->AutoSizeColumn( aCol, false );
313 grid->SetColSize( aCol, std::max( prevWidth, grid->GetColSize( aCol ) ) );
314 };
315
316 // all but COL_OPTIONS, which is edited with Option Editor anyways.
317 autoSizeCol( COL_NICKNAME );
318 autoSizeCol( COL_TYPE );
319 autoSizeCol( COL_URI );
320 autoSizeCol( COL_DESCR );
321
322 if( grid->GetNumberRows() > 0 )
323 {
324 grid->SetGridCursor( 0, COL_NICKNAME );
325 grid->SelectRow( 0 );
326 }
327}
328
329
331 PANEL_SYM_LIB_TABLE_BASE( aParent ),
332 m_project( aProject ),
333 m_parent( aParent ),
335{
336 m_lastProjectLibDir = m_project->GetProjectPath();
337
339
340 for( const SCH_IO_MGR::SCH_FILE_T& type : SCH_IO_MGR::SCH_FILE_T_vector )
341 {
342 if( type == SCH_IO_MGR::SCH_NESTED_TABLE )
343 {
345 continue;
346 }
347
348 IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( type ) );
349
350 if( pi )
352 }
353
354 std::optional<LIBRARY_TABLE*> table = Pgm().GetLibraryManager().Table( LIBRARY_TABLE_TYPE::SYMBOL,
356 wxASSERT( table.has_value() );
357
358 AddTable( table.value(), _( "Global Libraries" ), false /* closable */ );
359
360 std::optional<LIBRARY_TABLE*> projectTable = Pgm().GetLibraryManager().Table( LIBRARY_TABLE_TYPE::SYMBOL,
362
363 if( projectTable.has_value() )
364 AddTable( projectTable.value(), _( "Project Specific Libraries" ), false /* closable */ );
365
366 m_notebook->SetArtProvider( new WX_AUI_TAB_ART() );
367
368 // add Cut, Copy, and Paste to wxGrids
369 m_path_subs_grid->PushEventHandler( new GRID_TRICKS( m_path_subs_grid ) );
370
372
373 m_path_subs_grid->SetColLabelValue( 0, _( "Name" ) );
374 m_path_subs_grid->SetColLabelValue( 1, _( "Value" ) );
375
376 // Configure button logos
382
383 // For aesthetic reasons, we must set the size of m_browseButton to match the other bitmaps
384 Layout();
385 wxSize buttonSize = m_append_button->GetSize();
386
387 m_browseButton->SetWidthPadding( 4 );
388 m_browseButton->SetMinSize( buttonSize );
389
390 // Populate the browse library options
391 wxMenu* browseMenu = m_browseButton->GetSplitButtonMenu();
392
393 auto joinExtensions =
394 []( const std::vector<std::string>& aExts ) -> wxString
395 {
396 wxString result;
397
398 for( const std::string& ext : aExts )
399 {
400 if( !result.IsEmpty() )
401 result << wxT( ", " );
402
403 result << wxT( "." ) << ext;
404 }
405
406 return result;
407 };
408
409 for( auto& [type, desc] : m_supportedSymFiles )
410 {
411 wxString entryStr = SCH_IO_MGR::ShowType( type );
412
413 if( !desc.m_FileExtensions.empty() )
414 entryStr << wxString::Format( wxS( " (%s)" ), joinExtensions( desc.m_FileExtensions ) );
415
416 browseMenu->Append( type + FIRST_MENU_ID, entryStr );
417 browseMenu->Bind( wxEVT_COMMAND_MENU_SELECTED, &PANEL_SYM_LIB_TABLE::browseLibrariesHandler, this,
418 type + FIRST_MENU_ID );
419
420 // Add folder-based entry right after KiCad file-based entry
421 if( type == SCH_IO_MGR::SCH_KICAD )
422 {
423 wxString folderEntry = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_KICAD );
424 folderEntry << wxString::Format( wxS( " (%s)" ), _( "folder with .kicad_sym files" ) );
425 browseMenu->Append( ID_PANEL_SYM_LIB_KICAD_FOLDER, folderEntry );
426 browseMenu->Bind( wxEVT_COMMAND_MENU_SELECTED, &PANEL_SYM_LIB_TABLE::browseLibrariesHandler, this,
428 }
429 }
430
431 Layout();
432
433 m_notebook->Bind( wxEVT_AUINOTEBOOK_PAGE_CLOSE, &PANEL_SYM_LIB_TABLE::onNotebookPageCloseRequest, this );
434 m_notebook->Bind( wxEVT_AUINOTEBOOK_PAGE_CHANGING, &PANEL_SYM_LIB_TABLE::onNotebookPageChangeRequest, this );
436
437 m_parent->SetCanCloseCheck(
438 [this]()
439 {
440 for( int ii = 0; ii < (int) m_notebook->GetPageCount(); ++ii )
441 {
443 static_cast<LIB_TABLE_NOTEBOOK_PANEL*>( m_notebook->GetPage( ii ) );
444
445 if( panel->GetClosable() )
446 {
447 bool wasDirty = panel->TableModified();
448
449 if( !panel->GetCanClose() )
450 return false;
451
452 if( wasDirty && !panel->TableModified() )
453 {
454 m_parent->m_GlobalTableChanged = true;
455 m_parent->m_ProjectTableChanged = true;
456 }
457 }
458 }
459
460 return true;
461 } );
462}
463
464
466{
467 wxMenu* browseMenu = m_browseButton->GetSplitButtonMenu();
468
469 for( auto& [type, desc] : m_supportedSymFiles )
470 browseMenu->Unbind( wxEVT_COMMAND_MENU_SELECTED, &PANEL_SYM_LIB_TABLE::browseLibrariesHandler, this, type );
471
472 browseMenu->Unbind( wxEVT_COMMAND_MENU_SELECTED, &PANEL_SYM_LIB_TABLE::browseLibrariesHandler,
474 m_browseButton->Unbind( wxEVT_BUTTON, &PANEL_SYM_LIB_TABLE::browseLibrariesHandler, this );
475
476 // Delete the GRID_TRICKS.
477 // (Notebook page GRID_TRICKS are deleted by LIB_TABLE_NOTEBOOK_PANEL.)
478 m_path_subs_grid->PopEventHandler( true );
479}
480
481
483{
484 for( const SCH_IO_MGR::SCH_FILE_T& type : SCH_IO_MGR::SCH_FILE_T_vector )
485 {
486 IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( type ) );
487
488 if( !pi )
489 continue;
490
491 if( const IO_BASE::IO_FILE_DESC& desc = pi->GetLibraryDesc() )
492 {
493 if( !desc.m_FileExtensions.empty() )
494 m_supportedSymFiles.emplace( type, desc );
495 }
496 }
497
498 m_supportedSymFiles.emplace( SCH_IO_MGR::SCH_NESTED_TABLE,
499 IO_BASE::IO_FILE_DESC( _( "Table (nested library table)" ), {} ) );
500}
501
502
504{
505 return static_cast<SYMBOL_LIB_TABLE_GRID_DATA_MODEL*>( get_grid( aPage )->GetTable() );
506}
507
508
510{
511 return static_cast<LIB_TABLE_NOTEBOOK_PANEL*>( m_notebook->GetPage( aPage ) )->GetGrid();
512}
513
514
516{
517 // for ALT+A handling, we want the initial focus to be on the first selected grid.
518 m_parent->SetInitialFocus( cur_grid() );
519
520 return true;
521}
522
523
525{
526 for( int page = 0 ; page < (int) m_notebook->GetPageCount(); ++page )
527 {
528 WX_GRID* grid = get_grid( page );
529
531 [&]( int aRow, int aCol )
532 {
533 // show the tabbed panel holding the grid we have flunked:
534 if( m_notebook->GetSelection() != page )
535 m_notebook->SetSelection( page );
536
537 grid->MakeCellVisible( aRow, 0 );
538 grid->SetGridCursor( aRow, aCol );
539 } ) )
540 {
541 return false;
542 }
543 }
544
545 return true;
546}
547
548
550{
551 if( !cur_grid()->CommitPendingChanges() )
552 return;
553
554 SCH_IO_MGR::SCH_FILE_T fileType = SCH_IO_MGR::SCH_FILE_UNKNOWN;
555 bool selectingFolder = false;
556
557 // We are bound both to the menu and button with this one handler
558 if( event.GetEventType() == wxEVT_BUTTON )
559 {
560 // Default to KiCad file format when clicking the button directly
561 fileType = SCH_IO_MGR::SCH_KICAD;
562 }
563 else if( event.GetId() == ID_PANEL_SYM_LIB_KICAD_FOLDER )
564 {
565 // Special case for folder-based KiCad library
566 fileType = SCH_IO_MGR::SCH_KICAD;
567 selectingFolder = true;
568 }
569 else
570 {
571 fileType = static_cast<SCH_IO_MGR::SCH_FILE_T>( event.GetId() - FIRST_MENU_ID );
572 }
573
574 if( fileType == SCH_IO_MGR::SCH_FILE_UNKNOWN )
575 return;
576
577 const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
578
580 wxString dummy;
581 wxString* lastDir;
582
583 if( m_notebook->GetSelection() == 0 )
584 lastDir = cfg ? &cfg->m_lastSymbolLibDir : &dummy;
585 else
586 lastDir = &m_lastProjectLibDir;
587
588 wxString title = wxString::Format( _( "Select %s Library" ), SCH_IO_MGR::ShowType( fileType ) );
589 wxWindow* topLevelParent = wxGetTopLevelParent( this );
590 wxArrayString files;
591
592 if( selectingFolder )
593 {
594 wxDirDialog dlg( topLevelParent, title, *lastDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST | wxDD_MULTIPLE );
595
596 if( dlg.ShowModal() == wxID_CANCEL )
597 return;
598
599 dlg.GetPaths( files );
600
601 if( !files.IsEmpty() )
602 {
603 wxFileName first( files.front() );
604 *lastDir = first.GetPath();
605 }
606 }
607 else
608 {
609 auto it = m_supportedSymFiles.find( fileType );
610
611 if( it == m_supportedSymFiles.end() )
612 return;
613
614 const IO_BASE::IO_FILE_DESC& fileDesc = it->second;
615
616 wxFileDialog dlg( topLevelParent, title, *lastDir, wxEmptyString, fileDesc.FileFilter(),
617 wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
618
620
621 if( dlg.ShowModal() == wxID_CANCEL )
622 return;
623
624 dlg.GetPaths( files );
625 *lastDir = dlg.GetDirectory();
626 }
627
628 bool addDuplicates = false;
629 bool applyToAll = false;
630 wxString warning = _( "Warning: Duplicate Nicknames" );
631 wxString msg = _( "An item nicknamed '%s' already exists." );
632 wxString detailedMsg = _( "One of the nicknames will need to be changed." );
633
634 for( const wxString& filePath : files )
635 {
636 wxFileName fn( filePath );
637 wxString nickname = LIB_ID::FixIllegalChars( fn.GetName(), true );
638 bool doAdd = true;
639
640 if( cur_model()->ContainsNickname( nickname ) )
641 {
642 if( !applyToAll )
643 {
644 addDuplicates = OKOrCancelDialog( topLevelParent, warning,
645 wxString::Format( msg, nickname ), detailedMsg,
646 _( "Skip" ), _( "Add Anyway" ),
647 &applyToAll ) == wxID_CANCEL;
648 }
649
650 doAdd = addDuplicates;
651 }
652
653 if( doAdd && cur_grid()->AppendRows( 1 ) )
654 {
655 int last_row = cur_grid()->GetNumberRows() - 1;
656
657 cur_grid()->SetCellValue( last_row, COL_NICKNAME, nickname );
658 cur_grid()->SetCellValue( last_row, COL_TYPE, SCH_IO_MGR::ShowType( fileType ) );
659
660 // try to use path normalized to an environmental variable or project path
661 wxString path = NormalizePath( filePath, &envVars, m_project->GetProjectPath() );
662
663 // Do not use the project path in the global library table. This will almost
664 // assuredly be wrong for a different project.
665 if( m_notebook->GetSelection() == 0 && path.Contains( wxT( "${KIPRJMOD}" ) ) )
666 path = fn.GetFullPath();
667
668 cur_grid()->SetCellValue( last_row, COL_URI, path );
669 }
670 }
671
672 if( !files.IsEmpty() )
673 {
674 cur_grid()->MakeCellVisible( cur_grid()->GetNumberRows() - 1, COL_ENABLED );
675 cur_grid()->SetGridCursor( cur_grid()->GetNumberRows() - 1, COL_NICKNAME );
676 }
677}
678
679
684
685
690
691
696
697
702
703
704void PANEL_SYM_LIB_TABLE::onReset( wxCommandEvent& event )
705{
706 if( !cur_grid()->CommitPendingChanges() )
707 return;
708
709 WX_GRID* grid = get_grid( 0 );
710
711 // No need to prompt to preserve an empty table
712 if( grid->GetNumberRows() > 0 && !IsOK( this, wxString::Format( _( "This action will reset your global library "
713 "table on disk and cannot be undone." ) ) ) )
714 {
715 return;
716 }
717
718 wxString* lastGlobalLibDir = nullptr;
719
721 {
722 if( cfg->m_lastSymbolLibDir.IsEmpty() )
723 cfg->m_lastSymbolLibDir = PATHS::GetDefaultUserSymbolsPath();
724
725 lastGlobalLibDir = &cfg->m_lastSymbolLibDir;
726 }
727
729
730 // Go ahead and reload here because this action takes place even if the dialog is canceled
732
733 if( KIFACE *schface = m_parent->Kiway().KiFACE( KIWAY::FACE_SCH ) )
734 schface->PreloadLibraries( &m_parent->Kiway() );
735
736 grid->Freeze();
737
738 wxGridTableBase* table = grid->GetTable();
739 grid->DestroyTable( table );
740
741 std::optional<LIBRARY_TABLE*> newTable = Pgm().GetLibraryManager().Table( LIBRARY_TABLE_TYPE::SYMBOL,
743 wxASSERT( newTable );
744
746
747 grid->SetTable( new SYMBOL_LIB_TABLE_GRID_DATA_MODEL( m_parent, grid, *newTable.value(), adapter, m_pluginChoices,
748 lastGlobalLibDir, wxEmptyString ),
749 true /* take ownership */ );
750
752 static_cast<LIB_TABLE_NOTEBOOK_PANEL*>( m_notebook->GetPage( 0 ) );
753 panel0->ClearDirty();
754 static_cast<LIB_TABLE_GRID_DATA_MODEL*>( grid->GetTable() )->SetChangeCallback(
755 [panel0]() { panel0->MarkDirty(); } );
756
757 m_parent->m_GlobalTableChanged = true;
758
759 grid->Thaw();
760
761 if( grid->GetNumberRows() > 0 )
762 {
763 grid->SetGridCursor( 0, COL_NICKNAME );
764 grid->SelectRow( 0 );
765 }
766}
767
768
769void PANEL_SYM_LIB_TABLE::onNotebookPageChangeRequest( wxAuiNotebookEvent& aEvent )
770{
772 aEvent.Veto();
773 else
774 aEvent.Skip();
775}
776
777
778void PANEL_SYM_LIB_TABLE::onPageChange( wxAuiNotebookEvent& event )
779{
780 m_resetGlobal->Enable( m_notebook->GetSelection() == 0 );
781}
782
783
784void PANEL_SYM_LIB_TABLE::onNotebookPageCloseRequest( wxAuiNotebookEvent& aEvent )
785{
786 wxAuiNotebook* notebook = (wxAuiNotebook*) aEvent.GetEventObject();
787 wxWindow* page = notebook->GetPage( aEvent.GetSelection() );
788
789 if( LIB_TABLE_NOTEBOOK_PANEL* panel = dynamic_cast<LIB_TABLE_NOTEBOOK_PANEL*>( page ) )
790 {
791 if( panel->GetClosable() )
792 {
793 if( !panel->GetCanClose() )
794 aEvent.Veto();
795 }
796 else
797 {
798 aEvent.Veto();
799 }
800 }
801}
802
803
805{
806 if( !cur_grid()->CommitPendingChanges() )
807 return;
808
809 wxArrayInt selectedRows = cur_grid()->GetSelectedRows();
810
811 if( selectedRows.empty() && cur_grid()->GetGridCursorRow() >= 0 )
812 selectedRows.push_back( cur_grid()->GetGridCursorRow() );
813
814 wxArrayInt legacyRows;
815 wxString databaseType = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_DATABASE );
816 wxString httpType = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_HTTP );
817 wxString kicadType = SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_KICAD );
818 wxString nestedTableType = LIBRARY_TABLE_ROW::TABLE_TYPE_NAME;
819 wxString msg;
820
821 // HTTP and Database libraries are live, dynamic backends that are not file-based.
822 // Migrating them to a static .kicad_sym snapshot is not meaningful and would silently
823 // produce an empty library, destroying the original table entry. Nested library tables
824 // are not symbol libraries at all and likewise cannot be migrated.
825 for( int row : selectedRows )
826 {
827 const wxString& type = cur_grid()->GetCellValue( row, COL_TYPE );
828
829 if( type != databaseType && type != httpType && type != kicadType && type != nestedTableType )
830 legacyRows.push_back( row );
831 }
832
833 if( legacyRows.size() <= 0 )
834 {
835 wxMessageBox( _( "Select one or more rows containing libraries to save as current KiCad format." ) );
836 return;
837 }
838 else
839 {
840 if( legacyRows.size() == 1 )
841 {
842 msg.Printf( _( "Save '%s' as current KiCad format (*.kicad_sym) and replace legacy entry in table?" ),
843 cur_grid()->GetCellValue( legacyRows[0], COL_NICKNAME ) );
844 }
845 else
846 {
847 msg.Printf( _( "Save %d libraries as current KiCad format (*.kicad_sym) and replace legacy entries "
848 "in table?" ),
849 (int) legacyRows.size() );
850 }
851
852 if( !IsOK( m_parent, msg ) )
853 return;
854 }
855
856 for( int row : legacyRows )
857 {
858 wxString relPath = cur_grid()->GetCellValue( row, COL_URI );
859 wxString resolvedPath = ExpandEnvVarSubstitutions( relPath, m_project );
860 wxFileName legacyLib( resolvedPath );
861
862 if( !legacyLib.Exists() )
863 {
864 DisplayErrorMessage( m_parent, wxString::Format( _( "Library '%s' not found." ), relPath ) );
865 continue;
866 }
867
868 wxFileName newLib( resolvedPath );
869 newLib.SetExt( "kicad_sym" );
870
871 if( newLib.Exists() )
872 {
873 msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ), newLib.GetFullPath() );
874
875 switch( wxMessageBox( msg, _( "Migrate Library" ), wxYES_NO | wxCANCEL | wxICON_QUESTION, m_parent ) )
876 {
877 case wxYES: break;
878 case wxNO: continue;
879 case wxCANCEL: return;
880 }
881 }
882
883 wxString options = cur_grid()->GetCellValue( row, COL_OPTIONS );
884 std::map<std::string, UTF8> props( LIBRARY_TABLE::ParseOptions( options.ToStdString() ) );
885
886 if( SCH_IO_MGR::ConvertLibrary( &props, legacyLib.GetFullPath(), newLib.GetFullPath() ) )
887 {
888 relPath = NormalizePath( newLib.GetFullPath(), &Pgm().GetLocalEnvVariables(), m_project );
889
890 cur_grid()->SetCellValue( row, COL_URI, relPath );
891 cur_grid()->SetCellValue( row, COL_TYPE, kicadType );
892 cur_grid()->SetCellValue( row, COL_OPTIONS, wxEmptyString );
893 }
894 else
895 {
896 DisplayErrorMessage( m_parent, wxString::Format( _( "Failed to save symbol library file '%s'." ),
897 newLib.GetFullPath() ) );
898 }
899 }
900}
901
902
904{
905 if( !cur_grid()->CommitPendingChanges() )
906 return false;
907
908 if( !verifyTables() )
909 return false;
910
912 std::optional<LIBRARY_TABLE*> optTable = manager.Table( LIBRARY_TABLE_TYPE::SYMBOL, LIBRARY_TABLE_SCOPE::GLOBAL );
913 wxCHECK( optTable, false );
914 LIBRARY_TABLE* globalTable = *optTable;
915
916 if( get_model( 0 )->Table() != *globalTable )
917 {
918 m_parent->m_GlobalTableChanged = true;
919 *globalTable = get_model( 0 )->Table();
920
921 globalTable->Save().map_error(
922 []( const LIBRARY_ERROR& aError )
923 {
924 wxMessageBox( _( "Error saving global library table:\n\n" ) + aError.message,
925 _( "File Save Error" ), wxOK | wxICON_ERROR );
926 } );
927 }
928
930
931 if( optTable.has_value() && get_model( 1 )->Table().Path() == optTable.value()->Path() )
932 {
933 LIBRARY_TABLE* projectTable = *optTable;
934
935 if( get_model( 1 )->Table() != *projectTable )
936 {
937 m_parent->m_ProjectTableChanged = true;
938 *projectTable = get_model( 1 )->Table();
939
940 projectTable->Save().map_error(
941 []( const LIBRARY_ERROR& aError )
942 {
943 wxMessageBox( _( "Error saving project library table:\n\n" ) + aError.message,
944 _( "File Save Error" ), wxOK | wxICON_ERROR );
945 } );
946 }
947 }
948
950 return true;
951}
952
953
955{
956 wxRegEx re( ".*?(\\$\\{(.+?)\\})|(\\$\\((.+?)\\)).*?", wxRE_ADVANCED );
957 wxASSERT( re.IsValid() ); // wxRE_ADVANCED is required.
958
959 std::set< wxString > unique;
960
961 // clear the table
962 m_path_subs_grid->ClearRows();
963
964 for( int page = 0 ; page < (int) m_notebook->GetPageCount(); ++page )
965 {
967
968 for( int row = 0; row < model->GetNumberRows(); ++row )
969 {
970 wxString uri = model->GetValue( row, COL_URI );
971
972 while( re.Matches( uri ) )
973 {
974 wxString envvar = re.GetMatch( uri, 2 );
975
976 // if not ${...} form then must be $(...)
977 if( envvar.IsEmpty() )
978 envvar = re.GetMatch( uri, 4 );
979
980 // ignore duplicates
981 unique.insert( envvar );
982
983 // delete the last match and search again
984 uri.Replace( re.GetMatch( uri, 0 ), wxEmptyString );
985 }
986 }
987 }
988
989 // Make sure this special environment variable shows up even if it was
990 // not used yet. It is automatically set by KiCad to the directory holding
991 // the current project.
992 unique.insert( PROJECT_VAR_NAME );
993 unique.insert( ENV_VAR::GetVersionedEnvVarName( wxS( "SYMBOL_DIR" ) ) );
994
995 for( const wxString& evName : unique )
996 {
997 int row = m_path_subs_grid->GetNumberRows();
998 m_path_subs_grid->AppendRows( 1 );
999
1000 m_path_subs_grid->SetCellValue( row, 0, wxT( "${" ) + evName + wxT( "}" ) );
1001 m_path_subs_grid->SetCellEditor( row, 0, new GRID_CELL_READONLY_TEXT_EDITOR() );
1002
1003 wxString evValue;
1004 wxGetEnv( evName, &evValue );
1005 m_path_subs_grid->SetCellValue( row, 1, evValue );
1006 m_path_subs_grid->SetCellEditor( row, 1, new GRID_CELL_READONLY_TEXT_EDITOR() );
1007 }
1008
1009 adjustPathSubsGridColumns( m_path_subs_grid->GetRect().GetWidth() );
1010}
1011
1012
1014{
1015 // Account for scroll bars
1016 aWidth -= ( m_path_subs_grid->GetSize().x - m_path_subs_grid->GetClientSize().x );
1017
1018 m_path_subs_grid->AutoSizeColumn( 0 );
1019 m_path_subs_grid->SetColSize( 0, std::max( 72, m_path_subs_grid->GetColSize( 0 ) ) );
1020 m_path_subs_grid->SetColSize( 1, std::max( 120, aWidth - m_path_subs_grid->GetColSize( 0 ) ) );
1021}
1022
1023
1024void PANEL_SYM_LIB_TABLE::onSizeGrid( wxSizeEvent& event )
1025{
1026 adjustPathSubsGridColumns( event.GetSize().GetX() );
1027
1028 event.Skip();
1029}
1030
1031
1032void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent )
1033{
1034 auto symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false ) );
1035 wxString msg;
1036
1037 // Refuse to open the dialog re-entrantly while a library sync is running. A
1038 // sync can yield the event loop (via the progress dialog), which dispatches any
1039 // pending UI events — including clicks that accumulated while the app was busy.
1040 // Opening the dialog mid-sync corrupts the library tree. Reschedule instead.
1041 if( symbolEditor && symbolEditor->IsSyncLibrariesInProgress() )
1042 {
1043 symbolEditor->CallAfter( [aKiway, aParent]()
1044 {
1045 InvokeSchEditSymbolLibTable( aKiway, aParent );
1046 } );
1047 return;
1048 }
1049
1050 if( symbolEditor )
1051 {
1052 // This prevents an ugly crash on OSX (https://bugs.launchpad.net/kicad/+bug/1765286)
1053 symbolEditor->FreezeLibraryTree();
1054
1055 if( symbolEditor->HasLibModifications() )
1056 {
1057 msg = _( "Modifications have been made to one or more symbol libraries.\n"
1058 "Changes must be saved or discarded before the symbol library table can be modified." );
1059
1060 switch( UnsavedChangesDialog( aParent, msg ) )
1061 {
1062 case wxID_YES: symbolEditor->SaveAll(); break;
1063 case wxID_NO: symbolEditor->RevertAll(); break;
1064 default:
1065 case wxID_CANCEL: symbolEditor->ThawLibraryTree(); return;
1066 }
1067 }
1068 }
1069
1070 DIALOG_EDIT_LIBRARY_TABLES dlg( aParent, _( "Symbol Libraries" ) );
1071 dlg.SetKiway( &dlg, aKiway );
1072
1073 dlg.InstallPanel( new PANEL_SYM_LIB_TABLE( &dlg, &aKiway->Prj() ) );
1074
1075 if( dlg.ShowModal() == wxID_CANCEL )
1076 {
1077 if( symbolEditor )
1078 symbolEditor->ThawLibraryTree();
1079
1080 return;
1081 }
1082
1083 if( dlg.m_GlobalTableChanged )
1085
1086 if( dlg.m_ProjectTableChanged )
1087 {
1088 // Trigger a reload of the table and cancel an in-progress background load
1090 }
1091
1092 // Trigger a reload in case any libraries have been added or removed
1093 if( KIFACE *schface = aKiway->KiFACE( KIWAY::FACE_SCH ) )
1094 schface->PreloadLibraries( aKiway );
1095
1096 if( symbolEditor )
1097 symbolEditor->ThawLibraryTree();
1098}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
An options editor in the form of a two column name/value spreadsheet like (table) UI.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition dialog_shim.h:65
int ShowModal() override
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition grid_tricks.h:57
WX_GRID * m_grid
I don't own the grid, but he owns me.
void SetTooltipEnable(int aCol, bool aEnable=true)
Enable the tooltip for a column.
Definition grid_tricks.h:71
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:311
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:398
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition kiway.cpp:207
@ FACE_SCH
eeschema DSO
Definition kiway.h:318
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition kiway.cpp:201
static wxString ExpandURI(const wxString &aShortURI, const PROJECT &aProject)
std::optional< LIBRARY_TABLE * > Table(LIBRARY_TABLE_TYPE aType, LIBRARY_TABLE_SCOPE aScope)
Retrieves a given table; creating a new empty project table if a valid project is loaded and the give...
void ApplyLibOverrides(LIBRARY_TABLE &aTable)
Applies stored user overrides (disabled/hidden) to rows of a read-only table.
static bool CreateGlobalTable(LIBRARY_TABLE_TYPE aType, bool aPopulateDefaultLibraries)
void LoadGlobalTables(std::initializer_list< LIBRARY_TABLE_TYPE > aTablesToLoad={})
(Re)loads the global library tables in the given list, or all tables if no list is given
void ProjectChanged()
Notify all adapters that the project has changed.
void SetOptions(const wxString &aOptions)
const wxString & Type() const
static const wxString TABLE_TYPE_NAME
const wxString & URI() const
const wxString & Nickname() const
const wxString & Options() const
LIBRARY_RESULT< void > Save()
static std::map< std::string, UTF8 > ParseOptions(const std::string &aOptionsList)
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib)
Replace illegal LIB_ID item name characters with underscores '_'.
Definition lib_id.cpp:188
This abstract base class mixes any object derived from #LIB_TABLE into wxGridTableBase so the result ...
virtual LIBRARY_TABLE_ROW & at(size_t aIndex)
void SetChangeCallback(std::function< void()> aCallback)
LIBRARY_TABLE_ROW & At(size_t aIndex)
void SetValue(int aRow, int aCol, const wxString &aValue) override
LIB_TABLE_GRID_DATA_MODEL(DIALOG_SHIM *aParent, WX_GRID *aGrid, const LIBRARY_TABLE &aTableToEdit, LIBRARY_MANAGER_ADAPTER *aAdapter, const wxArrayString &aPluginChoices, wxString *aMRUDirectory, const wxString &aProjectPath)
static void MoveUpHandler(WX_GRID *aGrid)
LIB_TABLE_GRID_TRICKS(WX_GRID *aGrid)
static void DeleteRowHandler(WX_GRID *aGrid)
static void AppendRowHandler(WX_GRID *aGrid)
static bool VerifyTable(WX_GRID *aGrid, bool aSupportsVisibilityColumn, std::function< void(int aRow, int aCol)> aErrorHandler)
static void MoveDownHandler(WX_GRID *aGrid)
static void AddTable(wxAuiNotebook *aNotebook, const wxString &aTitle, bool aClosable)
PANEL_SYM_LIB_TABLE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
STD_BITMAP_BUTTON * m_move_down_button
Dialog to show and edit symbol library tables.
void moveUpHandler(wxCommandEvent &event) override
SYMBOL_LIB_TABLE_GRID_DATA_MODEL * get_model(int aPage) const
void onReset(wxCommandEvent &event) override
void browseLibrariesHandler(wxCommandEvent &event)
void deleteRowHandler(wxCommandEvent &event) override
WX_GRID * get_grid(int aPage) const
void onNotebookPageCloseRequest(wxAuiNotebookEvent &aEvent)
void onPageChange(wxAuiNotebookEvent &event) override
void AddTable(LIBRARY_TABLE *table, const wxString &aTitle, bool aClosable)
bool verifyTables()
Trim important fields, removes blank row entries, and checks for duplicates.
void adjustPathSubsGridColumns(int aWidth)
void OpenTable(const std::shared_ptr< LIBRARY_TABLE > &table, const wxString &aTitle)
void onSizeGrid(wxSizeEvent &event) override
std::vector< std::shared_ptr< LIBRARY_TABLE > > m_nestedTables
void onConvertLegacyLibraries(wxCommandEvent &event) override
void onNotebookPageChangeRequest(wxAuiNotebookEvent &aEvent)
std::map< SCH_IO_MGR::SCH_FILE_T, IO_BASE::IO_FILE_DESC > m_supportedSymFiles
bool TransferDataToWindow() override
wxArrayString m_pluginChoices
void moveDownHandler(wxCommandEvent &event) override
PANEL_SYM_LIB_TABLE(DIALOG_EDIT_LIBRARY_TABLES *aParent, PROJECT *m_project)
SYMBOL_LIB_TABLE_GRID_DATA_MODEL * cur_model() const
void populateEnvironReadOnlyTable()
Populate the readonly environment variable table with names and values by examining all the full_uri ...
WX_GRID * cur_grid() const
DIALOG_EDIT_LIBRARY_TABLES * m_parent
bool TransferDataFromWindow() override
void appendRowHandler(wxCommandEvent &event) override
static wxString GetDefaultUserSymbolsPath()
Gets the default path we point users to create projects.
Definition paths.cpp:82
virtual ENV_VAR_MAP & GetLocalEnvVariables() const
Definition pgm_base.cpp:774
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:126
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
Container for project specific data.
Definition project.h:62
static bool ConvertLibrary(std::map< std::string, UTF8 > *aOldFileProps, const wxString &aOldFilePath, const wxString &aNewFilepath)
Convert a schematic symbol library to the latest KiCad format.
static SCH_FILE_T EnumFromStr(const wxString &aFileType)
Return the #SCH_FILE_T from the corresponding plugin type name: "kicad", "legacy",...
static const wxString ShowType(SCH_FILE_T aFileType)
Return a brief name for a plugin, given aFileType enum.
static SCH_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath, int aCtl=0)
Return a plugin type given a symbol library using the file extension of aLibPath.
The symbol library editor main window.
SYMBOL_GRID_TRICKS(PANEL_SYM_LIB_TABLE *aPanel, WX_GRID *aGrid, std::function< void(wxCommandEvent &)> aAddHandler)
bool supportsVisibilityColumn() override
wxString getTablePreamble() override
PANEL_SYM_LIB_TABLE * m_panel
void openTable(const LIBRARY_TABLE_ROW &aRow) override
void optionsEditor(int aRow) override
static bool SupportsVisibilityColumn()
An interface to the global shared library manager that is schematic-specific and linked to one projec...
SYMBOL_LIB_TABLE_GRID_DATA_MODEL(DIALOG_SHIM *aParent, WX_GRID *aGrid, const LIBRARY_TABLE &aTableToEdit, SYMBOL_LIBRARY_ADAPTER *aAdapter, const wxArrayString &aPluginChoices, wxString *aMRUDirectory, const wxString &aProjectPath)
void SetValue(int aRow, int aCol, const wxString &aValue) override
wxString getFileTypes(WX_GRID *aGrid, int aRow) override
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition common.cpp:704
The common library.
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:165
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition confirm.cpp:274
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
int UnsavedChangesDialog(wxWindow *parent, const wxString &aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
Definition confirm.cpp:60
This file is part of the common library.
#define _(s)
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:73
Helper functions to substitute paths with environmental variables.
Functions related to environment variables, including help functions.
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:31
static const std::string SymbolLibraryTableFileName
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
Definition io_mgr.h:33
PROJECT & Prj()
Definition kicad.cpp:730
KICOMMON_API wxString GetVersionedEnvVarName(const wxString &aBaseName)
Construct a versioned environment variable based on this KiCad major version.
Definition env_vars.cpp:77
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:448
static constexpr int FIRST_MENU_ID
Special menu ID for folder-based KiCad symbol library format.
static constexpr int ID_PANEL_SYM_LIB_KICAD_FOLDER
void InvokeSchEditSymbolLibTable(KIWAY *aKiway, wxWindow *aParent)
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition project.h:37
T * GetAppSettings(const char *aFilename)
std::vector< FAB_LAYER_COLOR > dummy
MODEL3D_FORMAT_TYPE fileType(const char *aFileName)
Container that describes file type info.
Definition io_base.h:43
bool m_IsFile
Whether the library is a folder or a file.
Definition io_base.h:51
wxString FileFilter() const
Definition io_base.cpp:40
Implement a participant in the KIWAY alchemy.
Definition kiway.h:152
wxString message
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.
DESIGN_BLOCK_IO_MGR::DESIGN_BLOCK_FILE_T m_Plugin
wxString m_FolderSearchExtension
In case of folders it stands for extensions of files stored inside.
std::string path
KIBIS_MODEL * model
std::vector< std::vector< std::string > > table
wxString result
Test unit parsing edge cases and error handling.
Definition of file extensions used in Kicad.