mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 15:10:12 +00:00
Tear out the eeschema conditional compile of PROJECT
This commit is contained in:
parent
c772d116b2
commit
8c6899b0d3
common
eeschema
CMakeLists.txtsch_screen.cppsheet.cpp
dialogs
dialog_choose_symbol.cppdialog_choose_symbol.hdialog_edit_symbols_libid.cppdialog_lib_symbol_properties.cppdialog_symbol_fields_table.cppdialog_symbol_remap.cpppanel_sym_lib_table.cpp
eeschema_config.cpperc.cppfields_grid_table.cppfiles-io.cppnetlist_exporters
picksymbol.cppproject_rescue.cppproject_sch.cppproject_sch.hsch_base_frame.cppsch_plugins
altium
cadstar
eagle
easyeda
easyedapro
ltspice
symbol_editor
symbol_library.cppsymbol_library_manager.cppsymbol_tree_synchronizing_adapter.cppsymbol_viewer_frame.cpptools
widgets
include
@ -146,6 +146,12 @@ const wxString PROJECT::GetProjectPath() const
|
||||
}
|
||||
|
||||
|
||||
const wxString PROJECT::GetProjectDirectory() const
|
||||
{
|
||||
return m_project_name.GetPath();
|
||||
}
|
||||
|
||||
|
||||
const wxString PROJECT::GetProjectName() const
|
||||
{
|
||||
return m_project_name.GetName();
|
||||
|
@ -329,8 +329,8 @@ set( EESCHEMA_SRCS
|
||||
net_navigator.cpp
|
||||
pin_numbers.cpp
|
||||
pin_type.cpp
|
||||
project_sch.cpp
|
||||
project_rescue.cpp
|
||||
project_sch_specific.cpp
|
||||
sch_base_frame.cpp
|
||||
sch_bitmap.cpp
|
||||
sch_bus_entry.cpp
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <sch_base_frame.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <project_sch.h>
|
||||
#include <widgets/footprint_preview_widget.h>
|
||||
#include <widgets/footprint_select_widget.h>
|
||||
#include <widgets/lib_tree.h>
|
||||
@ -127,7 +128,8 @@ DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxStr
|
||||
treePanel->SetSizer( treeSizer );
|
||||
|
||||
m_tree = new LIB_TREE( treePanel, m_showPower ? wxT( "power" ) : wxT( "symbols" ),
|
||||
Prj().SchSymbolLibTable(), aAdapter, LIB_TREE::FLAGS::ALL_WIDGETS,
|
||||
PROJECT_SCH::SchSymbolLibTable( &Prj() ), aAdapter,
|
||||
LIB_TREE::FLAGS::ALL_WIDGETS,
|
||||
m_details );
|
||||
|
||||
treeSizer->Add( m_tree, 1, wxEXPAND | wxALL, 5 );
|
||||
@ -410,7 +412,7 @@ void DIALOG_CHOOSE_SYMBOL::ShowFootprintFor( LIB_ID const& aLibId )
|
||||
|
||||
try
|
||||
{
|
||||
symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
|
||||
symbol = PROJECT_SCH::SchSymbolLibTable( &Prj() )->LoadSymbol( aLibId );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
@ -469,7 +471,7 @@ void DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector( LIB_ID const& aLibId )
|
||||
{
|
||||
try
|
||||
{
|
||||
symbol = Prj().SchSymbolLibTable()->LoadSymbol( aLibId );
|
||||
symbol = PROJECT_SCH::SchSymbolLibTable( &Prj() )->LoadSymbol( aLibId );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ class SCH_DRAW_PANEL;
|
||||
* for thorough documentation. A simple example usage follows:
|
||||
*
|
||||
* // Create the adapter class
|
||||
* auto adapter( SYMBOL_TREE_MODEL_ADAPTER::Create( Prj().SchSymbolLibTable() ) );
|
||||
* auto adapter( SYMBOL_TREE_MODEL_ADAPTER::Create( PROJECT_SCH::SchSymbolLibTable( &Prj() ) );
|
||||
*
|
||||
* // Perform any configuration of adapter properties here
|
||||
* adapter->SetPreselectNode( "LIB_NICKNAME", "SYMBO_NAME", 2 );
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <widgets/grid_text_button_helpers.h>
|
||||
#include <kiplatform/ui.h>
|
||||
#include <string_utils.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
|
||||
#define COL_REFS 0
|
||||
@ -572,7 +573,7 @@ void DIALOG_EDIT_SYMBOLS_LIBID::onCellBrowseLib( wxGridEvent& event )
|
||||
|
||||
void DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton( wxCommandEvent& event )
|
||||
{
|
||||
std::vector<wxString> libs = Prj().SchSymbolLibTable()->GetLogicalLibs();
|
||||
std::vector<wxString> libs = PROJECT_SCH::SchSymbolLibTable( &Prj() )->GetLogicalLibs();
|
||||
wxArrayString aliasNames;
|
||||
wxArrayString candidateSymbNames;
|
||||
|
||||
@ -601,7 +602,7 @@ void DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton( wxCommandEvent& event )
|
||||
|
||||
try
|
||||
{
|
||||
Prj().SchSymbolLibTable()->EnumerateSymbolLib( lib, aliasNames );
|
||||
PROJECT_SCH::SchSymbolLibTable( &Prj() )->EnumerateSymbolLib( lib, aliasNames );
|
||||
}
|
||||
catch( const IO_ERROR& ) {} // ignore, it is handled below
|
||||
|
||||
@ -736,7 +737,7 @@ bool DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow()
|
||||
|
||||
try
|
||||
{
|
||||
symbol = Prj().SchSymbolLibTable()->LoadSymbol( id );
|
||||
symbol = PROJECT_SCH::SchSymbolLibTable( &Prj() )->LoadSymbol( id );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <widgets/wx_grid.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <string_utils.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
#include <dialog_sim_model.h>
|
||||
|
||||
@ -75,7 +76,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
|
||||
m_grid->ShowHideColumns( cfg->m_EditSymbolVisibleColumns );
|
||||
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new GRID_CELL_URL_EDITOR( this, Prj().SchSearchS() ) );
|
||||
attr->SetEditor( new GRID_CELL_URL_EDITOR( this, PROJECT_SCH::SchSearchS( &Prj() ) ) );
|
||||
m_grid->SetAttr( DATASHEET_FIELD, FDC_VALUE, attr );
|
||||
|
||||
m_SymbolNameCtrl->SetValidator( FIELD_VALIDATOR( VALUE_FIELD ) );
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "dialog_symbol_fields_table.h"
|
||||
#include <fields_data_model.h>
|
||||
#include <eda_list_dialog.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
wxDEFINE_EVENT( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, wxCommandEvent );
|
||||
|
||||
@ -121,7 +122,8 @@ protected:
|
||||
{
|
||||
wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(),
|
||||
DATASHEET_FIELD );
|
||||
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(), m_dlg->Prj().SchSearchS() );
|
||||
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(),
|
||||
PROJECT_SCH::SchSearchS( &m_dlg->Prj() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -338,7 +340,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::SetupColumnProperties( int aCol )
|
||||
== TEMPLATE_FIELDNAME::GetDefaultFieldName( DATASHEET_FIELD ) )
|
||||
{
|
||||
// set datasheet column viewer button
|
||||
attr->SetEditor( new GRID_CELL_URL_EDITOR( this, Prj().SchSearchS() ) );
|
||||
attr->SetEditor(
|
||||
new GRID_CELL_URL_EDITOR( this, PROJECT_SCH::SchSearchS( &Prj() ) ) );
|
||||
m_grid->SetColAttr( aCol, attr );
|
||||
}
|
||||
else if( m_dataModel->ColIsQuantity( aCol ) || m_dataModel->ColIsItemNumber( aCol ) )
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <settings/settings_manager.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <env_paths.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
#include <dialog_symbol_remap.h>
|
||||
|
||||
@ -123,7 +124,7 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
|
||||
|
||||
createProjectSymbolLibTable( m_messagePanel->Reporter() );
|
||||
Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
||||
Prj().SchSymbolLibTable();
|
||||
PROJECT_SCH::SchSymbolLibTable( &Prj() );
|
||||
|
||||
remapSymbolsToLibTable( m_messagePanel->Reporter() );
|
||||
|
||||
@ -135,7 +136,7 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
|
||||
|
||||
// Reload the cache symbol library.
|
||||
Prj().SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, nullptr );
|
||||
Prj().SchLibs();
|
||||
PROJECT_SCH::SchLibs( &Prj() );
|
||||
|
||||
Raise();
|
||||
m_remapped = true;
|
||||
@ -144,7 +145,7 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
|
||||
|
||||
size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< SYMBOL_LIB* >& aLibs )
|
||||
{
|
||||
SYMBOL_LIBS* libs = Prj().SchLibs();
|
||||
SYMBOL_LIBS* libs = PROJECT_SCH::SchLibs( &Prj() );
|
||||
|
||||
for( SYMBOL_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
|
||||
{
|
||||
@ -288,7 +289,7 @@ bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_SYMBOL* aSymbol )
|
||||
wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false,
|
||||
"The symbol LIB_ID name is empty." );
|
||||
|
||||
SYMBOL_LIBS* libs = Prj().SchLibs();
|
||||
SYMBOL_LIBS* libs = PROJECT_SCH::SchLibs( &Prj() );
|
||||
|
||||
for( SYMBOL_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
|
||||
{
|
||||
@ -306,7 +307,7 @@ bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_SYMBOL* aSymbol )
|
||||
// Find the same library in the symbol library table using the full path and file name.
|
||||
wxString libFileName = it->GetFullFileName();
|
||||
|
||||
const LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRowByURI( libFileName );
|
||||
const LIB_TABLE_ROW* row = PROJECT_SCH::SchSymbolLibTable( &Prj() )->FindRowByURI( libFileName );
|
||||
|
||||
if( row )
|
||||
{
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <sch_file_versions.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
|
||||
|
||||
@ -1134,7 +1135,7 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent )
|
||||
|
||||
// Don't allow editing project tables if no project is open
|
||||
if( !aKiway->Prj().IsNullProject() )
|
||||
projectTable = aKiway->Prj().SchSymbolLibTable();
|
||||
projectTable = PROJECT_SCH::SchSymbolLibTable( &aKiway->Prj() );
|
||||
|
||||
if( symbolEditor )
|
||||
{
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include <widgets/properties_panel.h>
|
||||
#include <settings/app_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <drawing_sheet/ds_data_model.h>
|
||||
#include <zoom_defines.h>
|
||||
@ -282,53 +281,4 @@ void SCH_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||
wxCHECK_RET( aCfg, wxS( "Call to SCH_BASE_FRAME::SaveSettings with null settings" ) );
|
||||
|
||||
EDA_DRAW_FRAME::SaveSettings( aCfg );
|
||||
}
|
||||
|
||||
|
||||
static std::mutex s_symbolTableMutex;
|
||||
|
||||
|
||||
SYMBOL_LIB_TABLE* PROJECT::SchSymbolLibTable()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock( s_symbolTableMutex );
|
||||
|
||||
// This is a lazy loading function, it loads the project specific table when
|
||||
// that table is asked for, not before.
|
||||
SYMBOL_LIB_TABLE* tbl = (SYMBOL_LIB_TABLE*) GetElem( ELEM_SYMBOL_LIB_TABLE );
|
||||
|
||||
// its gotta be NULL or a SYMBOL_LIB_TABLE, or a bug.
|
||||
wxASSERT( !tbl || tbl->Type() == SYMBOL_LIB_TABLE_T );
|
||||
|
||||
if( !tbl )
|
||||
{
|
||||
// Stack the project specific SYMBOL_LIB_TABLE overlay on top of the global table.
|
||||
// ~SYMBOL_LIB_TABLE() will not touch the fallback table, so multiple projects may
|
||||
// stack this way, all using the same global fallback table.
|
||||
tbl = new SYMBOL_LIB_TABLE( &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
|
||||
|
||||
SetElem( ELEM_SYMBOL_LIB_TABLE, tbl );
|
||||
|
||||
wxString prjPath;
|
||||
|
||||
wxGetEnv( PROJECT_VAR_NAME, &prjPath );
|
||||
|
||||
if( !prjPath.IsEmpty() )
|
||||
{
|
||||
wxFileName fn( prjPath, SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
||||
|
||||
try
|
||||
{
|
||||
tbl->Load( fn.GetFullPath() );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error loading the symbol library table '%s'." ),
|
||||
fn.GetFullPath() );
|
||||
DisplayErrorMessage( nullptr, msg, ioe.What() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tbl;
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <string_utils.h>
|
||||
#include <lib_pin.h>
|
||||
#include <project_sch.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_marker.h>
|
||||
#include <sch_reference_list.h>
|
||||
@ -885,7 +886,7 @@ int ERC_TESTER::TestLibSymbolIssues()
|
||||
{
|
||||
wxCHECK( m_schematic, 0 );
|
||||
|
||||
SYMBOL_LIB_TABLE* libTable = m_schematic->Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &m_schematic->Prj() );
|
||||
wxString msg;
|
||||
int err_count = 0;
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <string_utils.h>
|
||||
#include <widgets/grid_combobox.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
|
||||
enum
|
||||
@ -215,8 +216,7 @@ void FIELDS_GRID_TABLE<T>::initGrid( WX_GRID* aGrid )
|
||||
m_footprintAttr->SetEditor( fpIdEditor );
|
||||
|
||||
m_urlAttr = new wxGridCellAttr;
|
||||
GRID_CELL_URL_EDITOR* urlEditor = new GRID_CELL_URL_EDITOR( m_dialog,
|
||||
m_frame->Prj().SchSearchS() );
|
||||
GRID_CELL_URL_EDITOR* urlEditor = new GRID_CELL_URL_EDITOR( m_dialog, PROJECT_SCH::SchSearchS( &m_frame->Prj() ) );
|
||||
urlEditor->SetValidator( m_urlValidator );
|
||||
m_urlAttr->SetEditor( urlEditor );
|
||||
|
||||
@ -906,7 +906,8 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
|
||||
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
||||
{
|
||||
wxString datasheet_uri = m_grid->GetCellValue( DATASHEET_FIELD, FDC_VALUE );
|
||||
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(), m_dlg->Prj().SchSearchS() );
|
||||
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(),
|
||||
PROJECT_SCH::SchSearchS( &m_dlg->Prj() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <core/profile.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project_rescue.h>
|
||||
#include <project_sch.h>
|
||||
#include <dialog_HTML_reporter_base.h>
|
||||
#include <reporter.h>
|
||||
#include <richio.h>
|
||||
@ -185,7 +186,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 );
|
||||
Prj().SchLibs();
|
||||
PROJECT_SCH::SchLibs( &Prj() );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -196,7 +197,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||
|
||||
// Load the symbol library table, this will be used forever more.
|
||||
Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
||||
Prj().SchSymbolLibTable();
|
||||
PROJECT_SCH::SchSymbolLibTable( &Prj() );
|
||||
|
||||
// Load project settings after schematic has been set up with the project link, since this will
|
||||
// update some of the needed schematic settings such as drawing defaults
|
||||
@ -392,7 +393,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 = Schematic().Prj().SchLibs();
|
||||
SYMBOL_LIBS* legacyLibs = PROJECT_SCH::SchLibs( &Schematic().Prj() );
|
||||
|
||||
if( legacyLibs->GetLibraryCount() == 0 )
|
||||
{
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <wx/wfstream.h>
|
||||
#include <xnode.h> // also nests: <wx/xml/xml.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <project_sch.h>
|
||||
|
||||
#include <symbol_lib_table.h>
|
||||
|
||||
@ -541,7 +542,7 @@ XNODE* NETLIST_EXPORTER_XML::makeDesignHeader()
|
||||
XNODE* NETLIST_EXPORTER_XML::makeLibraries()
|
||||
{
|
||||
XNODE* xlibs = node( wxT( "libraries" ) ); // auto_ptr
|
||||
SYMBOL_LIB_TABLE* symbolLibTable = m_schematic->Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* symbolLibTable = PROJECT_SCH::SchSymbolLibTable( &m_schematic->Prj() );
|
||||
|
||||
for( std::set<wxString>::iterator it = m_libraries.begin(); it!=m_libraries.end(); ++it )
|
||||
{
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <symbol_lib_table.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_actions.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
#include <dialog_choose_symbol.h>
|
||||
|
||||
@ -97,7 +98,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SYMBOL_LIBRARY_FILTER
|
||||
bool aAllowFields )
|
||||
{
|
||||
std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_SYMBOL::g_Mutex, std::defer_lock );
|
||||
SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* libs = PROJECT_SCH::SchSymbolLibTable( &Prj() );
|
||||
COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
|
||||
PROJECT_FILE& project = Prj().GetProjectFile();
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <kiway.h>
|
||||
#include <symbol_viewer_frame.h>
|
||||
#include <project_rescue.h>
|
||||
#include <project_sch.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_edit_frame.h>
|
||||
@ -37,6 +38,7 @@
|
||||
#include <string_utils.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
#include <cctype>
|
||||
#include <map>
|
||||
@ -159,13 +161,14 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||
|
||||
LIB_ID id( wxEmptyString, symbol_name );
|
||||
|
||||
case_sensitive_match = aRescuer.GetPrj()->SchLibs()->FindLibSymbol( id );
|
||||
case_sensitive_match = PROJECT_SCH::SchLibs( aRescuer.GetPrj() )->FindLibSymbol( id );
|
||||
|
||||
if( case_sensitive_match )
|
||||
continue;
|
||||
|
||||
// If the case sensitive match failed, try a case insensitive match.
|
||||
aRescuer.GetPrj()->SchLibs()->FindLibraryNearEntries( case_insensitive_matches,
|
||||
PROJECT_SCH::SchLibs( aRescuer.GetPrj() )
|
||||
->FindLibraryNearEntries( case_insensitive_matches,
|
||||
symbol_name );
|
||||
|
||||
// If there are not case insensitive matches either, the symbol cannot be rescued.
|
||||
@ -267,8 +270,8 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||
// 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, aRescuer.GetPrj()->SchLibs(), true );
|
||||
lib_match = findSymbol( symbol_name, aRescuer.GetPrj()->SchLibs(), false );
|
||||
cache_match = findSymbol( symbol_name, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), true );
|
||||
lib_match = findSymbol( symbol_name, PROJECT_SCH::SchLibs( 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
|
||||
@ -279,7 +282,7 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||
|
||||
tmp = eachSymbol->GetLibId().GetLibNickname().wx_str() + wxT( "_" ) +
|
||||
eachSymbol->GetLibId().GetLibItemName().wx_str();
|
||||
cache_match = findSymbol( tmp, aRescuer.GetPrj()->SchLibs(), true );
|
||||
cache_match = findSymbol( tmp, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), true );
|
||||
}
|
||||
|
||||
// Test whether there is a conflict or if the symbol can only be found in the cache
|
||||
@ -410,7 +413,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
||||
|
||||
// Get the library symbol from the cache library. It will be a flattened
|
||||
// symbol by default (no inheritance).
|
||||
cache_match = findSymbol( symbolName, aRescuer.GetPrj()->SchLibs(), true );
|
||||
cache_match = findSymbol( symbolName, PROJECT_SCH::SchLibs( 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
|
||||
@ -419,11 +422,11 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
||||
{
|
||||
symbolName = symbol_id.GetLibNickname().wx_str() + wxT( "_" ) +
|
||||
symbol_id.GetLibItemName().wx_str();
|
||||
cache_match = findSymbol( symbolName, aRescuer.GetPrj()->SchLibs(), true );
|
||||
cache_match = findSymbol( symbolName, PROJECT_SCH::SchLibs( aRescuer.GetPrj() ), true );
|
||||
}
|
||||
|
||||
// Get the library symbol from the symbol library table.
|
||||
lib_match = SchGetLibSymbol( symbol_id, aRescuer.GetPrj()->SchSymbolLibTable() );
|
||||
lib_match = SchGetLibSymbol( symbol_id, PROJECT_SCH::SchSymbolLibTable( aRescuer.GetPrj() ) );
|
||||
|
||||
if( !cache_match && !lib_match )
|
||||
continue;
|
||||
@ -687,7 +690,7 @@ void LEGACY_RESCUER::OpenRescueLibrary()
|
||||
|
||||
// If a rescue library already exists copy the contents of that library so we do not
|
||||
// lose any previous rescues.
|
||||
SYMBOL_LIB* rescueLib = m_prj->SchLibs()->FindLibrary( fn.GetName() );
|
||||
SYMBOL_LIB* rescueLib = PROJECT_SCH::SchLibs( m_prj )->FindLibrary( fn.GetName() );
|
||||
|
||||
if( rescueLib )
|
||||
{
|
||||
@ -823,7 +826,7 @@ void SYMBOL_LIB_TABLE_RESCUER::OpenRescueLibrary()
|
||||
|
||||
wxFileName fn = GetRescueLibraryFileName( m_schematic );
|
||||
|
||||
SYMBOL_LIB_TABLE_ROW* row = m_prj->SchSymbolLibTable()->FindRow( fn.GetName() );
|
||||
SYMBOL_LIB_TABLE_ROW* row = PROJECT_SCH::SchSymbolLibTable( m_prj )->FindRow( fn.GetName() );
|
||||
|
||||
// If a rescue library already exists copy the contents of that library so we do not
|
||||
// lose any previous rescues.
|
||||
@ -836,7 +839,7 @@ void SYMBOL_LIB_TABLE_RESCUER::OpenRescueLibrary()
|
||||
|
||||
try
|
||||
{
|
||||
m_prj->SchSymbolLibTable()->LoadSymbolLib( symbols, fn.GetName() );
|
||||
PROJECT_SCH::SchSymbolLibTable( m_prj )->LoadSymbolLib( symbols, fn.GetName() );
|
||||
}
|
||||
catch( ... /* IO_ERROR */ )
|
||||
{
|
||||
@ -853,7 +856,7 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
||||
{
|
||||
wxString msg;
|
||||
wxFileName fn = GetRescueLibraryFileName( m_schematic );
|
||||
SYMBOL_LIB_TABLE_ROW* row = m_prj->SchSymbolLibTable()->FindRow( fn.GetName() );
|
||||
SYMBOL_LIB_TABLE_ROW* row = PROJECT_SCH::SchSymbolLibTable( m_prj )->FindRow( fn.GetName() );
|
||||
|
||||
fn.SetExt( KiCadSymbolLibFileExtension );
|
||||
|
||||
@ -881,13 +884,13 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
||||
wxString libNickname = fn.GetName();
|
||||
|
||||
row = new SYMBOL_LIB_TABLE_ROW( libNickname, uri, wxT( "KiCad" ) );
|
||||
m_prj->SchSymbolLibTable()->InsertRow( row, true );
|
||||
PROJECT_SCH::SchSymbolLibTable( m_prj )->InsertRow( row, true );
|
||||
|
||||
fn = wxFileName( m_prj->GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
||||
|
||||
try
|
||||
{
|
||||
m_prj->SchSymbolLibTable()->Save( fn.GetFullPath() );
|
||||
PROJECT_SCH::SchSymbolLibTable( m_prj )->Save( fn.GetFullPath() );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
@ -900,7 +903,7 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
||||
m_prj->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
||||
|
||||
// This can only happen if the symbol library table file was corrupted on write.
|
||||
if( !m_prj->SchSymbolLibTable() )
|
||||
if( !PROJECT_SCH::SchSymbolLibTable( m_prj ) )
|
||||
return false;
|
||||
|
||||
// Update the schematic symbol library links since the library list has changed.
|
||||
|
@ -24,7 +24,10 @@
|
||||
#include <pgm_base.h>
|
||||
#include <wx/app.h>
|
||||
#include <core/utf8.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
static std::mutex s_symbolTableMutex;
|
||||
|
||||
// non-member so it can be moved easily, and kept REALLY private.
|
||||
// Do NOT Clear() in here.
|
||||
@ -35,28 +38,28 @@ static void add_search_paths( SEARCH_STACK* aDst, const SEARCH_STACK& aSrc, int
|
||||
}
|
||||
|
||||
|
||||
SEARCH_STACK* PROJECT::SchSearchS()
|
||||
SEARCH_STACK* PROJECT_SCH::SchSearchS( PROJECT* aProject )
|
||||
{
|
||||
SEARCH_STACK* ss = (SEARCH_STACK*) GetElem( PROJECT::ELEM_SCH_SEARCH_STACK );
|
||||
SEARCH_STACK* ss = (SEARCH_STACK*) aProject->GetElem( PROJECT::ELEM_SCH_SEARCH_STACK );
|
||||
|
||||
wxASSERT( !ss || dynamic_cast<SEARCH_STACK*>( GetElem( PROJECT::ELEM_SCH_SEARCH_STACK ) ) );
|
||||
wxASSERT( !ss || dynamic_cast<SEARCH_STACK*>( aProject->GetElem( PROJECT::ELEM_SCH_SEARCH_STACK ) ) );
|
||||
|
||||
if( !ss )
|
||||
{
|
||||
ss = new SEARCH_STACK();
|
||||
|
||||
// Make PROJECT the new SEARCH_STACK owner.
|
||||
SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, ss );
|
||||
aProject->SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, ss );
|
||||
|
||||
// to the empty SEARCH_STACK for SchSearchS(), add project dir as first
|
||||
ss->AddPaths( m_project_name.GetPath() );
|
||||
ss->AddPaths( aProject->GetProjectDirectory() );
|
||||
|
||||
// next add the paths found in *.pro, variable "LibDir"
|
||||
wxString libDir;
|
||||
|
||||
try
|
||||
{
|
||||
SYMBOL_LIBS::GetLibNamesAndPaths( this, &libDir );
|
||||
SYMBOL_LIBS::GetLibNamesAndPaths( aProject, &libDir );
|
||||
}
|
||||
catch( const IO_ERROR& )
|
||||
{
|
||||
@ -70,7 +73,7 @@ SEARCH_STACK* PROJECT::SchSearchS()
|
||||
|
||||
for( unsigned i =0; i<paths.GetCount(); ++i )
|
||||
{
|
||||
wxString path = AbsolutePath( paths[i] );
|
||||
wxString path = aProject->AbsolutePath( paths[i] );
|
||||
|
||||
ss->AddPaths( path ); // at the end
|
||||
}
|
||||
@ -84,9 +87,9 @@ SEARCH_STACK* PROJECT::SchSearchS()
|
||||
}
|
||||
|
||||
|
||||
SYMBOL_LIBS* PROJECT::SchLibs()
|
||||
SYMBOL_LIBS* PROJECT_SCH::SchLibs( PROJECT* aProject )
|
||||
{
|
||||
SYMBOL_LIBS* libs = (SYMBOL_LIBS*) GetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS );
|
||||
SYMBOL_LIBS* libs = (SYMBOL_LIBS*) aProject->GetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS );
|
||||
|
||||
wxASSERT( !libs || libs->Type() == SYMBOL_LIBS_T );
|
||||
|
||||
@ -95,11 +98,11 @@ SYMBOL_LIBS* PROJECT::SchLibs()
|
||||
libs = new SYMBOL_LIBS();
|
||||
|
||||
// Make PROJECT the new SYMBOL_LIBS owner.
|
||||
SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, libs );
|
||||
aProject->SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, libs );
|
||||
|
||||
try
|
||||
{
|
||||
libs->LoadAllLibraries( this );
|
||||
libs->LoadAllLibraries( aProject );
|
||||
}
|
||||
catch( const PARSE_ERROR& pe )
|
||||
{
|
||||
@ -125,3 +128,48 @@ SYMBOL_LIBS* PROJECT::SchLibs()
|
||||
|
||||
return libs;
|
||||
}
|
||||
|
||||
|
||||
SYMBOL_LIB_TABLE* PROJECT_SCH::SchSymbolLibTable( PROJECT* aProject )
|
||||
{
|
||||
std::lock_guard<std::mutex> lock( s_symbolTableMutex );
|
||||
|
||||
// This is a lazy loading function, it loads the project specific table when
|
||||
// that table is asked for, not before.
|
||||
SYMBOL_LIB_TABLE* tbl = (SYMBOL_LIB_TABLE*) aProject->GetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE );
|
||||
|
||||
// its gotta be NULL or a SYMBOL_LIB_TABLE, or a bug.
|
||||
wxASSERT( !tbl || tbl->Type() == SYMBOL_LIB_TABLE_T );
|
||||
|
||||
if( !tbl )
|
||||
{
|
||||
// Stack the project specific SYMBOL_LIB_TABLE overlay on top of the global table.
|
||||
// ~SYMBOL_LIB_TABLE() will not touch the fallback table, so multiple projects may
|
||||
// stack this way, all using the same global fallback table.
|
||||
tbl = new SYMBOL_LIB_TABLE( &SYMBOL_LIB_TABLE::GetGlobalLibTable() );
|
||||
|
||||
aProject->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, tbl );
|
||||
|
||||
wxString prjPath;
|
||||
|
||||
wxGetEnv( PROJECT_VAR_NAME, &prjPath );
|
||||
|
||||
if( !prjPath.IsEmpty() )
|
||||
{
|
||||
wxFileName fn( prjPath, SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
||||
|
||||
try
|
||||
{
|
||||
tbl->Load( fn.GetFullPath() );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Error loading the symbol library table '%s'." ), fn.GetFullPath() );
|
||||
DisplayErrorMessage( nullptr, msg, ioe.What() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tbl;
|
||||
}
|
45
eeschema/project_sch.h
Normal file
45
eeschema/project_sch.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014-2022 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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class SYMBOL_LIB_TABLE;
|
||||
class PROJECT;
|
||||
class SEARCH_STACK;
|
||||
class SYMBOL_LIBS;
|
||||
|
||||
class PROJECT_SCH
|
||||
{
|
||||
public:
|
||||
// These are all prefaced with "Sch"
|
||||
static SYMBOL_LIBS* SchLibs( PROJECT* aProject );
|
||||
|
||||
/// Accessor for Eeschema search stack.
|
||||
static SEARCH_STACK* SchSearchS( PROJECT* aProject );
|
||||
|
||||
/// Accessor for project symbol library table.
|
||||
static SYMBOL_LIB_TABLE* SchSymbolLibTable( PROJECT* aProject );
|
||||
|
||||
private:
|
||||
PROJECT_SCH() {}
|
||||
};
|
@ -38,6 +38,7 @@
|
||||
#include <settings/settings_manager.h>
|
||||
#include <confirm.h>
|
||||
#include <preview_items/selection_area.h>
|
||||
#include <project_sch.h>
|
||||
#include <symbol_library.h>
|
||||
#include <sch_base_frame.h>
|
||||
#include <symbol_lib_table.h>
|
||||
@ -203,9 +204,10 @@ void SCH_BASE_FRAME::UpdateStatusBar()
|
||||
LIB_SYMBOL* SCH_BASE_FRAME::GetLibSymbol( const LIB_ID& aLibId, bool aUseCacheLib,
|
||||
bool aShowErrorMsg )
|
||||
{
|
||||
SYMBOL_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : nullptr;
|
||||
SYMBOL_LIB* cache =
|
||||
( aUseCacheLib ) ? PROJECT_SCH::SchLibs( &Prj() )->GetCacheLibrary() : nullptr;
|
||||
|
||||
return SchGetLibSymbol( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
|
||||
return SchGetLibSymbol( aLibId, PROJECT_SCH::SchSymbolLibTable( &Prj() ), cache, this, aShowErrorMsg );
|
||||
}
|
||||
|
||||
|
||||
@ -234,7 +236,7 @@ bool SCH_BASE_FRAME::saveSymbolLibTables( bool aGlobal, bool aProject )
|
||||
|
||||
try
|
||||
{
|
||||
Prj().SchSymbolLibTable()->Save( fn.GetFullPath() );
|
||||
PROJECT_SCH::SchSymbolLibTable( &Prj() )->Save( fn.GetFullPath() );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
@ -287,7 +289,7 @@ SYMBOL_LIB_TABLE* SCH_BASE_FRAME::SelectSymLibTable( bool aOptional )
|
||||
switch( dlg.GetSelection() )
|
||||
{
|
||||
case 0: return &SYMBOL_LIB_TABLE::GetGlobalLibTable();
|
||||
case 1: return Prj().SchSymbolLibTable();
|
||||
case 1: return PROJECT_SCH::SchSymbolLibTable( &Prj() );
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
@ -554,7 +556,7 @@ wxString SCH_BASE_FRAME::SelectLibraryFromList()
|
||||
COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
|
||||
PROJECT& prj = Prj();
|
||||
|
||||
if( prj.SchSymbolLibTable()->IsEmpty() )
|
||||
if( PROJECT_SCH::SchSymbolLibTable( &prj )->IsEmpty() )
|
||||
{
|
||||
ShowInfoBarError( _( "No symbol libraries are loaded." ) );
|
||||
return wxEmptyString;
|
||||
@ -565,12 +567,12 @@ wxString SCH_BASE_FRAME::SelectLibraryFromList()
|
||||
headers.Add( _( "Library" ) );
|
||||
|
||||
std::vector< wxArrayString > itemsToDisplay;
|
||||
std::vector< wxString > libNicknames = prj.SchSymbolLibTable()->GetLogicalLibs();
|
||||
std::vector< wxString > libNicknames = PROJECT_SCH::SchSymbolLibTable( &prj )->GetLogicalLibs();
|
||||
|
||||
for( const wxString& name : libNicknames )
|
||||
{
|
||||
// Exclude read only libraries.
|
||||
if( !prj.SchSymbolLibTable()->IsSymbolLibWritable( name ) )
|
||||
if( !PROJECT_SCH::SchSymbolLibTable( &prj )->IsSymbolLibWritable( name ) )
|
||||
continue;
|
||||
|
||||
if( alg::contains( prj.GetProjectFile().m_PinnedSymbolLibs, name )
|
||||
@ -586,7 +588,7 @@ wxString SCH_BASE_FRAME::SelectLibraryFromList()
|
||||
for( const wxString& name : libNicknames )
|
||||
{
|
||||
// Exclude read only libraries.
|
||||
if( !prj.SchSymbolLibTable()->IsSymbolLibWritable( name ) )
|
||||
if( !PROJECT_SCH::SchSymbolLibTable( &prj )->IsSymbolLibWritable( name ) )
|
||||
continue;
|
||||
|
||||
if( !alg::contains( prj.GetProjectFile().m_PinnedSymbolLibs, name )
|
||||
@ -611,7 +613,7 @@ wxString SCH_BASE_FRAME::SelectLibraryFromList()
|
||||
|
||||
if( !libName.empty() )
|
||||
{
|
||||
if( prj.SchSymbolLibTable()->HasLibrary( libName ) )
|
||||
if( PROJECT_SCH::SchSymbolLibTable( &prj )->HasLibrary( libName ) )
|
||||
prj.SetRString( PROJECT::SCH_LIB_SELECT, libName );
|
||||
else
|
||||
libName = wxEmptyString;
|
||||
@ -634,7 +636,7 @@ void SCH_BASE_FRAME::setSymWatcher( const LIB_ID* aID )
|
||||
}
|
||||
|
||||
wxString libfullname;
|
||||
SYMBOL_LIB_TABLE* tbl = Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* tbl = PROJECT_SCH::SchSymbolLibTable( &Prj() );
|
||||
|
||||
if( !aID || !tbl )
|
||||
return;
|
||||
@ -683,7 +685,7 @@ void SCH_BASE_FRAME::setSymWatcher( const LIB_ID* aID )
|
||||
|
||||
void SCH_BASE_FRAME::OnSymChange( wxFileSystemWatcherEvent& aEvent )
|
||||
{
|
||||
SYMBOL_LIBS* libs = Prj().SchLibs();
|
||||
SYMBOL_LIBS* libs = PROJECT_SCH::SchLibs( &Prj() );
|
||||
|
||||
wxLogTrace( "KICAD_LIB_WATCH", "OnSymChange: %s, watcher file: %s",
|
||||
aEvent.GetPath().GetFullPath(), m_watcherFileName.GetFullPath() );
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <sch_plugins/altium/sch_altium_plugin.h>
|
||||
|
||||
#include <schematic.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
#include <lib_shape.h>
|
||||
#include <lib_id.h>
|
||||
@ -328,7 +329,7 @@ SCH_SHEET* SCH_ALTIUM_PLUGIN::LoadSchematicFile( const wxString& aFileName, SCHE
|
||||
const_cast<KIID&>( m_rootSheet->m_Uuid ) = screen->GetUuid();
|
||||
}
|
||||
|
||||
SYMBOL_LIB_TABLE* libTable = m_schematic->Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &m_schematic->Prj() );
|
||||
|
||||
wxCHECK_MSG( libTable, nullptr, "Could not load symbol lib table." );
|
||||
|
||||
@ -358,7 +359,7 @@ SCH_SHEET* SCH_ALTIUM_PLUGIN::LoadSchematicFile( const wxString& aFileName, SCHE
|
||||
|
||||
// Reload the symbol library table.
|
||||
m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
||||
m_schematic->Prj().SchSymbolLibTable();
|
||||
PROJECT_SCH::SchSymbolLibTable( &m_schematic->Prj() );
|
||||
}
|
||||
|
||||
m_sheetPath.push_back( m_rootSheet );
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include <lib_symbol.h>
|
||||
#include <progress_reporter.h>
|
||||
#include <project_sch.h>
|
||||
#include <string_utf8_map.h>
|
||||
#include <sch_screen.h>
|
||||
#include <sch_sheet.h>
|
||||
@ -83,7 +84,7 @@ SCH_SHEET* CADSTAR_SCH_ARCHIVE_PLUGIN::LoadSchematicFile( const wxString&
|
||||
csaLoader.Load( aSchematic, rootSheet );
|
||||
|
||||
// SAVE SYMBOLS TO PROJECT LIBRARY:
|
||||
SYMBOL_LIB_TABLE* libTable = aSchematic->Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() );
|
||||
|
||||
wxCHECK_MSG( libTable, nullptr, "Could not load symbol lib table." );
|
||||
|
||||
@ -129,7 +130,7 @@ SCH_SHEET* CADSTAR_SCH_ARCHIVE_PLUGIN::LoadSchematicFile( const wxString&
|
||||
|
||||
// Relaod the symbol library table.
|
||||
aSchematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
|
||||
aSchematic->Prj().SchSymbolLibTable();
|
||||
PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() );
|
||||
}
|
||||
|
||||
// set properties to prevent save file on every symbol save
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <lib_pin.h>
|
||||
#include <lib_text.h>
|
||||
#include <project.h>
|
||||
#include <project_sch.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <project/net_settings.h>
|
||||
@ -469,7 +470,7 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::LoadSchematicFile( const wxString& aFileName, SCHEM
|
||||
const_cast<KIID&>( m_rootSheet->m_Uuid ) = screen->GetUuid();
|
||||
}
|
||||
|
||||
SYMBOL_LIB_TABLE* libTable = m_schematic->Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &m_schematic->Prj() );
|
||||
|
||||
wxCHECK_MSG( libTable, nullptr, wxT( "Could not load symbol lib table." ) );
|
||||
|
||||
@ -501,7 +502,7 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::LoadSchematicFile( const wxString& aFileName, SCHEM
|
||||
|
||||
// Reload the symbol library table.
|
||||
m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
||||
m_schematic->Prj().SchSymbolLibTable();
|
||||
PROJECT_SCH::SchSymbolLibTable( &m_schematic->Prj() );
|
||||
}
|
||||
|
||||
// Retrieve the root as current node
|
||||
@ -1826,7 +1827,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
||||
symbol->AddHierarchicalReference( m_sheetPath.Path(), reference, unit );
|
||||
|
||||
// Save the pin positions
|
||||
SYMBOL_LIB_TABLE& schLibTable = *m_schematic->Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE& schLibTable = *PROJECT_SCH::SchSymbolLibTable( &m_schematic->Prj() );
|
||||
LIB_SYMBOL* libSymbol = schLibTable.LoadSymbol( symbol->GetLibId() );
|
||||
|
||||
wxCHECK( libSymbol, /*void*/ );
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_screen.h>
|
||||
#include <kiplatform/environment.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
#include <wx/log.h>
|
||||
#include <wx/stdstream.h>
|
||||
@ -573,7 +574,7 @@ SCH_SHEET* SCH_EASYEDA_PLUGIN::LoadSchematicFile( const wxString& aFileName, SCH
|
||||
rootSheet->SetScreen( screen );
|
||||
}
|
||||
|
||||
SYMBOL_LIB_TABLE* libTable = aSchematic->Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() );
|
||||
|
||||
wxCHECK_MSG( libTable, nullptr, wxS( "Could not load symbol lib table." ) );
|
||||
LoadSchematic( aSchematic, rootSheet, aFileName );
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
|
||||
#include <plugins/easyedapro/easyedapro_import_utils.h>
|
||||
#include <core/map_helpers.h>
|
||||
#include <project_sch.h>
|
||||
|
||||
|
||||
struct SCH_EASYEDAPRO_PLUGIN::PRJ_DATA
|
||||
@ -400,7 +401,7 @@ SCH_SHEET* SCH_EASYEDAPRO_PLUGIN::LoadSchematicFile( const wxString& aFileName,
|
||||
rootSheet->SetScreen( screen );
|
||||
}
|
||||
|
||||
SYMBOL_LIB_TABLE* libTable = aSchematic->Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() );
|
||||
wxCHECK_MSG( libTable, nullptr, wxS( "Could not load symbol lib table." ) );
|
||||
|
||||
SCH_EASYEDAPRO_PARSER parser( nullptr, nullptr );
|
||||
@ -546,7 +547,7 @@ SCH_SHEET* SCH_EASYEDAPRO_PLUGIN::LoadSchematicFile( const wxString& aFileName,
|
||||
|
||||
// Relaod the symbol library table.
|
||||
aSchematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
|
||||
aSchematic->Prj().SchSymbolLibTable();
|
||||
PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() );
|
||||
}
|
||||
|
||||
// set properties to prevent save file on every symbol save
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <sch_plugins/ltspice/ltspice_sch_plugin.h>
|
||||
#include <sch_plugins/ltspice/ltspice_sch_parser.h>
|
||||
|
||||
#include <project_sch.h>
|
||||
#include <schematic.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_screen.h>
|
||||
@ -72,10 +73,10 @@ SCH_SHEET* SCH_LTSPICE_PLUGIN::LoadSchematicFile( const wxString& aFileName, SCH
|
||||
rootSheet->SetScreen( screen );
|
||||
}
|
||||
|
||||
SYMBOL_LIB_TABLE* libTable = aSchematic->Prj().SchSymbolLibTable();
|
||||
SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() );
|
||||
|
||||
wxCHECK_MSG( libTable, nullptr, "Could not load symbol lib table." );
|
||||
|
||||
|
||||
// Windows path: C:\Users\USERNAME\AppData\Local\LTspice\lib
|
||||
wxFileName ltspiceDataDir( KIPLATFORM::ENV::GetUserLocalDataPath(), wxEmptyString );
|
||||
ltspiceDataDir.AppendDir( wxS( "LTspice" ) );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user