From c294a54c576fea15bffcbf24e936637ec942d140 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 3 Mar 2018 20:07:59 +0000 Subject: [PATCH] Fix footprint wizard setup of gEDA libraries. Fixes: lp:1753164 * https://bugs.launchpad.net/kicad/+bug/1753164 --- pcbnew/dialogs/wizard_add_fplib.cpp | 28 +--------------------------- pcbnew/io_mgr.cpp | 12 +++--------- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/pcbnew/dialogs/wizard_add_fplib.cpp b/pcbnew/dialogs/wizard_add_fplib.cpp index 39cd833d03..193253cb3a 100644 --- a/pcbnew/dialogs/wizard_add_fplib.cpp +++ b/pcbnew/dialogs/wizard_add_fplib.cpp @@ -201,33 +201,7 @@ wxString WIZARD_FPLIB_TABLE::LIBRARY::GetPluginName() const if( !m_plugin ) return _( "UNKNOWN" ); - switch( *m_plugin ) - { - case IO_MGR::LEGACY: - return wxT( "Legacy" ); - - case IO_MGR::KICAD_SEXP: - return wxT( "KiCad" ); - - case IO_MGR::EAGLE: - return wxT( "Eagle" ); - - case IO_MGR::GEDA_PCB: - return wxT( "Geda-PCB" ); - - case IO_MGR::GITHUB: - return wxT( "Github" ); - - default: - return _( "UNKNOWN" ); - } - - /*PLUGIN* p = IO_MGR::PluginFind( *m_plugin ); - - if( !p ) - return _( "UNKNOWN" ); - - return p->PluginName();*/ + return IO_MGR::ShowType( *m_plugin ); } diff --git a/pcbnew/io_mgr.cpp b/pcbnew/io_mgr.cpp index dd45b24de0..1a215a34b5 100644 --- a/pcbnew/io_mgr.cpp +++ b/pcbnew/io_mgr.cpp @@ -76,10 +76,6 @@ void IO_MGR::PluginRelease( PLUGIN* aPlugin ) const wxString IO_MGR::ShowType( PCB_FILE_T aType ) { - // keep this function in sync with EnumFromStr() relative to the - // text spellings. If you change the spellings, you will obsolete - // library tables, so don't do change, only additions are ok. - const auto& plugins = PLUGIN_REGISTRY::Instance()->AllPlugins(); for( const auto& plugin : plugins ) @@ -90,16 +86,12 @@ const wxString IO_MGR::ShowType( PCB_FILE_T aType ) } } - return wxString::Format( _( "Unknown PCB_FILE_T value: %d" ), aType ); + return wxString::Format( _( "UNKNOWN (%d)" ), aType ); } IO_MGR::PCB_FILE_T IO_MGR::EnumFromStr( const wxString& aType ) { - // keep this function in sync with ShowType() relative to the - // text spellings. If you change the spellings, you will obsolete - // library tables, so don't do change, only additions are ok. - const auto& plugins = PLUGIN_REGISTRY::Instance()->AllPlugins(); for( const auto& plugin : plugins ) @@ -205,6 +197,8 @@ void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoar THROW_IO_ERROR( wxString::Format( FMT_NOTFOUND, ShowType( aFileType ).GetData() ) ); } +// These text strings are "truth" for identifying the plugins. If you change the spellings, +// you will obsolete library tables, so don't do it. Additions are OK. static IO_MGR::REGISTER_PLUGIN registerEaglePlugin( IO_MGR::EAGLE, wxT("Eagle"), []() -> PLUGIN* { return new EAGLE_PLUGIN; } ); static IO_MGR::REGISTER_PLUGIN registerKicadPlugin( IO_MGR::KICAD_SEXP, wxT("KiCad"), []() -> PLUGIN* { return new PCB_IO; } ); static IO_MGR::REGISTER_PLUGIN registerPcadPlugin( IO_MGR::PCAD, wxT("P-Cad"), []() -> PLUGIN* { return new PCAD_PLUGIN; } );