From ee6bda1699e2a2e9137073b039f149f237907e5a Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 25 Jan 2025 15:04:19 -0500 Subject: [PATCH] Move and rename legacy library code --- eeschema/CMakeLists.txt | 4 +- eeschema/annotate.cpp | 1 - eeschema/dialogs/dialog_field_properties.cpp | 1 - eeschema/dialogs/dialog_rescue_each.cpp | 2 +- eeschema/dialogs/dialog_symbol_chooser.cpp | 1 - .../dialogs/dialog_symbol_fields_table.cpp | 1 - eeschema/dialogs/dialog_symbol_properties.cpp | 1 - eeschema/dialogs/dialog_symbol_remap.cpp | 16 +- eeschema/dialogs/dialog_symbol_remap.h | 4 +- eeschema/eeschema_config.cpp | 1 - eeschema/fields_grid_table.cpp | 1 - eeschema/files-io.cpp | 10 +- eeschema/lib_fields_data_model.cpp | 3 +- eeschema/lib_symbol.cpp | 8 +- eeschema/lib_symbol.h | 12 +- eeschema/libarch.cpp | 141 ------------------ .../legacy_symbol_library.cpp} | 98 ++++++------ .../legacy_symbol_library.h} | 34 ++--- .../netlist_exporter_allegro.cpp | 2 - .../netlist_exporter_base.cpp | 1 - .../netlist_exporter_orcadpcb2.cpp | 2 - .../netlist_exporter_xml.cpp | 1 - eeschema/picksymbol.cpp | 1 - eeschema/project_rescue.cpp | 39 ++--- eeschema/project_rescue.h | 3 +- eeschema/project_sch.cpp | 10 +- eeschema/project_sch.h | 9 +- eeschema/sch_base_frame.cpp | 10 +- eeschema/sch_base_frame.h | 4 +- eeschema/sch_edit_frame.cpp | 1 - eeschema/sch_field.cpp | 1 - eeschema/sch_io/eagle/sch_io_eagle.h | 2 +- .../kicad_legacy/sch_io_kicad_legacy.cpp | 2 +- .../sch_io/kicad_legacy/sch_io_kicad_legacy.h | 2 +- .../sch_io/kicad_sexpr/sch_io_kicad_sexpr.h | 2 +- .../kicad_sexpr/sch_io_kicad_sexpr_parser.h | 3 +- eeschema/sch_io/sch_io_mgr.h | 2 +- eeschema/sch_screen.cpp | 6 +- eeschema/sch_sheet_path.cpp | 1 - eeschema/sch_symbol.h | 4 +- eeschema/symbol_editor/symbol_edit_frame.cpp | 1 - eeschema/symbol_editor/symbol_editor.cpp | 1 - .../symbol_editor_import_export.cpp | 1 - eeschema/symbol_library_manager.cpp | 1 - eeschema/symbol_library_manager.h | 2 +- eeschema/toolbars_symbol_viewer.cpp | 1 - eeschema/tools/sch_drawing_tools.cpp | 4 +- eeschema/tools/sch_editor_control.cpp | 1 - eeschema/widgets/panel_symbol_chooser.cpp | 2 +- include/project.h | 2 +- qa/schematic_utils/schematic_file_util.cpp | 1 + 51 files changed, 152 insertions(+), 312 deletions(-) delete mode 100644 eeschema/libarch.cpp rename eeschema/{symbol_library.cpp => libraries/legacy_symbol_library.cpp} (81%) rename eeschema/{symbol_library.h => libraries/legacy_symbol_library.h} (92%) diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index a4b98fb42b..6b9671d817 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -369,7 +369,6 @@ set( EESCHEMA_SRCS junction_helpers.cpp lib_fields_data_model.cpp lib_symbol.cpp - libarch.cpp menubar.cpp net_navigator.cpp picksymbol.cpp @@ -423,7 +422,7 @@ set( EESCHEMA_SRCS symbol_checker.cpp symbol_chooser_frame.cpp symbol_lib_table.cpp - symbol_library.cpp + symbol_library_manager.cpp symbol_tree_model_adapter.cpp symbol_tree_synchronizing_adapter.cpp @@ -434,6 +433,7 @@ set( EESCHEMA_SRCS api/api_sch_utils.cpp + libraries/legacy_symbol_library.cpp libraries/symbol_library_manager_adapter.cpp netlist_exporters/netlist_exporter_allegro.cpp diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index a720a66989..55a9c09c07 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/dialogs/dialog_field_properties.cpp b/eeschema/dialogs/dialog_field_properties.cpp index 27e28148b3..1a883d84cc 100644 --- a/eeschema/dialogs/dialog_field_properties.cpp +++ b/eeschema/dialogs/dialog_field_properties.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/dialogs/dialog_rescue_each.cpp b/eeschema/dialogs/dialog_rescue_each.cpp index 812d6c8592..d24ab54214 100644 --- a/eeschema/dialogs/dialog_rescue_each.cpp +++ b/eeschema/dialogs/dialog_rescue_each.cpp @@ -22,7 +22,7 @@ */ #include -#include +#include #include #include #include diff --git a/eeschema/dialogs/dialog_symbol_chooser.cpp b/eeschema/dialogs/dialog_symbol_chooser.cpp index d27d5b2017..0f049d62b9 100644 --- a/eeschema/dialogs/dialog_symbol_chooser.cpp +++ b/eeschema/dialogs/dialog_symbol_chooser.cpp @@ -21,7 +21,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include #include #include #include diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index 4277d49bee..8e795c3620 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp index ac45117157..104cc4e42b 100644 --- a/eeschema/dialogs/dialog_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_symbol_properties.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/dialogs/dialog_symbol_remap.cpp b/eeschema/dialogs/dialog_symbol_remap.cpp index a256412084..db06e5a33a 100644 --- a/eeschema/dialogs/dialog_symbol_remap.cpp +++ b/eeschema/dialogs/dialog_symbol_remap.cpp @@ -32,7 +32,7 @@ #include #include "widgets/wx_html_report_panel.h" -#include +#include #include #include #include @@ -138,20 +138,20 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent ) wxString paths; wxArrayString libNames; - SYMBOL_LIBS::SetLibNamesAndPaths( &Prj(), paths, libNames ); + LEGACY_SYMBOL_LIBS::SetLibNamesAndPaths( &Prj(), paths, libNames ); // Reload the cache symbol library. Prj().SetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS, nullptr ); - PROJECT_SCH::SchLibs( &Prj() ); + PROJECT_SCH::LegacySchLibs( &Prj() ); Raise(); m_remapped = true; } -size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< SYMBOL_LIB* >& aLibs ) +size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< LEGACY_SYMBOL_LIB* >& aLibs ) { - for( SYMBOL_LIB& lib : *PROJECT_SCH::SchLibs( &Prj() ) ) + for( LEGACY_SYMBOL_LIB& lib : *PROJECT_SCH::LegacySchLibs( &Prj() ) ) { // Ignore the cache library. if( lib.IsCache() ) @@ -170,7 +170,7 @@ size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< SYMBO void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter ) { - std::vector libs; + std::vector libs; if( getLibsNotInGlobalSymbolLibTable( libs ) ) { @@ -178,7 +178,7 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter ) SYMBOL_LIB_TABLE libTable; std::vector libNames = SYMBOL_LIB_TABLE::GetGlobalLibTable().GetLogicalLibs(); - for( SYMBOL_LIB* lib : libs ) + for( LEGACY_SYMBOL_LIB* lib : libs ) { wxString libName = lib->GetName(); int libNameInc = 1; @@ -297,7 +297,7 @@ bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_SYMBOL* aSymbol ) wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false, "The symbol LIB_ID name is empty." ); - for( SYMBOL_LIB& lib : *PROJECT_SCH::SchLibs( &Prj() ) ) + for( LEGACY_SYMBOL_LIB& lib : *PROJECT_SCH::LegacySchLibs( &Prj() ) ) { // Ignore the cache library. if( lib.IsCache() ) diff --git a/eeschema/dialogs/dialog_symbol_remap.h b/eeschema/dialogs/dialog_symbol_remap.h index 96dc9c49ea..24d75a06b2 100644 --- a/eeschema/dialogs/dialog_symbol_remap.h +++ b/eeschema/dialogs/dialog_symbol_remap.h @@ -29,7 +29,7 @@ #define _DIALOG_SYMBOL_REMAP_H_ -class SYMBOL_LIB; +class LEGACY_SYMBOL_LIB; class SCH_SYMBOL; class REPORTER; @@ -59,7 +59,7 @@ private: * list. * @return the number of libraries found. */ - size_t getLibsNotInGlobalSymbolLibTable( std::vector< SYMBOL_LIB* >& aLibs ); + size_t getLibsNotInGlobalSymbolLibTable( std::vector< LEGACY_SYMBOL_LIB* >& aLibs ); void createProjectSymbolLibTable( REPORTER& aReporter ); diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 74b7c19280..c5fe96cfe6 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include #include diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp index 8a28e9792e..d93386643c 100644 --- a/eeschema/fields_grid_table.cpp +++ b/eeschema/fields_grid_table.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 8dc1e02eda..d1f5a90c0d 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -24,7 +24,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include #include #include #include @@ -35,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -203,7 +203,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in // And when a schematic file is loaded, we need these libs to initialize // some parameters (links to PART LIB, dangling ends ...) Prj().SetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS, nullptr ); - PROJECT_SCH::SchLibs( &Prj() ); + PROJECT_SCH::LegacySchLibs( &Prj() ); } } else @@ -482,7 +482,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in wxString paths; wxArrayString libNames; - SYMBOL_LIBS::GetLibNamesAndPaths( &Prj(), &paths, &libNames ); + LEGACY_SYMBOL_LIBS::GetLibNamesAndPaths( &Prj(), &paths, &libNames ); if( !libNames.IsEmpty() ) { @@ -506,7 +506,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in libNames.Clear(); paths.Clear(); - SYMBOL_LIBS::SetLibNamesAndPaths( &Prj(), paths, libNames ); + LEGACY_SYMBOL_LIBS::SetLibNamesAndPaths( &Prj(), paths, libNames ); } if( !cfg || !cfg->m_RescueNeverShow ) @@ -517,7 +517,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in } // Ensure there is only one legacy library loaded and that it is the cache library. - SYMBOL_LIBS* legacyLibs = PROJECT_SCH::SchLibs( &Schematic().Project() ); + LEGACY_SYMBOL_LIBS* legacyLibs = PROJECT_SCH::LegacySchLibs( &Schematic().Project() ); if( legacyLibs->GetLibraryCount() == 0 ) { diff --git a/eeschema/lib_fields_data_model.cpp b/eeschema/lib_fields_data_model.cpp index 59e66d87bb..5a7dbdc787 100644 --- a/eeschema/lib_fields_data_model.cpp +++ b/eeschema/lib_fields_data_model.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include "string_utils.h" #include @@ -1188,4 +1187,4 @@ bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::isStripeableField( int aCol ) // Don't apply stripes to checkbox fields return !ColIsCheck( aCol ); -} \ No newline at end of file +} diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 281fbe3862..e3567ea7c8 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -30,12 +30,14 @@ #include #include #include -#include #include #include #include #include +// TODO(JE) remove m_library; shouldn't be needed with legacy remapping +#include + #include #include #include @@ -93,7 +95,7 @@ struct null_deleter }; -LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, SYMBOL_LIB* aLibrary ) : +LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, LEGACY_SYMBOL_LIB* aLibrary ) : SYMBOL( LIB_SYMBOL_T ), m_me( this, null_deleter() ) { @@ -129,7 +131,7 @@ LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, SYMBOL_LIB* } -LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary ) : +LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, LEGACY_SYMBOL_LIB* aLibrary ) : SYMBOL( aSymbol ), EMBEDDED_FILES( aSymbol ), m_me( this, null_deleter() ) diff --git a/eeschema/lib_symbol.h b/eeschema/lib_symbol.h index 7dce7da1e2..f68b775d79 100644 --- a/eeschema/lib_symbol.h +++ b/eeschema/lib_symbol.h @@ -40,7 +40,7 @@ class LINE_READER; class OUTPUTFORMATTER; class REPORTER; -class SYMBOL_LIB; +class LEGACY_SYMBOL_LIB; class LIB_SYMBOL; class OUTLINE_FONT; class TEST_LIB_SYMBOL_FIXTURE; @@ -87,9 +87,9 @@ class LIB_SYMBOL : public SYMBOL, public LIB_TREE_ITEM, public EMBEDDED_FILES { public: LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent = nullptr, - SYMBOL_LIB* aLibrary = nullptr ); + LEGACY_SYMBOL_LIB* aLibrary = nullptr ); - LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary = nullptr ); + LIB_SYMBOL( const LIB_SYMBOL& aSymbol, LEGACY_SYMBOL_LIB* aLibrary = nullptr ); virtual ~LIB_SYMBOL() = default; @@ -209,8 +209,8 @@ public: const wxString GetLibraryName() const; - SYMBOL_LIB* GetLib() const { return m_library; } - void SetLib( SYMBOL_LIB* aLibrary ) { m_library = aLibrary; } + LEGACY_SYMBOL_LIB* GetLib() const { return m_library; } + void SetLib( LEGACY_SYMBOL_LIB* aLibrary ) { m_library = aLibrary; } timestamp_t GetLastModDate() const { return m_lastModDate; } @@ -865,7 +865,7 @@ private: LIB_ITEMS_CONTAINER m_drawings; - SYMBOL_LIB* m_library; + LEGACY_SYMBOL_LIB* m_library; wxString m_name; wxString m_keyWords; ///< Search keywords wxArrayString m_fpFilters; ///< List of suitable footprint names for the symbol (wild card diff --git a/eeschema/libarch.cpp b/eeschema/libarch.cpp deleted file mode 100644 index 080d3071fc..0000000000 --- a/eeschema/libarch.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2004 Jean-Pierre Charras, jp.charras ar wanadoo.fr - * Copyright (C) 2008 Wayne Stambaugh - * Copyright The KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -/** - * @file libarch.cpp - * @brief Module for generation of symbol archive files. - */ - -#include -#include - -#include -#include -#include -#include -#include - - -bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName ) -{ - wxString tmp; - wxString errorMsg; - SCH_SCREENS screens( Schematic().Root() ); - - // Create a new empty library to archive symbols: - std::unique_ptr archLib = std::make_unique( SCH_LIB_TYPE::LT_EESCHEMA, - aFileName ); - - // Save symbols to file only when the library will be fully filled - archLib->EnableBuffering(); - - /* Examine all screens (not hierarchical sheets) used in the schematic and build a - * library of unique symbols found in all screens. Complex hierarchies are not a - * problem because we just want to know the library symbols used in the schematic - * not their reference. - */ - for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() ) - { - - for( SCH_ITEM* aItem : screen->Items().OfType( SCH_SYMBOL_T ) ) - { - LIB_SYMBOL* libSymbol = nullptr; - SCH_SYMBOL* symbol = static_cast( aItem ); - - try - { - if( archLib->FindSymbol( symbol->GetLibId() ) ) - continue; - - libSymbol = GetLibSymbol( symbol->GetLibId(), true ); - } - catch( const IO_ERROR& ) - { - // Queue up error messages for later. - tmp.Printf( _( "Failed to add symbol %s to library file '%s'." ), - symbol->GetLibId().GetUniStringLibItemName(), - aFileName ); - - // Don't bail out here. Attempt to add as many of the symbols to the library - // as possible. - } - catch( ... ) - { - tmp = _( "Unexpected exception occurred." ); - } - - if( libSymbol ) - { - std::unique_ptr flattenedSymbol = libSymbol->Flatten(); - - // Use the full LIB_ID as the symbol name to prevent symbol name collisions. - flattenedSymbol->SetName( symbol->GetLibId().GetUniStringLibId() ); - - // AddSymbol() does first clone the symbol before adding. - archLib->AddSymbol( flattenedSymbol.get() ); - } - else - { - tmp.Printf( _( "Symbol %s not found in any library or cache." ), - symbol->GetLibId().GetUniStringLibId() ); - } - - if( !tmp.empty() && !errorMsg.Contains( symbol->GetLibId().GetUniStringLibId() ) ) - { - if( errorMsg.empty() ) - errorMsg += tmp; - else - errorMsg += wxS( "\n" ) + tmp; - } - } - } - - if( !errorMsg.empty() ) - { - tmp.Printf( _( "Errors occurred creating symbol library %s." ), aFileName ); - DisplayErrorMessage( this, tmp, errorMsg ); - } - - archLib->EnableBuffering( false ); - - try - { - archLib->Save( false ); - } - catch( const IO_ERROR& ioe ) - { - errorMsg.Printf( _( "Failed to save symbol library file '%s'." ), aFileName ); - DisplayErrorMessage( this, errorMsg, ioe.What() ); - return false; - } - catch( std::exception& error ) - { - errorMsg.Printf( _( "Failed to save symbol library file '%s'." ), aFileName ); - DisplayErrorMessage( this, errorMsg, error.what() ); - return false; - } - - return true; -} diff --git a/eeschema/symbol_library.cpp b/eeschema/libraries/legacy_symbol_library.cpp similarity index 81% rename from eeschema/symbol_library.cpp rename to eeschema/libraries/legacy_symbol_library.cpp index 9b58dfb562..5f54efdc7a 100644 --- a/eeschema/symbol_library.cpp +++ b/eeschema/libraries/legacy_symbol_library.cpp @@ -36,15 +36,15 @@ #include #include -#include +#include #include #include #include #include -#include "sim/sim_model.h" +#include -SYMBOL_LIB::SYMBOL_LIB( SCH_LIB_TYPE aType, const wxString& aFileName, +LEGACY_SYMBOL_LIB::LEGACY_SYMBOL_LIB( SCH_LIB_TYPE aType, const wxString& aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType ) : m_pluginType( aPluginType ) { @@ -66,12 +66,12 @@ SYMBOL_LIB::SYMBOL_LIB( SCH_LIB_TYPE aType, const wxString& aFileName, } -SYMBOL_LIB::~SYMBOL_LIB() +LEGACY_SYMBOL_LIB::~LEGACY_SYMBOL_LIB() { } -void SYMBOL_LIB::Save( bool aSaveDocFile ) +void LEGACY_SYMBOL_LIB::Save( bool aSaveDocFile ) { wxCHECK_RET( m_plugin != nullptr, wxString::Format( wxT( "no plugin defined for library `%s`." ), @@ -87,7 +87,7 @@ void SYMBOL_LIB::Save( bool aSaveDocFile ) } -void SYMBOL_LIB::Create( const wxString& aFileName ) +void LEGACY_SYMBOL_LIB::Create( const wxString& aFileName ) { wxString tmpFileName = fileName.GetFullPath(); @@ -98,7 +98,7 @@ void SYMBOL_LIB::Create( const wxString& aFileName ) } -void SYMBOL_LIB::SetPluginType( SCH_IO_MGR::SCH_FILE_T aPluginType ) +void LEGACY_SYMBOL_LIB::SetPluginType( SCH_IO_MGR::SCH_FILE_T aPluginType ) { if( m_pluginType != aPluginType ) { @@ -108,25 +108,25 @@ void SYMBOL_LIB::SetPluginType( SCH_IO_MGR::SCH_FILE_T aPluginType ) } -bool SYMBOL_LIB::IsCache() const +bool LEGACY_SYMBOL_LIB::IsCache() const { return m_properties->contains( SCH_IO_KICAD_LEGACY::PropNoDocFile ); } -void SYMBOL_LIB::SetCache() +void LEGACY_SYMBOL_LIB::SetCache() { (*m_properties)[ SCH_IO_KICAD_LEGACY::PropNoDocFile ] = ""; } -bool SYMBOL_LIB::IsBuffering() const +bool LEGACY_SYMBOL_LIB::IsBuffering() const { return m_properties->contains( SCH_IO_KICAD_LEGACY::PropBuffering ); } -void SYMBOL_LIB::EnableBuffering( bool aEnable ) +void LEGACY_SYMBOL_LIB::EnableBuffering( bool aEnable ) { if( aEnable ) (*m_properties)[ SCH_IO_KICAD_LEGACY::PropBuffering ] = ""; @@ -135,7 +135,7 @@ void SYMBOL_LIB::EnableBuffering( bool aEnable ) } -void SYMBOL_LIB::GetSymbolNames( wxArrayString& aNames ) const +void LEGACY_SYMBOL_LIB::GetSymbolNames( wxArrayString& aNames ) const { m_plugin->EnumerateSymbolLib( aNames, fileName.GetFullPath(), m_properties.get() ); @@ -143,7 +143,7 @@ void SYMBOL_LIB::GetSymbolNames( wxArrayString& aNames ) const } -void SYMBOL_LIB::GetSymbols( std::vector& aSymbols ) const +void LEGACY_SYMBOL_LIB::GetSymbols( std::vector& aSymbols ) const { m_plugin->EnumerateSymbolLib( aSymbols, fileName.GetFullPath(), m_properties.get() ); @@ -155,7 +155,7 @@ void SYMBOL_LIB::GetSymbols( std::vector& aSymbols ) const } -LIB_SYMBOL* SYMBOL_LIB::FindSymbol( const wxString& aName ) const +LIB_SYMBOL* LEGACY_SYMBOL_LIB::FindSymbol( const wxString& aName ) const { LIB_SYMBOL* symbol = m_plugin->LoadSymbol( fileName.GetFullPath(), aName, m_properties.get() ); @@ -165,7 +165,7 @@ LIB_SYMBOL* SYMBOL_LIB::FindSymbol( const wxString& aName ) const // symbols. This allows the symbol library table conversion tool to determine the // correct library where the symbol was found. if( !symbol->GetLib() ) - symbol->SetLib( const_cast( this ) ); + symbol->SetLib( const_cast( this ) ); SIM_MODEL::MigrateSimModel( *symbol, nullptr ); } @@ -174,13 +174,13 @@ LIB_SYMBOL* SYMBOL_LIB::FindSymbol( const wxString& aName ) const } -LIB_SYMBOL* SYMBOL_LIB::FindSymbol( const LIB_ID& aLibId ) const +LIB_SYMBOL* LEGACY_SYMBOL_LIB::FindSymbol( const LIB_ID& aLibId ) const { return FindSymbol( aLibId.Format().wx_str() ); } -void SYMBOL_LIB::AddSymbol( LIB_SYMBOL* aSymbol ) +void LEGACY_SYMBOL_LIB::AddSymbol( LIB_SYMBOL* aSymbol ) { // add a clone, not the caller's copy, the plugin take ownership of the new symbol. m_plugin->SaveSymbol( fileName.GetFullPath(), @@ -196,7 +196,7 @@ void SYMBOL_LIB::AddSymbol( LIB_SYMBOL* aSymbol ) } -LIB_SYMBOL* SYMBOL_LIB::RemoveSymbol( LIB_SYMBOL* aEntry ) +LIB_SYMBOL* LEGACY_SYMBOL_LIB::RemoveSymbol( LIB_SYMBOL* aEntry ) { wxCHECK_MSG( aEntry != nullptr, nullptr, "NULL pointer cannot be removed from library." ); @@ -212,7 +212,7 @@ LIB_SYMBOL* SYMBOL_LIB::RemoveSymbol( LIB_SYMBOL* aEntry ) } -LIB_SYMBOL* SYMBOL_LIB::ReplaceSymbol( LIB_SYMBOL* aOldSymbol, LIB_SYMBOL* aNewSymbol ) +LIB_SYMBOL* LEGACY_SYMBOL_LIB::ReplaceSymbol( LIB_SYMBOL* aOldSymbol, LIB_SYMBOL* aNewSymbol ) { wxASSERT( aOldSymbol != nullptr ); wxASSERT( aNewSymbol != nullptr ); @@ -233,9 +233,9 @@ LIB_SYMBOL* SYMBOL_LIB::ReplaceSymbol( LIB_SYMBOL* aOldSymbol, LIB_SYMBOL* aNewS } -SYMBOL_LIB* SYMBOL_LIB::LoadSymbolLibrary( const wxString& aFileName ) +LEGACY_SYMBOL_LIB* LEGACY_SYMBOL_LIB::LoadSymbolLibrary( const wxString& aFileName ) { - std::unique_ptr lib = std::make_unique( SCH_LIB_TYPE::LT_EESCHEMA, + std::unique_ptr lib = std::make_unique( SCH_LIB_TYPE::LT_EESCHEMA, aFileName ); std::vector parts; @@ -252,14 +252,14 @@ SYMBOL_LIB* SYMBOL_LIB::LoadSymbolLibrary( const wxString& aFileName ) part->SetLib( lib.get() ); } - SYMBOL_LIB* ret = lib.release(); + LEGACY_SYMBOL_LIB* ret = lib.release(); return ret; } -SYMBOL_LIB* SYMBOL_LIBS::AddLibrary( const wxString& aFileName ) +LEGACY_SYMBOL_LIB* LEGACY_SYMBOL_LIBS::AddLibrary( const wxString& aFileName ) { - SYMBOL_LIB* lib; + LEGACY_SYMBOL_LIB* lib; wxFileName fn = aFileName; // Don't reload the library if it is already loaded. @@ -270,7 +270,7 @@ SYMBOL_LIB* SYMBOL_LIBS::AddLibrary( const wxString& aFileName ) try { - lib = SYMBOL_LIB::LoadSymbolLibrary( aFileName ); + lib = LEGACY_SYMBOL_LIB::LoadSymbolLibrary( aFileName ); push_back( lib ); return lib; @@ -282,18 +282,18 @@ SYMBOL_LIB* SYMBOL_LIBS::AddLibrary( const wxString& aFileName ) } -SYMBOL_LIB* SYMBOL_LIBS::AddLibrary( const wxString& aFileName, SYMBOL_LIBS::iterator& aIterator ) +LEGACY_SYMBOL_LIB* LEGACY_SYMBOL_LIBS::AddLibrary( const wxString& aFileName, LEGACY_SYMBOL_LIBS::iterator& aIterator ) { // Don't reload the library if it is already loaded. wxFileName fn( aFileName ); - SYMBOL_LIB* lib = FindLibrary( fn.GetName() ); + LEGACY_SYMBOL_LIB* lib = FindLibrary( fn.GetName() ); if( lib ) return lib; try { - lib = SYMBOL_LIB::LoadSymbolLibrary( aFileName ); + lib = LEGACY_SYMBOL_LIB::LoadSymbolLibrary( aFileName ); if( aIterator >= begin() && aIterator < end() ) insert( aIterator, lib ); @@ -309,17 +309,17 @@ SYMBOL_LIB* SYMBOL_LIBS::AddLibrary( const wxString& aFileName, SYMBOL_LIBS::ite } -bool SYMBOL_LIBS::ReloadLibrary( const wxString &aFileName ) +bool LEGACY_SYMBOL_LIBS::ReloadLibrary( const wxString &aFileName ) { wxFileName fn = aFileName; - SYMBOL_LIB* lib = FindLibrary( fn.GetName() ); + LEGACY_SYMBOL_LIB* lib = FindLibrary( fn.GetName() ); // Check if the library already exists. if( !lib ) return false; // Create a clone of the library pointer in case we need to re-add it - SYMBOL_LIB *cloneLib = lib; + LEGACY_SYMBOL_LIB *cloneLib = lib; // Try to find the iterator of the library for( auto it = begin(); it != end(); ++it ) @@ -336,7 +336,7 @@ bool SYMBOL_LIBS::ReloadLibrary( const wxString &aFileName ) // Try to reload the library try { - lib = SYMBOL_LIB::LoadSymbolLibrary( aFileName ); + lib = LEGACY_SYMBOL_LIB::LoadSymbolLibrary( aFileName ); // If the library is successfully reloaded, add it back to the set. push_back( lib ); @@ -352,9 +352,9 @@ bool SYMBOL_LIBS::ReloadLibrary( const wxString &aFileName ) } -SYMBOL_LIB* SYMBOL_LIBS::FindLibrary( const wxString& aName ) +LEGACY_SYMBOL_LIB* LEGACY_SYMBOL_LIBS::FindLibrary( const wxString& aName ) { - for( SYMBOL_LIBS::iterator it = begin(); it!=end(); ++it ) + for( LEGACY_SYMBOL_LIBS::iterator it = begin(); it!=end(); ++it ) { if( it->GetName() == aName ) return &*it; @@ -364,9 +364,9 @@ SYMBOL_LIB* SYMBOL_LIBS::FindLibrary( const wxString& aName ) } -SYMBOL_LIB* SYMBOL_LIBS::GetCacheLibrary() +LEGACY_SYMBOL_LIB* LEGACY_SYMBOL_LIBS::GetCacheLibrary() { - for( SYMBOL_LIBS::iterator it = begin(); it!=end(); ++it ) + for( LEGACY_SYMBOL_LIBS::iterator it = begin(); it!=end(); ++it ) { if( it->IsCache() ) return &*it; @@ -376,9 +376,9 @@ SYMBOL_LIB* SYMBOL_LIBS::GetCacheLibrary() } -SYMBOL_LIB* SYMBOL_LIBS::FindLibraryByFullFileName( const wxString& aFullFileName ) +LEGACY_SYMBOL_LIB* LEGACY_SYMBOL_LIBS::FindLibraryByFullFileName( const wxString& aFullFileName ) { - for( SYMBOL_LIBS::iterator it = begin(); it!=end(); ++it ) + for( LEGACY_SYMBOL_LIBS::iterator it = begin(); it!=end(); ++it ) { if( it->GetFullFileName() == aFullFileName ) return &*it; @@ -388,12 +388,12 @@ SYMBOL_LIB* SYMBOL_LIBS::FindLibraryByFullFileName( const wxString& aFullFileNam } -wxArrayString SYMBOL_LIBS::GetLibraryNames( bool aSorted ) +wxArrayString LEGACY_SYMBOL_LIBS::GetLibraryNames( bool aSorted ) { wxArrayString cacheNames; wxArrayString names; - for( SYMBOL_LIB& lib : *this ) + for( LEGACY_SYMBOL_LIB& lib : *this ) { if( lib.IsCache() && aSorted ) cacheNames.Add( lib.GetName() ); @@ -412,11 +412,11 @@ wxArrayString SYMBOL_LIBS::GetLibraryNames( bool aSorted ) } -LIB_SYMBOL* SYMBOL_LIBS::FindLibSymbol( const LIB_ID& aLibId, const wxString& aLibraryName ) +LIB_SYMBOL* LEGACY_SYMBOL_LIBS::FindLibSymbol( const LIB_ID& aLibId, const wxString& aLibraryName ) { LIB_SYMBOL* part = nullptr; - for( SYMBOL_LIB& lib : *this ) + for( LEGACY_SYMBOL_LIB& lib : *this ) { if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName ) continue; @@ -431,11 +431,11 @@ LIB_SYMBOL* SYMBOL_LIBS::FindLibSymbol( const LIB_ID& aLibId, const wxString& aL } -void SYMBOL_LIBS::FindLibraryNearEntries( std::vector& aCandidates, +void LEGACY_SYMBOL_LIBS::FindLibraryNearEntries( std::vector& aCandidates, const wxString& aEntryName, const wxString& aLibraryName ) { - for( SYMBOL_LIB& lib : *this ) + for( LEGACY_SYMBOL_LIB& lib : *this ) { if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName ) continue; @@ -456,7 +456,7 @@ void SYMBOL_LIBS::FindLibraryNearEntries( std::vector& aCandidates, } -void SYMBOL_LIBS::GetLibNamesAndPaths( PROJECT* aProject, wxString* aPaths, wxArrayString* aNames ) +void LEGACY_SYMBOL_LIBS::GetLibNamesAndPaths( PROJECT* aProject, wxString* aPaths, wxArrayString* aNames ) { wxCHECK_RET( aProject, "Null PROJECT in GetLibNamesAndPaths" ); @@ -470,7 +470,7 @@ void SYMBOL_LIBS::GetLibNamesAndPaths( PROJECT* aProject, wxString* aPaths, wxAr } -void SYMBOL_LIBS::SetLibNamesAndPaths( PROJECT* aProject, const wxString& aPaths, +void LEGACY_SYMBOL_LIBS::SetLibNamesAndPaths( PROJECT* aProject, const wxString& aPaths, const wxArrayString& aNames ) { wxCHECK_RET( aProject, "Null PROJECT in SetLibNamesAndPaths" ); @@ -482,7 +482,7 @@ void SYMBOL_LIBS::SetLibNamesAndPaths( PROJECT* aProject, const wxString& aPaths } -const wxString SYMBOL_LIBS::CacheName( const wxString& aFullProjectFilename ) +const wxString LEGACY_SYMBOL_LIBS::CacheName( const wxString& aFullProjectFilename ) { wxFileName filename( aFullProjectFilename ); wxString name = filename.GetName(); @@ -503,7 +503,7 @@ const wxString SYMBOL_LIBS::CacheName( const wxString& aFullProjectFilename ) } -void SYMBOL_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress ) +void LEGACY_SYMBOL_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress ) { wxString filename; wxString libs_not_found; @@ -589,7 +589,7 @@ void SYMBOL_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress ) // add the special cache library. wxString cache_name = CacheName( aProject->GetProjectFullName() ); - SYMBOL_LIB* cache_lib; + LEGACY_SYMBOL_LIB* cache_lib; if( !aProject->IsNullProject() && !cache_name.IsEmpty() ) { diff --git a/eeschema/symbol_library.h b/eeschema/libraries/legacy_symbol_library.h similarity index 92% rename from eeschema/symbol_library.h rename to eeschema/libraries/legacy_symbol_library.h index a33c6f64a4..3937ea5545 100644 --- a/eeschema/symbol_library.h +++ b/eeschema/libraries/legacy_symbol_library.h @@ -45,11 +45,7 @@ class LIB_ID; class LINE_READER; class OUTPUTFORMATTER; class SCH_IO; -class SYMBOL_LIB; - - -/* Helpers for creating a list of symbol libraries. */ -typedef boost::ptr_vector< SYMBOL_LIB > SYMBOL_LIBS_BASE; +class LEGACY_SYMBOL_LIB; /** @@ -58,12 +54,12 @@ typedef boost::ptr_vector< SYMBOL_LIB > SYMBOL_LIBS_BASE; * It extends from PROJECT::_ELEM so it can be hung in the PROJECT. It does not use any * UI calls, but rather simply throws an IO_ERROR when there is a problem. */ -class SYMBOL_LIBS : public SYMBOL_LIBS_BASE, public PROJECT::_ELEM +class LEGACY_SYMBOL_LIBS : public boost::ptr_vector, public PROJECT::_ELEM { public: PROJECT::ELEM ProjectElementType() override { return PROJECT::ELEM::SCH_SYMBOL_LIBS; } - SYMBOL_LIBS() {} + LEGACY_SYMBOL_LIBS() {} /** * Allocate and adds a symbol library to the library list. @@ -71,7 +67,7 @@ public: * @param aFileName is the file name object of symbol library. * @throw IO_ERROR if there's any problem loading. */ - SYMBOL_LIB* AddLibrary( const wxString& aFileName ); + LEGACY_SYMBOL_LIB* AddLibrary( const wxString& aFileName ); /** * Insert a symbol library into the library list. @@ -81,7 +77,7 @@ public: * @return the new SYMBOL_LIB, which remains owned by this SYMBOL_LIBS container. * @throw IO_ERROR if there's any problem loading. */ - SYMBOL_LIB* AddLibrary( const wxString& aFileName, SYMBOL_LIBS::iterator& aIterator ); + LEGACY_SYMBOL_LIB* AddLibrary( const wxString& aFileName, LEGACY_SYMBOL_LIBS::iterator& aIterator ); /** * Refreshes the library from the (possibly updated) contents on disk @@ -120,11 +116,11 @@ public: * @param aName is the library file name without path or extension to find. * @return the symbol library if found, otherwise NULL. */ - SYMBOL_LIB* FindLibrary( const wxString& aName ); + LEGACY_SYMBOL_LIB* FindLibrary( const wxString& aName ); - SYMBOL_LIB* FindLibraryByFullFileName( const wxString& aFullFileName ); + LEGACY_SYMBOL_LIB* FindLibraryByFullFileName( const wxString& aFullFileName ); - SYMBOL_LIB* GetCacheLibrary(); + LEGACY_SYMBOL_LIB* GetCacheLibrary(); /** * Return the list of symbol library file names without path and extension. @@ -172,12 +168,12 @@ public: * @warning This code is obsolete with the exception of the cache library. All other * symbol library I/O is managed by the #SCH_IO_MGR object. */ -class SYMBOL_LIB +class LEGACY_SYMBOL_LIB { public: - SYMBOL_LIB( SCH_LIB_TYPE aType, const wxString& aFileName, - SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY ); - ~SYMBOL_LIB(); + LEGACY_SYMBOL_LIB( SCH_LIB_TYPE aType, const wxString& aFileName, + SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY ); + ~LEGACY_SYMBOL_LIB(); /** * @return a magic number that changes if the library has changed @@ -309,7 +305,7 @@ public: * @return SYMBOL_LIB* is the allocated and loaded SYMBOL_LIB, which is owned by the caller. * @throw IO_ERROR if there's any problem loading the library. */ - static SYMBOL_LIB* LoadSymbolLibrary( const wxString& aFileName ); + static LEGACY_SYMBOL_LIB* LoadSymbolLibrary( const wxString& aFileName ); private: SCH_LIB_TYPE type; ///< Library type indicator. @@ -330,7 +326,7 @@ private: /** * Case insensitive library name comparison. */ -bool operator==( const SYMBOL_LIB& aLibrary, const wxString& aName ); -bool operator!=( const SYMBOL_LIB& aLibrary, const wxString& aName ); +bool operator==( const LEGACY_SYMBOL_LIB& aLibrary, const wxString& aName ); +bool operator!=( const LEGACY_SYMBOL_LIB& aLibrary, const wxString& aName ); #endif // SYMBOL_LIBRARY_H diff --git a/eeschema/netlist_exporters/netlist_exporter_allegro.cpp b/eeschema/netlist_exporters/netlist_exporter_allegro.cpp index f726eb9606..fafa00c8b5 100644 --- a/eeschema/netlist_exporters/netlist_exporter_allegro.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_allegro.cpp @@ -28,8 +28,6 @@ #include #include #include -#include -#include #include #include "netlist_exporter_allegro.h" #include "netlist_exporter_xml.h" diff --git a/eeschema/netlist_exporters/netlist_exporter_base.cpp b/eeschema/netlist_exporters/netlist_exporter_base.cpp index 52001de10a..7c2667a0e7 100644 --- a/eeschema/netlist_exporters/netlist_exporter_base.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_base.cpp @@ -27,7 +27,6 @@ #include -#include #include #include #include diff --git a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp index 48954cebde..63e030b6cd 100644 --- a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp @@ -32,8 +32,6 @@ #include #include #include -#include -#include #include #include "netlist_exporter_orcadpcb2.h" diff --git a/eeschema/netlist_exporters/netlist_exporter_xml.cpp b/eeschema/netlist_exporters/netlist_exporter_xml.cpp index 7df72edb34..6e4706d203 100644 --- a/eeschema/netlist_exporters/netlist_exporter_xml.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_xml.cpp @@ -29,7 +29,6 @@ #include // for ExpandTextVars #include #include -#include #include #include #include diff --git a/eeschema/picksymbol.cpp b/eeschema/picksymbol.cpp index dd751aa23d..e579242b79 100644 --- a/eeschema/picksymbol.cpp +++ b/eeschema/picksymbol.cpp @@ -24,7 +24,6 @@ */ #include -#include #include #include #include diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp index 3cabe37483..a29328a303 100644 --- a/eeschema/project_rescue.cpp +++ b/eeschema/project_rescue.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include #include #include #include @@ -83,11 +83,11 @@ static void getSymbols( SCHEMATIC* aSchematic, std::vector& aSymbol * @param aLibs - the loaded SYMBOL_LIBS * @param aCached - whether we are looking for the cached symbol */ -static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool aCached ) +static LIB_SYMBOL* findSymbol( const wxString& aName, LEGACY_SYMBOL_LIBS* aLibs, bool aCached ) { LIB_SYMBOL *symbol = nullptr; - for( SYMBOL_LIB& each_lib : *aLibs ) + for( LEGACY_SYMBOL_LIB& each_lib : *aLibs ) { if( aCached && !each_lib.IsCache() ) continue; @@ -145,13 +145,13 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer, boost::ptr_vectorFindLibSymbol( id ); + case_sensitive_match = PROJECT_SCH::LegacySchLibs( aRescuer.GetPrj() )->FindLibSymbol( id ); if( case_sensitive_match ) continue; // If the case sensitive match failed, try a case insensitive match. - PROJECT_SCH::SchLibs( aRescuer.GetPrj() ) + PROJECT_SCH::LegacySchLibs( aRescuer.GetPrj() ) ->FindLibraryNearEntries( case_insensitive_matches, symbol_name ); // If there are not case insensitive matches either, the symbol cannot be rescued. @@ -225,8 +225,8 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer, boost::ptr_vectorGetLibId().GetLibNickname().wx_str(), eachSymbol->GetLibId().GetLibItemName().wx_str() ); - cache_match = findSymbol( tmp, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), true ); + cache_match = findSymbol( tmp, PROJECT_SCH::LegacySchLibs( aRescuer.GetPrj() ), + true ); } // Test whether there is a conflict or if the symbol can only be found in the cache @@ -366,7 +367,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues( RESCUER& aRescuer, // Get the library symbol from the cache library. It will be a flattened // symbol by default (no inheritance). - cache_match = findSymbol( symbolName, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), true ); + cache_match = findSymbol( symbolName, PROJECT_SCH::LegacySchLibs( aRescuer.GetPrj() ), true ); // At some point during V5 development, the LIB_ID delimiter character ':' was // replaced by '_' when writing the symbol cache library so we have to test for @@ -376,7 +377,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues( RESCUER& aRescuer, symbolName.Printf( wxT( "%s-%s" ), symbol_id.GetLibNickname().wx_str(), symbol_id.GetLibItemName().wx_str() ); - cache_match = findSymbol( symbolName, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), true ); + cache_match = findSymbol( symbolName, PROJECT_SCH::LegacySchLibs( aRescuer.GetPrj() ), true ); } // Get the library symbol from the symbol library table. @@ -634,15 +635,15 @@ void LEGACY_RESCUER::OpenRescueLibrary() { wxFileName fn = GetRescueLibraryFileName( m_schematic ); - std::unique_ptr rescue_lib = - std::make_unique( SCH_LIB_TYPE::LT_EESCHEMA, fn.GetFullPath() ); + std::unique_ptr rescue_lib = + std::make_unique( SCH_LIB_TYPE::LT_EESCHEMA, fn.GetFullPath() ); m_rescue_lib = std::move( rescue_lib ); m_rescue_lib->EnableBuffering(); // If a rescue library already exists copy the contents of that library so we do not // lose any previous rescues. - SYMBOL_LIB* rescueLib = PROJECT_SCH::SchLibs( m_prj )->FindLibrary( fn.GetName() ); + LEGACY_SYMBOL_LIB* rescueLib = PROJECT_SCH::LegacySchLibs( m_prj )->FindLibrary( fn.GetName() ); if( rescueLib ) { @@ -677,17 +678,17 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent ) wxString libPaths; wxString libName = m_rescue_lib->GetName(); - SYMBOL_LIBS* libs = dynamic_cast( m_prj->GetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS ) ); + LEGACY_SYMBOL_LIBS* libs = dynamic_cast( m_prj->GetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS ) ); if( !libs ) { - libs = new SYMBOL_LIBS(); + libs = new LEGACY_SYMBOL_LIBS(); m_prj->SetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS, libs ); } try { - SYMBOL_LIBS::GetLibNamesAndPaths( m_prj, &libPaths, &libNames ); + LEGACY_SYMBOL_LIBS::GetLibNamesAndPaths( m_prj, &libPaths, &libNames ); // Make sure the library is not already in the list while( libNames.Index( libName ) != wxNOT_FOUND ) @@ -695,7 +696,7 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent ) // Add the library to the top of the list and save. libNames.Insert( libName, 0 ); - SYMBOL_LIBS::SetLibNamesAndPaths( m_prj, libPaths, libNames ); + LEGACY_SYMBOL_LIBS::SetLibNamesAndPaths( m_prj, libPaths, libNames ); } catch( const IO_ERROR& ) { @@ -705,12 +706,12 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent ) // Save the old libraries in case there is a problem after clear(). We'll // put them back in. - boost::ptr_vector libsSave; + boost::ptr_vector libsSave; libsSave.transfer( libsSave.end(), libs->begin(), libs->end(), *libs ); m_prj->SetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS, nullptr ); - libs = new SYMBOL_LIBS(); + libs = new LEGACY_SYMBOL_LIBS(); try { diff --git a/eeschema/project_rescue.h b/eeschema/project_rescue.h index 5cc5935a36..2c2249f47d 100644 --- a/eeschema/project_rescue.h +++ b/eeschema/project_rescue.h @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -362,7 +363,7 @@ public: virtual void AddSymbol( LIB_SYMBOL* aNewSymbol ) override; private: - std::unique_ptr m_rescue_lib; + std::unique_ptr m_rescue_lib; }; diff --git a/eeschema/project_sch.cpp b/eeschema/project_sch.cpp index ae37393d09..2d4b5f4fa3 100644 --- a/eeschema/project_sch.cpp +++ b/eeschema/project_sch.cpp @@ -17,7 +17,6 @@ * with this program. If not, see . */ -#include #include #include #include @@ -26,6 +25,7 @@ #include #include #include +#include #include static std::mutex s_symbolTableMutex; @@ -60,7 +60,7 @@ SEARCH_STACK* PROJECT_SCH::SchSearchS( PROJECT* aProject ) try { - SYMBOL_LIBS::GetLibNamesAndPaths( aProject, &libDir ); + LEGACY_SYMBOL_LIBS::GetLibNamesAndPaths( aProject, &libDir ); } catch( const IO_ERROR& ) { @@ -88,15 +88,15 @@ SEARCH_STACK* PROJECT_SCH::SchSearchS( PROJECT* aProject ) } -SYMBOL_LIBS* PROJECT_SCH::SchLibs( PROJECT* aProject ) +LEGACY_SYMBOL_LIBS* PROJECT_SCH::LegacySchLibs( PROJECT* aProject ) { - SYMBOL_LIBS* libs = (SYMBOL_LIBS*) aProject->GetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS ); + LEGACY_SYMBOL_LIBS* libs = (LEGACY_SYMBOL_LIBS*) aProject->GetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS ); wxASSERT( !libs || libs->ProjectElementType() == PROJECT::ELEM::SCH_SYMBOL_LIBS ); if( !libs ) { - libs = new SYMBOL_LIBS(); + libs = new LEGACY_SYMBOL_LIBS(); // Make PROJECT the new SYMBOL_LIBS owner. aProject->SetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS, libs ); diff --git a/eeschema/project_sch.h b/eeschema/project_sch.h index f6f31aa92f..91fe2b2ea4 100644 --- a/eeschema/project_sch.h +++ b/eeschema/project_sch.h @@ -26,14 +26,17 @@ class SYMBOL_LIB_TABLE; class PROJECT; class SEARCH_STACK; -class SYMBOL_LIBS; +class LEGACY_SYMBOL_LIBS; class SYMBOL_LIBRARY_MANAGER_ADAPTER; class PROJECT_SCH { public: - /// These are all prefaced with "Sch". - static SYMBOL_LIBS* SchLibs( PROJECT* aProject ); + /** + * Returns the list of symbol libraries from a legacy (pre-5.x) design + * This is only used from the remapping dialog at this point. + */ + static LEGACY_SYMBOL_LIBS* LegacySchLibs( PROJECT* aProject ); /// Accessor for Eeschema search stack. static SEARCH_STACK* SchSearchS( PROJECT* aProject ); diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 840c4f327e..de48028fdf 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include @@ -71,7 +71,7 @@ LIB_SYMBOL* SchGetLibSymbol( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, - SYMBOL_LIB* aCacheLib, wxWindow* aParent, bool aShowErrorMsg ) + LEGACY_SYMBOL_LIB* aCacheLib, wxWindow* aParent, bool aShowErrorMsg ) { wxCHECK_MSG( aLibTable, nullptr, wxS( "Invalid symbol library table." ) ); @@ -266,8 +266,8 @@ void SCH_BASE_FRAME::UpdateStatusBar() LIB_SYMBOL* SCH_BASE_FRAME::GetLibSymbol( const LIB_ID& aLibId, bool aUseCacheLib, bool aShowErrorMsg ) { - SYMBOL_LIB* cache = - ( aUseCacheLib ) ? PROJECT_SCH::SchLibs( &Prj() )->GetCacheLibrary() : nullptr; + LEGACY_SYMBOL_LIB* cache = + ( aUseCacheLib ) ? PROJECT_SCH::LegacySchLibs( &Prj() )->GetCacheLibrary() : nullptr; return SchGetLibSymbol( aLibId, PROJECT_SCH::SchSymbolLibTable( &Prj() ), cache, this, aShowErrorMsg ); @@ -875,7 +875,7 @@ void SCH_BASE_FRAME::setSymWatcher( const LIB_ID* aID ) void SCH_BASE_FRAME::OnSymChange( wxFileSystemWatcherEvent& aEvent ) { - SYMBOL_LIBS* libs = PROJECT_SCH::SchLibs( &Prj() ); + LEGACY_SYMBOL_LIBS* libs = PROJECT_SCH::LegacySchLibs( &Prj() ); wxLogTrace( traceLibWatch, "OnSymChange: %s, watcher file: %s", aEvent.GetPath().GetFullPath(), m_watcherFileName.GetFullPath() ); diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index 139b606a31..194250d4f8 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -49,7 +49,7 @@ class TITLE_BLOCK; class SYMBOL_VIEWER_FRAME; class SYMBOL_EDIT_FRAME; class LIB_SYMBOL; -class SYMBOL_LIB; +class LEGACY_SYMBOL_LIB; class SYMBOL_LIBRARY_FILTER; class LIB_ID; class SYMBOL_LIB_TABLE; @@ -96,7 +96,7 @@ class wxFileSystemWatcherEvent; * @return The symbol found in the library or NULL if the symbol was not found. */ LIB_SYMBOL* SchGetLibSymbol( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, - SYMBOL_LIB* aCacheLib = nullptr, wxWindow* aParent = nullptr, + LEGACY_SYMBOL_LIB* aCacheLib = nullptr, wxWindow* aParent = nullptr, bool aShowErrorMsg = false ); /** diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 11603ac328..e949009c7d 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 76eda0a4a7..5e0a4966da 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/sch_io/eagle/sch_io_eagle.h b/eeschema/sch_io/eagle/sch_io_eagle.h index 59589e37e1..3446103951 100644 --- a/eeschema/sch_io/eagle/sch_io_eagle.h +++ b/eeschema/sch_io/eagle/sch_io_eagle.h @@ -48,7 +48,7 @@ class SCH_GLOBALLABEL; class SCH_SYMBOL; class SCH_FIELD; class LIB_SYMBOL; -class SYMBOL_LIB; +class LEGACY_SYMBOL_LIB; class SCH_PIN; class wxXmlNode; diff --git a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp index 290fcfce23..2dbf0437e0 100644 --- a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp +++ b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp @@ -60,7 +60,7 @@ #include #include #include -#include +#include #include #include // for MAX_UNIT_COUNT_PER_PACKAGE definition #include diff --git a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.h b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.h index dc46421c91..6ac31b05cb 100644 --- a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.h +++ b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.h @@ -46,7 +46,7 @@ class SCH_FIELD; class SELECTION; class SCH_IO_KICAD_LEGACY_LIB_CACHE; class LIB_SYMBOL; -class SYMBOL_LIB; +class LEGACY_SYMBOL_LIB; class BUS_ALIAS; class OUTPUTFORMATTER; diff --git a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.h b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.h index eb3f0ce68b..d6bfcb5907 100644 --- a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.h +++ b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.h @@ -55,7 +55,7 @@ struct SCH_SYMBOL_INSTANCE; class SCH_SELECTION; class SCH_IO_KICAD_SEXPR_LIB_CACHE; class LIB_SYMBOL; -class SYMBOL_LIB; +class LEGACY_SYMBOL_LIB; class BUS_ALIAS; /** diff --git a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.h b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.h index 67fabe9603..173c59ae43 100644 --- a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.h +++ b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.h @@ -31,7 +31,8 @@ #ifndef SCH_IO_KICAD_SEXPR_PARSER_H_ #define SCH_IO_KICAD_SEXPR_PARSER_H_ -#include +#include +#include #include #include #include // For some default values diff --git a/eeschema/sch_io/sch_io_mgr.h b/eeschema/sch_io/sch_io_mgr.h index b58a951daf..ec175c8138 100644 --- a/eeschema/sch_io/sch_io_mgr.h +++ b/eeschema/sch_io/sch_io_mgr.h @@ -40,7 +40,7 @@ class SCHEMATIC; class SYMBOL_LIB_TABLE; class KIWAY; class LIB_SYMBOL; -class SYMBOL_LIB; +class LEGACY_SYMBOL_LIB; class PROGRESS_REPORTER; diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 6ff9e53a1f..6253bb0784 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include #include @@ -671,7 +671,7 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter ) SYMBOL_LIB_TABLE* libs = PROJECT_SCH::SchSymbolLibTable( &Schematic()->Project() ); // This will be a nullptr if an s-expression schematic is loaded. - SYMBOL_LIBS* legacyLibs = PROJECT_SCH::SchLibs( &Schematic()->Project() ); + LEGACY_SYMBOL_LIBS* legacyLibs = PROJECT_SCH::LegacySchLibs( &Schematic()->Project() ); for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) ) symbols.push_back( static_cast( item ) ); @@ -754,7 +754,7 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter ) if( !tmp && legacyLibs && legacyLibs->GetLibraryCount() ) { - SYMBOL_LIB& legacyCacheLib = legacyLibs->back(); + LEGACY_SYMBOL_LIB& legacyCacheLib = legacyLibs->back(); // It better be the cache library. wxCHECK2( legacyCacheLib.IsCache(), continue ); diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index d43a7beb3d..9921375e65 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index 65848beb5d..6844575ce3 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -53,8 +53,8 @@ class KIID_PATH; class SCH_SCREEN; class LIB_SYMBOL; class MSG_PANEL_ITEM; -class SYMBOL_LIB; -class SYMBOL_LIBS; +class LEGACY_SYMBOL_LIB; +class LEGACY_SYMBOL_LIBS; class SCH_SCREEN; class SCH_COMMIT; diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 2ac52e9127..1e20409c28 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/symbol_editor/symbol_editor.cpp b/eeschema/symbol_editor/symbol_editor.cpp index b61d63ebfc..89b6e70540 100644 --- a/eeschema/symbol_editor/symbol_editor.cpp +++ b/eeschema/symbol_editor/symbol_editor.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/symbol_editor/symbol_editor_import_export.cpp b/eeschema/symbol_editor/symbol_editor_import_export.cpp index ef47dbe801..d38d4dad3b 100644 --- a/eeschema/symbol_editor/symbol_editor_import_export.cpp +++ b/eeschema/symbol_editor/symbol_editor_import_export.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/symbol_library_manager.cpp b/eeschema/symbol_library_manager.cpp index cff2406467..efeb9eefbf 100644 --- a/eeschema/symbol_library_manager.cpp +++ b/eeschema/symbol_library_manager.cpp @@ -25,7 +25,6 @@ #include "symbol_library_manager.h" -#include #include #include #include diff --git a/eeschema/symbol_library_manager.h b/eeschema/symbol_library_manager.h index 01deff5a88..00f7fd5740 100644 --- a/eeschema/symbol_library_manager.h +++ b/eeschema/symbol_library_manager.h @@ -37,7 +37,7 @@ #include class LIB_SYMBOL; -class SYMBOL_LIB; +class LEGACY_SYMBOL_LIB; class PROGRESS_REPORTER; class SCH_IO; class SCH_BASE_FRAME; diff --git a/eeschema/toolbars_symbol_viewer.cpp b/eeschema/toolbars_symbol_viewer.cpp index 357d0e5d44..30b238ca8b 100644 --- a/eeschema/toolbars_symbol_viewer.cpp +++ b/eeschema/toolbars_symbol_viewer.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 62a0cf4999..c274dda5c1 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include @@ -345,7 +345,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( ACTIONS::selectionClear ); SYMBOL_LIB_TABLE* libs = PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() ); - SYMBOL_LIB* cache = PROJECT_SCH::SchLibs( &m_frame->Prj() )->GetCacheLibrary(); + LEGACY_SYMBOL_LIB* cache = PROJECT_SCH::LegacySchLibs( &m_frame->Prj() )->GetCacheLibrary(); std::set unique_libid; std::vector alreadyPlaced; diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 835fb54f79..e38da7183b 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -62,7 +62,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/widgets/panel_symbol_chooser.cpp b/eeschema/widgets/panel_symbol_chooser.cpp index 8a4b530b95..fd382c6ff5 100644 --- a/eeschema/widgets/panel_symbol_chooser.cpp +++ b/eeschema/widgets/panel_symbol_chooser.cpp @@ -36,7 +36,7 @@ #include #include #include -#include // For SYMBOL_LIBRARY_FILTER +#include // For SYMBOL_LIBRARY_FILTER #include #include #include diff --git a/include/project.h b/include/project.h index adb447675c..8618b29e18 100644 --- a/include/project.h +++ b/include/project.h @@ -44,7 +44,7 @@ class DESIGN_BLOCK_LIB_TABLE; class FP_LIB_TABLE; -class SYMBOL_LIBS; +class LEGACY_SYMBOL_LIBS; class SEARCH_STACK; class S3D_CACHE; class KIWAY; diff --git a/qa/schematic_utils/schematic_file_util.cpp b/qa/schematic_utils/schematic_file_util.cpp index 7df481d7fd..e599ff36c5 100644 --- a/qa/schematic_utils/schematic_file_util.cpp +++ b/qa/schematic_utils/schematic_file_util.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include