From a5a93f808eea98e6964b98d15f46cbf9fe4774c2 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Tue, 5 Sep 2023 07:18:42 +0300 Subject: [PATCH] Populate symbol library type choices from SCH_IO_MGR list. --- eeschema/dialogs/panel_sym_lib_table.cpp | 15 +++++++++++---- pcbnew/dialogs/panel_fp_lib_table.cpp | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index 032a4a33fc..238332490e 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -75,6 +75,7 @@ enum { ID_PANEL_SYM_LIB_LEGACY, }; +// clang-format on /** * Build a wxGridTableBase by wrapping an #SYMBOL_LIB_TABLE object. @@ -237,10 +238,16 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P wxArrayString pluginChoices; - pluginChoices.Add( SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_KICAD ) ); - pluginChoices.Add( SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY ) ); - pluginChoices.Add( SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_DATABASE ) ); - pluginChoices.Add( SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_CADSTAR_ARCHIVE ) ); + for( const SCH_IO_MGR::SCH_FILE_T& type : SCH_IO_MGR::SCH_FILE_T_vector ) + { + SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( type ) ); + + if( !pi ) + continue; + + if( PLUGIN_FILE_DESC desc = pi->GetLibraryFileDesc() ) + pluginChoices.Add( SCH_IO_MGR::ShowType( type ) ); + } EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings(); diff --git a/pcbnew/dialogs/panel_fp_lib_table.cpp b/pcbnew/dialogs/panel_fp_lib_table.cpp index 79b822868e..eb357fbc5b 100644 --- a/pcbnew/dialogs/panel_fp_lib_table.cpp +++ b/pcbnew/dialogs/panel_fp_lib_table.cpp @@ -67,6 +67,7 @@ #include #include #include + // clang-format off /** @@ -81,6 +82,7 @@ struct SUPPORTED_FILE_TYPE IO_MGR::PCB_FILE_T m_Plugin; }; +// clang-format on /** * Traverser implementation that looks to find any and all "folder" libraries by looking for files