Move and rename legacy library code

This commit is contained in:
Jon Evans
2025-01-25 15:04:19 -05:00
parent 0b2b6b2e77
commit ee6bda1699
51 changed files with 152 additions and 312 deletions
+2 -2
View File
@@ -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
-1
View File
@@ -31,7 +31,6 @@
#include <sch_commit.h>
#include <erc/erc_settings.h>
#include <sch_reference_list.h>
#include <symbol_library.h>
#include <tools/sch_selection.h>
#include <tools/sch_selection_tool.h>
#include <tool/tool_manager.h>
@@ -38,7 +38,6 @@
#include <sch_collectors.h>
#include <sch_symbol.h>
#include <template_fieldnames.h>
#include <symbol_library.h>
#include <sch_validators.h>
#include <schematic.h>
#include <sch_commit.h>
+1 -1
View File
@@ -22,7 +22,7 @@
*/
#include <class_draw_panel_gal.h>
#include <symbol_library.h>
#include <libraries/legacy_symbol_library.h>
#include <dialog_rescue_each_base.h>
#include <eeschema_settings.h>
#include <invoke_sch_dialog.h>
@@ -21,7 +21,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <symbol_library.h>
#include <dialog_symbol_chooser.h>
#include <widgets/panel_symbol_chooser.h>
#include <eeschema_settings.h>
@@ -26,7 +26,6 @@
#include <common.h>
#include <base_units.h>
#include <bitmaps.h>
#include <symbol_library.h>
#include <confirm.h>
#include <eda_doc.h>
#include <wildcards_and_files_ext.h>
@@ -38,7 +38,6 @@
#include <widgets/std_bitmap_button.h>
#include <settings/settings_manager.h>
#include <sch_collectors.h>
#include <symbol_library.h>
#include <fields_grid_table.h>
#include <sch_edit_frame.h>
#include <sch_reference_list.h>
+8 -8
View File
@@ -32,7 +32,7 @@
#include <wx_filename.h>
#include "widgets/wx_html_report_panel.h"
#include <symbol_library.h>
#include <libraries/legacy_symbol_library.h>
#include <core/kicad_algo.h>
#include <symbol_viewer_frame.h>
#include <project_rescue.h>
@@ -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<SYMBOL_LIB*> libs;
std::vector<LEGACY_SYMBOL_LIB*> libs;
if( getLibsNotInGlobalSymbolLibTable( libs ) )
{
@@ -178,7 +178,7 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
SYMBOL_LIB_TABLE libTable;
std::vector<wxString> 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() )
+2 -2
View File
@@ -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 );
-1
View File
@@ -20,7 +20,6 @@
#include <mutex>
#include <wx/ffile.h>
#include <symbol_library.h>
#include <confirm.h>
#include <dialogs/dialog_schematic_setup.h>
#include <kiway.h>
-1
View File
@@ -32,7 +32,6 @@
#include <sch_validators.h>
#include <validators.h>
#include <sch_edit_frame.h>
#include <symbol_library.h>
#include <schematic.h>
#include <template_fieldnames.h>
#include <widgets/grid_text_button_helpers.h>
+5 -5
View File
@@ -24,7 +24,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <symbol_library.h>
#include <confirm.h>
#include <common.h>
#include <connection_graph.h>
@@ -35,6 +34,7 @@
#include <id.h>
#include <kiface_base.h>
#include <kiplatform/app.h>
#include <libraries/legacy_symbol_library.h>
#include <lockfile.h>
#include <pgm_base.h>
#include <core/profile.h>
@@ -203,7 +203,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& 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<wxString>& 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<wxString>& 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<wxString>& 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 )
{
+1 -2
View File
@@ -25,7 +25,6 @@
#include <widgets/wx_grid.h>
#include <sch_reference_list.h>
#include <schematic_settings.h>
#include <symbol_library.h>
#include "string_utils.h"
#include <trace_helpers.h>
@@ -1188,4 +1187,4 @@ bool LIB_FIELDS_EDITOR_GRID_DATA_MODEL::isStripeableField( int aCol )
// Don't apply stripes to checkbox fields
return !ColIsCheck( aCol );
}
}
+5 -3
View File
@@ -30,12 +30,14 @@
#include <sch_screen.h>
#include <template_fieldnames.h>
#include <transform.h>
#include <symbol_library.h>
#include <settings/color_settings.h>
#include <sch_pin.h>
#include <sch_shape.h>
#include <trace_helpers.h>
// TODO(JE) remove m_library; shouldn't be needed with legacy remapping
#include <libraries/legacy_symbol_library.h>
#include <algorithm>
#include <memory>
#include <unordered_set>
@@ -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() )
+6 -6
View File
@@ -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
-141
View File
@@ -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 <stambaughw@gmail.com>
* 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 <confirm.h>
#include <wildcards_and_files_ext.h>
#include <sch_edit_frame.h>
#include <symbol_library.h>
#include <sch_symbol.h>
#include <sch_sheet.h>
#include <schematic.h>
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<SYMBOL_LIB> archLib = std::make_unique<SYMBOL_LIB>( 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<SCH_SYMBOL*>( 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<LIB_SYMBOL> 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;
}
@@ -36,15 +36,15 @@
#include <project_sch.h>
#include <widgets/app_progress_dialog.h>
#include <symbol_library.h>
#include <libraries/legacy_symbol_library.h>
#include <sch_io/kicad_legacy/sch_io_kicad_legacy.h>
#include <wx/log.h>
#include <wx/progdlg.h>
#include <wx/tokenzr.h>
#include "sim/sim_model.h"
#include <sim/sim_model.h>
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<LIB_SYMBOL*>& aSymbols ) const
void LEGACY_SYMBOL_LIB::GetSymbols( std::vector<LIB_SYMBOL*>& aSymbols ) const
{
m_plugin->EnumerateSymbolLib( aSymbols, fileName.GetFullPath(), m_properties.get() );
@@ -155,7 +155,7 @@ void SYMBOL_LIB::GetSymbols( std::vector<LIB_SYMBOL*>& 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<SYMBOL_LIB*>( this ) );
symbol->SetLib( const_cast<LEGACY_SYMBOL_LIB*>( this ) );
SIM_MODEL::MigrateSimModel<LIB_SYMBOL>( *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<SYMBOL_LIB> lib = std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
std::unique_ptr<LEGACY_SYMBOL_LIB> lib = std::make_unique<LEGACY_SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
aFileName );
std::vector<LIB_SYMBOL*> 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<LIB_SYMBOL*>& aCandidates,
void LEGACY_SYMBOL_LIBS::FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& 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<LIB_SYMBOL*>& 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() )
{
@@ -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<LEGACY_SYMBOL_LIB>, 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
@@ -28,8 +28,6 @@
#include <string_utils.h>
#include <connection_graph.h>
#include <core/kicad_algo.h>
#include <symbol_library.h>
#include <symbol_lib_table.h>
#include <netlist.h>
#include "netlist_exporter_allegro.h"
#include "netlist_exporter_xml.h"
@@ -27,7 +27,6 @@
#include <string_utils.h>
#include <symbol_library.h>
#include <trace_helpers.h>
#include <connection_graph.h>
#include <sch_reference_list.h>
@@ -32,8 +32,6 @@
#include <sch_edit_frame.h>
#include <sch_reference_list.h>
#include <string_utils.h>
#include <symbol_library.h>
#include <symbol_lib_table.h>
#include <netlist.h>
#include "netlist_exporter_orcadpcb2.h"
@@ -29,7 +29,6 @@
#include <common.h> // for ExpandTextVars
#include <sch_base_frame.h>
#include <sch_group.h>
#include <symbol_library.h>
#include <string_utils.h>
#include <connection_graph.h>
#include <core/kicad_algo.h>
-1
View File
@@ -24,7 +24,6 @@
*/
#include <pgm_base.h>
#include <symbol_library.h>
#include <settings/settings_manager.h>
#include <project/project_file.h>
#include <symbol_library_common.h>
+20 -19
View File
@@ -23,7 +23,7 @@
*/
#include <sch_draw_panel.h>
#include <symbol_library.h>
#include <libraries/legacy_symbol_library.h>
#include <confirm.h>
#include <connection_graph.h>
#include <invoke_sch_dialog.h>
@@ -83,11 +83,11 @@ static void getSymbols( SCHEMATIC* aSchematic, std::vector<SCH_SYMBOL*>& 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_vector<RE
LIB_ID id( wxEmptyString, symbol_name );
case_sensitive_match = PROJECT_SCH::SchLibs( aRescuer.GetPrj() )->FindLibSymbol( 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_vector<R
// A new symbol name is found (a new group starts here).
// Search the symbol names candidates only once for this group:
old_symbol_name = symbol_name;
cache_match = findSymbol( symbol_name, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), true );
lib_match = findSymbol( symbol_name, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), false );
cache_match = findSymbol( symbol_name, PROJECT_SCH::LegacySchLibs( aRescuer.GetPrj() ), true );
lib_match = findSymbol( symbol_name, PROJECT_SCH::LegacySchLibs( aRescuer.GetPrj() ), false );
// 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
@@ -236,7 +236,8 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer, boost::ptr_vector<R
wxString tmp = wxString::Format( wxT( "%s-%s" ),
eachSymbol->GetLibId().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<SYMBOL_LIB> rescue_lib =
std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, fn.GetFullPath() );
std::unique_ptr<LEGACY_SYMBOL_LIB> rescue_lib =
std::make_unique<LEGACY_SYMBOL_LIB>( 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<SYMBOL_LIBS*>( m_prj->GetElem( PROJECT::ELEM::SCH_SYMBOL_LIBS ) );
LEGACY_SYMBOL_LIBS* libs = dynamic_cast<LEGACY_SYMBOL_LIBS*>( 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<SYMBOL_LIB> libsSave;
boost::ptr_vector<LEGACY_SYMBOL_LIB> 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
{
+2 -1
View File
@@ -40,6 +40,7 @@
#include <wx/string.h>
#include <lib_symbol.h>
#include <libraries/legacy_symbol_library.h>
#include <sch_io/kicad_legacy/sch_io_kicad_legacy.h>
#include <class_draw_panel_gal.h>
@@ -362,7 +363,7 @@ public:
virtual void AddSymbol( LIB_SYMBOL* aNewSymbol ) override;
private:
std::unique_ptr<SYMBOL_LIB> m_rescue_lib;
std::unique_ptr<LEGACY_SYMBOL_LIB> m_rescue_lib;
};
+5 -5
View File
@@ -17,7 +17,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <symbol_library.h>
#include <confirm.h>
#include <dialogs/html_message_box.h>
#include <kiface_base.h>
@@ -26,6 +25,7 @@
#include <core/utf8.h>
#include <symbol_lib_table.h>
#include <project_sch.h>
#include <libraries/legacy_symbol_library.h>
#include <libraries/symbol_library_manager_adapter.h>
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 );
+6 -3
View File
@@ -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 );
+5 -5
View File
@@ -44,7 +44,7 @@
#include <confirm.h>
#include <preview_items/selection_area.h>
#include <project_sch.h>
#include <symbol_library.h>
#include <libraries/legacy_symbol_library.h>
#include <symbol_lib_table.h>
#include <sch_base_frame.h>
#include <dialogs/dialog_sch_find.h>
@@ -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() );
+2 -2
View File
@@ -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 );
/**
-1
View File
@@ -27,7 +27,6 @@
#include <api/api_server.h>
#include <base_units.h>
#include <bitmaps.h>
#include <symbol_library.h>
#include <confirm.h>
#include <connection_graph.h>
#include <dialogs/dialog_erc.h>
-1
View File
@@ -32,7 +32,6 @@
#include <plotters/plotter.h>
#include <bitmaps.h>
#include <kiway.h>
#include <symbol_library.h>
#include <settings/color_settings.h>
#include <string_utils.h>
#include <geometry/geometry_utils.h>
+1 -1
View File
@@ -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;
@@ -60,7 +60,7 @@
#include <sch_io/kicad_legacy/sch_io_kicad_legacy_helpers.h>
#include <sch_screen.h>
#include <schematic.h>
#include <symbol_library.h>
#include <libraries/legacy_symbol_library.h>
#include <symbol_lib_table.h>
#include <eeschema_id.h> // for MAX_UNIT_COUNT_PER_PACKAGE definition
#include <tool/selection.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;
@@ -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;
/**
@@ -31,7 +31,8 @@
#ifndef SCH_IO_KICAD_SEXPR_PARSER_H_
#define SCH_IO_KICAD_SEXPR_PARSER_H_
#include <symbol_library.h>
#include <symbol_library_common.h>
#include <progress_reporter.h>
#include <schematic_lexer.h>
#include <sch_file_versions.h>
#include <default_values.h> // For some default values
+1 -1
View File
@@ -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;
+3 -3
View File
@@ -41,7 +41,7 @@
#include <sch_edit_frame.h>
#include <sch_item.h>
#include <symbol_library.h>
#include <libraries/legacy_symbol_library.h>
#include <connection_graph.h>
#include <junction_helpers.h>
#include <sch_pin.h>
@@ -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<SCH_SYMBOL*>( 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 );
-1
View File
@@ -29,7 +29,6 @@
#include <sch_marker.h>
#include <sch_label.h>
#include <sch_shape.h>
#include <symbol_library.h>
#include <sch_sheet_path.h>
#include <sch_symbol.h>
#include <sch_sheet.h>
+2 -2
View File
@@ -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;
@@ -26,7 +26,6 @@
#include <bitmaps.h>
#include <wx/hyperlink.h>
#include <base_screen.h>
#include <symbol_library.h>
#include <confirm.h>
#include <core/kicad_algo.h>
#include <eeschema_id.h>
-1
View File
@@ -31,7 +31,6 @@
#include <widgets/wx_infobar.h>
#include <tools/symbol_editor_drawing_tools.h>
#include <symbol_edit_frame.h>
#include <symbol_library.h>
#include <template_fieldnames.h>
#include <wildcards_and_files_ext.h>
#include <symbol_lib_table.h>
@@ -29,7 +29,6 @@
#include <io/eagle/eagle_parser.h>
#include <symbol_lib_table.h>
#include <symbol_edit_frame.h>
#include <symbol_library.h>
#include <wildcards_and_files_ext.h>
#include <lib_symbol_library_manager.h>
#include <wx/filename.h>
-1
View File
@@ -25,7 +25,6 @@
#include "symbol_library_manager.h"
#include <symbol_library.h>
#include <dialogs/html_message_box.h>
#include <symbol_edit_frame.h>
#include <symbol_lib_table.h>
+1 -1
View File
@@ -37,7 +37,7 @@
#include <sch_screen.h>
class LIB_SYMBOL;
class SYMBOL_LIB;
class LEGACY_SYMBOL_LIB;
class PROGRESS_REPORTER;
class SCH_IO;
class SCH_BASE_FRAME;
-1
View File
@@ -22,7 +22,6 @@
#include <bitmaps.h>
#include <macros.h>
#include <symbol_library.h>
#include <eeschema_id.h>
#include <symbol_viewer_frame.h>
#include <sch_painter.h>
+2 -2
View File
@@ -61,7 +61,7 @@
#include <schematic.h>
#include <sch_commit.h>
#include <scoped_set_reset.h>
#include <symbol_library.h>
#include <libraries/legacy_symbol_library.h>
#include <eeschema_settings.h>
#include <dialogs/dialog_label_properties.h>
#include <dialogs/dialog_text_properties.h>
@@ -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<UTF8> unique_libid;
std::vector<PICKED_SYMBOL> alreadyPlaced;
-1
View File
@@ -62,7 +62,6 @@
#include <sch_commit.h>
#include <sim/simulator_frame.h>
#include <symbol_lib_table.h>
#include <symbol_library.h>
#include <symbol_library_manager.h>
#include <symbol_viewer_frame.h>
#include <tool/picker_tool.h>
+1 -1
View File
@@ -36,7 +36,7 @@
#include <project/project_file.h>
#include <eeschema_settings.h>
#include <symbol_editor_settings.h>
#include <symbol_library.h> // For SYMBOL_LIBRARY_FILTER
#include <symbol_library_common.h> // For SYMBOL_LIBRARY_FILTER
#include <symbol_lib_table.h>
#include <algorithm>
#include <wx/button.h>
+1 -1
View File
@@ -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;
@@ -24,6 +24,7 @@
#include <settings/settings_manager.h>
#include <connection_graph.h>
#include <project.h>
#include <schematic.h>
#include <sch_screen.h>