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 along
19 * with this program. If not, see <http://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 msg;
819
820 // HTTP and Database libraries are live, dynamic backends that are not file-based.
821 // Migrating them to a static .kicad_sym snapshot is not meaningful and would silently
822 // produce an empty library, destroying the original table entry.
823 for( int row : selectedRows )
824 {
825 const wxString& type = cur_grid()->GetCellValue( row, COL_TYPE );
826
827 if( type != databaseType && type != httpType && type != kicadType )
828 legacyRows.push_back( row );
829 }
830
831 if( legacyRows.size() <= 0 )
832 {
833 wxMessageBox( _( "Select one or more rows containing libraries to save as current KiCad format." ) );
834 return;
835 }
836 else
837 {
838 if( legacyRows.size() == 1 )
839 {
840 msg.Printf( _( "Save '%s' as current KiCad format (*.kicad_sym) and replace legacy entry in table?" ),
841 cur_grid()->GetCellValue( legacyRows[0], COL_NICKNAME ) );
842 }
843 else
844 {
845 msg.Printf( _( "Save %d libraries as current KiCad format (*.kicad_sym) and replace legacy entries "
846 "in table?" ),
847 (int) legacyRows.size() );
848 }
849
850 if( !IsOK( m_parent, msg ) )
851 return;
852 }
853
854 for( int row : legacyRows )
855 {
856 wxString relPath = cur_grid()->GetCellValue( row, COL_URI );
857 wxString resolvedPath = ExpandEnvVarSubstitutions( relPath, m_project );
858 wxFileName legacyLib( resolvedPath );
859
860 if( !legacyLib.Exists() )
861 {
862 DisplayErrorMessage( m_parent, wxString::Format( _( "Library '%s' not found." ), relPath ) );
863 continue;
864 }
865
866 wxFileName newLib( resolvedPath );
867 newLib.SetExt( "kicad_sym" );
868
869 if( newLib.Exists() )
870 {
871 msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ), newLib.GetFullPath() );
872
873 switch( wxMessageBox( msg, _( "Migrate Library" ), wxYES_NO | wxCANCEL | wxICON_QUESTION, m_parent ) )
874 {
875 case wxYES: break;
876 case wxNO: continue;
877 case wxCANCEL: return;
878 }
879 }
880
881 wxString options = cur_grid()->GetCellValue( row, COL_OPTIONS );
882 std::map<std::string, UTF8> props( LIBRARY_TABLE::ParseOptions( options.ToStdString() ) );
883
884 if( SCH_IO_MGR::ConvertLibrary( &props, legacyLib.GetFullPath(), newLib.GetFullPath() ) )
885 {
886 relPath = NormalizePath( newLib.GetFullPath(), &Pgm().GetLocalEnvVariables(), m_project );
887
888 cur_grid()->SetCellValue( row, COL_URI, relPath );
889 cur_grid()->SetCellValue( row, COL_TYPE, kicadType );
890 cur_grid()->SetCellValue( row, COL_OPTIONS, wxEmptyString );
891 }
892 else
893 {
894 DisplayErrorMessage( m_parent, wxString::Format( _( "Failed to save symbol library file '%s'." ),
895 newLib.GetFullPath() ) );
896 }
897 }
898}
899
900
902{
903 if( !cur_grid()->CommitPendingChanges() )
904 return false;
905
906 if( !verifyTables() )
907 return false;
908
910 std::optional<LIBRARY_TABLE*> optTable = manager.Table( LIBRARY_TABLE_TYPE::SYMBOL, LIBRARY_TABLE_SCOPE::GLOBAL );
911 wxCHECK( optTable, false );
912 LIBRARY_TABLE* globalTable = *optTable;
913
914 if( get_model( 0 )->Table() != *globalTable )
915 {
916 m_parent->m_GlobalTableChanged = true;
917 *globalTable = get_model( 0 )->Table();
918
919 globalTable->Save().map_error(
920 []( const LIBRARY_ERROR& aError )
921 {
922 wxMessageBox( _( "Error saving global library table:\n\n" ) + aError.message,
923 _( "File Save Error" ), wxOK | wxICON_ERROR );
924 } );
925 }
926
928
929 if( optTable.has_value() && get_model( 1 )->Table().Path() == optTable.value()->Path() )
930 {
931 LIBRARY_TABLE* projectTable = *optTable;
932
933 if( get_model( 1 )->Table() != *projectTable )
934 {
935 m_parent->m_ProjectTableChanged = true;
936 *projectTable = get_model( 1 )->Table();
937
938 projectTable->Save().map_error(
939 []( const LIBRARY_ERROR& aError )
940 {
941 wxMessageBox( _( "Error saving project library table:\n\n" ) + aError.message,
942 _( "File Save Error" ), wxOK | wxICON_ERROR );
943 } );
944 }
945 }
946
948 return true;
949}
950
951
953{
954 wxRegEx re( ".*?(\\$\\{(.+?)\\})|(\\$\\((.+?)\\)).*?", wxRE_ADVANCED );
955 wxASSERT( re.IsValid() ); // wxRE_ADVANCED is required.
956
957 std::set< wxString > unique;
958
959 // clear the table
960 m_path_subs_grid->ClearRows();
961
962 for( int page = 0 ; page < (int) m_notebook->GetPageCount(); ++page )
963 {
965
966 for( int row = 0; row < model->GetNumberRows(); ++row )
967 {
968 wxString uri = model->GetValue( row, COL_URI );
969
970 while( re.Matches( uri ) )
971 {
972 wxString envvar = re.GetMatch( uri, 2 );
973
974 // if not ${...} form then must be $(...)
975 if( envvar.IsEmpty() )
976 envvar = re.GetMatch( uri, 4 );
977
978 // ignore duplicates
979 unique.insert( envvar );
980
981 // delete the last match and search again
982 uri.Replace( re.GetMatch( uri, 0 ), wxEmptyString );
983 }
984 }
985 }
986
987 // Make sure this special environment variable shows up even if it was
988 // not used yet. It is automatically set by KiCad to the directory holding
989 // the current project.
990 unique.insert( PROJECT_VAR_NAME );
991 unique.insert( ENV_VAR::GetVersionedEnvVarName( wxS( "SYMBOL_DIR" ) ) );
992
993 for( const wxString& evName : unique )
994 {
995 int row = m_path_subs_grid->GetNumberRows();
996 m_path_subs_grid->AppendRows( 1 );
997
998 m_path_subs_grid->SetCellValue( row, 0, wxT( "${" ) + evName + wxT( "}" ) );
999 m_path_subs_grid->SetCellEditor( row, 0, new GRID_CELL_READONLY_TEXT_EDITOR() );
1000
1001 wxString evValue;
1002 wxGetEnv( evName, &evValue );
1003 m_path_subs_grid->SetCellValue( row, 1, evValue );
1004 m_path_subs_grid->SetCellEditor( row, 1, new GRID_CELL_READONLY_TEXT_EDITOR() );
1005 }
1006
1007 adjustPathSubsGridColumns( m_path_subs_grid->GetRect().GetWidth() );
1008}
1009
1010
1012{
1013 // Account for scroll bars
1014 aWidth -= ( m_path_subs_grid->GetSize().x - m_path_subs_grid->GetClientSize().x );
1015
1016 m_path_subs_grid->AutoSizeColumn( 0 );
1017 m_path_subs_grid->SetColSize( 0, std::max( 72, m_path_subs_grid->GetColSize( 0 ) ) );
1018 m_path_subs_grid->SetColSize( 1, std::max( 120, aWidth - m_path_subs_grid->GetColSize( 0 ) ) );
1019}
1020
1021
1022void PANEL_SYM_LIB_TABLE::onSizeGrid( wxSizeEvent& event )
1023{
1024 adjustPathSubsGridColumns( event.GetSize().GetX() );
1025
1026 event.Skip();
1027}
1028
1029
1030void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent )
1031{
1032 auto symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false ) );
1033 wxString msg;
1034
1035 // Refuse to open the dialog re-entrantly while a library sync is running. A
1036 // sync can yield the event loop (via the progress dialog), which dispatches any
1037 // pending UI events — including clicks that accumulated while the app was busy.
1038 // Opening the dialog mid-sync corrupts the library tree. Reschedule instead.
1039 if( symbolEditor && symbolEditor->IsSyncLibrariesInProgress() )
1040 {
1041 symbolEditor->CallAfter( [aKiway, aParent]()
1042 {
1043 InvokeSchEditSymbolLibTable( aKiway, aParent );
1044 } );
1045 return;
1046 }
1047
1048 if( symbolEditor )
1049 {
1050 // This prevents an ugly crash on OSX (https://bugs.launchpad.net/kicad/+bug/1765286)
1051 symbolEditor->FreezeLibraryTree();
1052
1053 if( symbolEditor->HasLibModifications() )
1054 {
1055 msg = _( "Modifications have been made to one or more symbol libraries.\n"
1056 "Changes must be saved or discarded before the symbol library table can be modified." );
1057
1058 switch( UnsavedChangesDialog( aParent, msg ) )
1059 {
1060 case wxID_YES: symbolEditor->SaveAll(); break;
1061 case wxID_NO: symbolEditor->RevertAll(); break;
1062 default:
1063 case wxID_CANCEL: symbolEditor->ThawLibraryTree(); return;
1064 }
1065 }
1066 }
1067
1068 DIALOG_EDIT_LIBRARY_TABLES dlg( aParent, _( "Symbol Libraries" ) );
1069 dlg.SetKiway( &dlg, aKiway );
1070
1071 dlg.InstallPanel( new PANEL_SYM_LIB_TABLE( &dlg, &aKiway->Prj() ) );
1072
1073 if( dlg.ShowModal() == wxID_CANCEL )
1074 {
1075 if( symbolEditor )
1076 symbolEditor->ThawLibraryTree();
1077
1078 return;
1079 }
1080
1081 if( dlg.m_GlobalTableChanged )
1083
1084 if( dlg.m_ProjectTableChanged )
1085 {
1086 // Trigger a reload of the table and cancel an in-progress background load
1088 }
1089
1090 // Trigger a reload in case any libraries have been added or removed
1091 if( KIFACE *schface = aKiway->KiFACE( KIWAY::FACE_SCH ) )
1092 schface->PreloadLibraries( aKiway );
1093
1094 if( symbolEditor )
1095 symbolEditor->ThawLibraryTree();
1096}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
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:69
int ShowModal() override
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition grid_tricks.h:61
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:75
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:315
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:402
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition kiway.cpp:211
@ FACE_SCH
eeschema DSO
Definition kiway.h:322
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition kiway.cpp:205
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:192
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 deleteRowHandler(wxCommandEvent &event) override
WX_GRID * get_grid(int aPage) const
void onNotebookPageCloseRequest(wxAuiNotebookEvent &aEvent)
void onPageChange(wxAuiNotebookEvent &event) override
void browseLibrariesHandler(wxCommandEvent &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:787
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:132
static SYMBOL_LIBRARY_ADAPTER * SymbolLibAdapter(PROJECT *aProject)
Accessor for project symbol library manager adapter.
Container for project specific data.
Definition project.h:66
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:708
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:169
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition confirm.cpp:278
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:221
int UnsavedChangesDialog(wxWindow *parent, const wxString &aMessage, bool *aApplyToAll)
A specialized version of HandleUnsavedChanges which handles an apply-to-all checkbox.
Definition confirm.cpp:64
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:35
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:669
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:41
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:156
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.