Eliminate the conditional pcbnew/cvpcb definition of PROJECT

This commit is contained in:
Marek Roszko 2023-09-27 20:53:46 -04:00
parent 017dafc8e3
commit 7e8b18035f
33 changed files with 292 additions and 197 deletions

View File

@ -61,7 +61,6 @@
#define MASK_3D_CACHE "3D_CACHE" #define MASK_3D_CACHE "3D_CACHE"
static std::mutex mutex3D_cache; static std::mutex mutex3D_cache;
static std::mutex mutex3D_cacheManager;
static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB ) noexcept static bool isSHA1Same( const unsigned char* shaA, const unsigned char* shaB ) noexcept
@ -698,62 +697,3 @@ void S3D_CACHE::CleanCacheDir( int aNumDaysOld )
} }
} }
} }
void PROJECT::Cleanup3DCache()
{
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
// Get the existing cache from the project
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( GetElem( ELEM_3DCACHE ) );
if( cache )
{
// We'll delete ".3dc" cache files older than this many days
int clearCacheInterval = 0;
if( Pgm().GetCommonSettings() )
clearCacheInterval = Pgm().GetCommonSettings()->m_System.clear_3d_cache_interval;
// An interval of zero means the user doesn't want to ever clear the cache
if( clearCacheInterval > 0 )
cache->CleanCacheDir( clearCacheInterval );
}
}
S3D_CACHE* PROJECT::Get3DCacheManager( bool aUpdateProjDir )
{
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
// Get the existing cache from the project
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( GetElem( ELEM_3DCACHE ) );
if( !cache )
{
// Create a cache if there is not one already
cache = new S3D_CACHE();
wxFileName cfgpath;
cfgpath.AssignDir( PATHS::GetUserSettingsPath() );
cfgpath.AppendDir( wxT( "3d" ) );
cache->SetProgramBase( &Pgm() );
cache->Set3DConfigDir( cfgpath.GetFullPath() );
SetElem( ELEM_3DCACHE, cache );
aUpdateProjDir = true;
}
if( aUpdateProjDir )
cache->SetProject( this );
return cache;
}
FILENAME_RESOLVER* PROJECT::Get3DFilenameResolver()
{
return Get3DCacheManager()->GetResolver();
}

View File

@ -33,6 +33,7 @@
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility #include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <eda_3d_viewer_frame.h> #include <eda_3d_viewer_frame.h>
#include <project_pcbnew.h>
void RENDER_3D_OPENGL::addObjectTriangles( const FILLED_CIRCLE_2D* aCircle, void RENDER_3D_OPENGL::addObjectTriangles( const FILLED_CIRCLE_2D* aCircle,
@ -936,8 +937,8 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
{ {
// FindRow() can throw an exception // FindRow() can throw an exception
const FP_LIB_TABLE_ROW* fpRow = const FP_LIB_TABLE_ROW* fpRow =
m_boardAdapter.GetBoard()->GetProject()->PcbFootprintLibs()->FindRow( PROJECT_PCBNEW::PcbFootprintLibs( m_boardAdapter.GetBoard()->GetProject() )
libraryName, false ); ->FindRow( libraryName, false );
if( fpRow ) if( fpRow )
footprintBasePath = fpRow->GetFullURI( true ); footprintBasePath = fpRow->GetFullURI( true );

View File

@ -42,6 +42,7 @@
#include <footprint.h> #include <footprint.h>
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <eda_3d_viewer_frame.h> #include <eda_3d_viewer_frame.h>
#include <project_pcbnew.h>
#include <base_units.h> #include <base_units.h>
#include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility #include <core/profile.h> // To use GetRunningMicroSecs or another profiling utility
@ -1258,8 +1259,8 @@ void RENDER_3D_RAYTRACE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMa
{ {
// FindRow() can throw an exception // FindRow() can throw an exception
const FP_LIB_TABLE_ROW* fpRow = const FP_LIB_TABLE_ROW* fpRow =
m_boardAdapter.GetBoard()->GetProject()->PcbFootprintLibs()->FindRow( PROJECT_PCBNEW::PcbFootprintLibs( m_boardAdapter.GetBoard()->GetProject() )
libraryName, false ); ->FindRow( libraryName, false );
if( fpRow ) if( fpRow )
footprintBasePath = fpRow->GetFullURI( true ); footprintBasePath = fpRow->GetFullURI( true );

View File

@ -56,6 +56,7 @@
#include <widgets/wx_infobar.h> #include <widgets/wx_infobar.h>
#include <widgets/wx_aui_utils.h> #include <widgets/wx_aui_utils.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <project_pcbnew.h>
#include <3d_navlib/nl_3d_viewer_plugin.h> #include <3d_navlib/nl_3d_viewer_plugin.h>
@ -116,7 +117,8 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
ANTIALIASING_MODE aaMode = static_cast<ANTIALIASING_MODE>( cfg->m_Render.opengl_AA_mode ); ANTIALIASING_MODE aaMode = static_cast<ANTIALIASING_MODE>( cfg->m_Render.opengl_AA_mode );
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode ), m_boardAdapter, m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode ), m_boardAdapter,
m_currentCamera, Prj().Get3DCacheManager() ); m_currentCamera,
PROJECT_PCBNEW::Get3DCacheManager( &Prj() ) );
m_appearancePanel = new APPEARANCE_CONTROLS_3D( this, GetCanvas() ); m_appearancePanel = new APPEARANCE_CONTROLS_3D( this, GetCanvas() );
@ -391,14 +393,14 @@ void EDA_3D_VIEWER_FRAME::ReloadRequest()
// This will schedule a request to load later // This will schedule a request to load later
if( m_canvas ) if( m_canvas )
m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() ); m_canvas->ReloadRequest( GetBoard(), PROJECT_PCBNEW::Get3DCacheManager( &Prj() ) );
} }
void EDA_3D_VIEWER_FRAME::NewDisplay( bool aForceImmediateRedraw ) void EDA_3D_VIEWER_FRAME::NewDisplay( bool aForceImmediateRedraw )
{ {
if( m_canvas ) if( m_canvas )
m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() ); m_canvas->ReloadRequest( GetBoard(), PROJECT_PCBNEW::Get3DCacheManager( &Prj() ) );
// After the ReloadRequest call, the refresh often takes a bit of time, // After the ReloadRequest call, the refresh often takes a bit of time,
// and it is made here only on request. // and it is made here only on request.

View File

@ -37,6 +37,7 @@
#include <common_ogl/ogl_attr_list.h> #include <common_ogl/ogl_attr_list.h>
#include <dpi_scaling_common.h> #include <dpi_scaling_common.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <project_pcbnew.h>
#include <settings/common_settings.h> #include <settings/common_settings.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <widgets/wx_infobar.h> #include <widgets/wx_infobar.h>
@ -122,8 +123,7 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
// Create the 3D canvas // Create the 3D canvas
m_previewPane = new EDA_3D_CANVAS( this, m_previewPane = new EDA_3D_CANVAS( this,
OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ), OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ),
m_boardAdapter, m_currentCamera, m_boardAdapter, m_currentCamera, PROJECT_PCBNEW::Get3DCacheManager( &aFrame->Prj() ) );
aFrame->Prj().Get3DCacheManager() );
m_boardAdapter.SetBoard( m_dummyBoard ); m_boardAdapter.SetBoard( m_dummyBoard );
m_boardAdapter.m_IsBoardView = false; m_boardAdapter.m_IsBoardView = false;

View File

@ -652,6 +652,7 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/pcb_field.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_field.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_text.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_text.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_textbox.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_textbox.cpp
${CMAKE_SOURCE_DIR}/pcbnew/project_pcbnew.cpp
${CMAKE_SOURCE_DIR}/pcbnew/board_stackup_manager/board_stackup.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_stackup_manager/board_stackup.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_track.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_track.cpp
${CMAKE_SOURCE_DIR}/pcbnew/zone.cpp ${CMAKE_SOURCE_DIR}/pcbnew/zone.cpp

View File

@ -54,6 +54,7 @@
#include <tools/cvpcb_actions.h> #include <tools/cvpcb_actions.h>
#include <tools/cvpcb_association_tool.h> #include <tools/cvpcb_association_tool.h>
#include <tools/cvpcb_control.h> #include <tools/cvpcb_control.h>
#include <project_pcbnew.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -862,7 +863,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
} }
// Extract the library information // Extract the library information
FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* fptbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
if( fptbl->HasLibrary( lib ) ) if( fptbl->HasLibrary( lib ) )
msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) ); msg = wxString::Format( _( "Library location: %s" ), fptbl->GetFullURI( lib ) );
@ -875,7 +876,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
bool CVPCB_MAINFRAME::LoadFootprintFiles() bool CVPCB_MAINFRAME::LoadFootprintFiles()
{ {
FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* fptbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
// Check if there are footprint libraries in the footprint library table. // Check if there are footprint libraries in the footprint library table.
if( !fptbl || !fptbl->GetLogicalLibs().size() ) if( !fptbl || !fptbl->GetLogicalLibs().size() )
@ -982,7 +983,7 @@ void CVPCB_MAINFRAME::BuildLibrariesList()
{ {
COMMON_SETTINGS* cfg = Pgm().GetCommonSettings(); COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
PROJECT_FILE& project = Kiway().Prj().GetProjectFile(); PROJECT_FILE& project = Kiway().Prj().GetProjectFile();
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
std::set<wxString> pinnedMatches; std::set<wxString> pinnedMatches;
std::set<wxString> otherMatches; std::set<wxString> otherMatches;
m_librariesListBox->ClearList(); m_librariesListBox->ClearList();

View File

@ -57,7 +57,7 @@
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/debug.h> #include <wx/debug.h>
#include <cvpcb_id.h> #include <cvpcb_id.h>
#include <project_pcbnew.h>
BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow ) EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
@ -412,7 +412,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
wxString libNickname = From_UTF8( fpid.GetLibNickname().c_str() ); wxString libNickname = From_UTF8( fpid.GetLibNickname().c_str() );
wxString fpName = From_UTF8( fpid.GetLibItemName().c_str() ); wxString fpName = From_UTF8( fpid.GetLibItemName().c_str() );
FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs(); FP_LIB_TABLE* fpTable = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
wxASSERT( fpTable ); wxASSERT( fpTable );
// See if the library requested is in the library table // See if the library requested is in the library table

View File

@ -32,6 +32,7 @@
#include <cvpcb_mainframe.h> #include <cvpcb_mainframe.h>
#include <fp_conflict_assignment_selector.h> #include <fp_conflict_assignment_selector.h>
#include <project_pcbnew.h>
/** /**
@ -134,7 +135,7 @@ bool CVPCB_MAINFRAME::readNetListAndFpFiles( const std::string& aNetlist )
if( component->GetFPID().IsLegacy() ) if( component->GetFPID().IsLegacy() )
{ {
// get this first here, it's possibly obsoleted if we get it too soon. // get this first here, it's possibly obsoleted if we get it too soon.
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
int guess = guessNickname( tbl, (LIB_ID*) &component->GetFPID() ); int guess = guessNickname( tbl, (LIB_ID*) &component->GetFPID() );

View File

@ -276,27 +276,6 @@ public:
// non-virtuals resident in PCBNEW link image(s). By being non-virtual, these // non-virtuals resident in PCBNEW link image(s). By being non-virtual, these
// functions can get linked into the KIFACE that needs them, and only there. // functions can get linked into the KIFACE that needs them, and only there.
// In fact, the other KIFACEs don't even know they exist. // In fact, the other KIFACEs don't even know they exist.
#if defined( PCBNEW ) || defined( CVPCB )
/**
* Return the table of footprint libraries without Kiway, only from within Pcbnew.
*/
FP_LIB_TABLE* PcbFootprintLibs();
/**
* Return a pointer to an instance of the 3D cache manager.
*
* An instance is created and initialized if appropriate.
*
* @return a pointer to an instance of the 3D cache manager or NULL on failure.
*/
S3D_CACHE* Get3DCacheManager( bool updateProjDir = false );
void Cleanup3DCache();
/// Accessor for 3D path resolver
FILENAME_RESOLVER* Get3DFilenameResolver();
#endif
#if defined( EESCHEMA ) #if defined( EESCHEMA )
// These are all prefaced with "Sch" // These are all prefaced with "Sch"

View File

@ -28,6 +28,7 @@
#include <kiface_base.h> #include <kiface_base.h>
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <footprint.h> #include <footprint.h>
#include <project_pcbnew.h>
DIALOG_FOOTPRINT_ASSOCIATIONS::DIALOG_FOOTPRINT_ASSOCIATIONS( PCB_BASE_FRAME* aFrame, DIALOG_FOOTPRINT_ASSOCIATIONS::DIALOG_FOOTPRINT_ASSOCIATIONS( PCB_BASE_FRAME* aFrame,
@ -57,7 +58,7 @@ bool DIALOG_FOOTPRINT_ASSOCIATIONS::TransferDataToWindow()
wxString fpDesc; wxString fpDesc;
PROJECT* project = m_footprint->GetBoard()->GetProject(); PROJECT* project = m_footprint->GetBoard()->GetProject();
FP_LIB_TABLE* libTable = project->PcbFootprintLibs(); FP_LIB_TABLE* libTable = PROJECT_PCBNEW::PcbFootprintLibs( project );
const LIB_TABLE_ROW* libTableRow = nullptr; const LIB_TABLE_ROW* libTableRow = nullptr;
try try

View File

@ -35,6 +35,7 @@
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <pcbnew_settings.h> #include <pcbnew_settings.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <project_pcbnew.h>
#include <kiplatform/ui.h> #include <kiplatform/ui.h>
#include <widgets/grid_text_button_helpers.h> #include <widgets/grid_text_button_helpers.h>
#include <widgets/text_ctrl_eval.h> #include <widgets/text_ctrl_eval.h>
@ -186,7 +187,7 @@ DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
// free the memory used by all models, otherwise models which were // free the memory used by all models, otherwise models which were
// browsed but not used would consume memory // browsed but not used would consume memory
Prj().Get3DCacheManager()->FlushCache( false ); PROJECT_PCBNEW::Get3DCacheManager( &Prj() )->FlushCache( false );
// the GL canvas has to be visible before it is destroyed // the GL canvas has to be visible before it is destroyed
m_page = m_NoteBook->GetSelection(); m_page = m_NoteBook->GetSelection();

View File

@ -67,6 +67,7 @@
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <paths.h> #include <paths.h>
#include <macros.h> #include <macros.h>
#include <project_pcbnew.h>
// clang-format off // clang-format off
@ -1146,7 +1147,7 @@ void InvokePcbLibTableEditor( KIWAY* aKiway, wxWindow* aCaller )
{ {
FP_LIB_TABLE* globalTable = &GFootprintTable; FP_LIB_TABLE* globalTable = &GFootprintTable;
wxString globalTablePath = FP_LIB_TABLE::GetGlobalTableFileName(); wxString globalTablePath = FP_LIB_TABLE::GetGlobalTableFileName();
FP_LIB_TABLE* projectTable = aKiway->Prj().PcbFootprintLibs(); FP_LIB_TABLE* projectTable = PROJECT_PCBNEW::PcbFootprintLibs( &aKiway->Prj() );
wxString projectTablePath = aKiway->Prj().FootprintLibTblName(); wxString projectTablePath = aKiway->Prj().FootprintLibTblName();
wxString msg; wxString msg;

View File

@ -44,6 +44,7 @@
#include "dialogs/3d_cache_dialogs.h" #include "dialogs/3d_cache_dialogs.h"
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <wx/defs.h> #include <wx/defs.h>
#include <project_pcbnew.h>
enum MODELS_TABLE_COLUMNS enum MODELS_TABLE_COLUMNS
{ {
@ -97,7 +98,7 @@ PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL(
m_modelsGrid->SetColAttr( COL_SHOWN, attr ); m_modelsGrid->SetColAttr( COL_SHOWN, attr );
m_modelsGrid->SetWindowStyleFlag( m_modelsGrid->GetWindowStyle() & ~wxHSCROLL ); m_modelsGrid->SetWindowStyleFlag( m_modelsGrid->GetWindowStyle() & ~wxHSCROLL );
m_frame->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() ); PROJECT_PCBNEW::Get3DCacheManager( &m_frame->Prj() )->GetResolver()->SetProgramBase( &Pgm() );
m_previewPane = new PANEL_PREVIEW_3D_MODEL( this, m_frame, m_footprint, &m_shapes3D_list ); m_previewPane = new PANEL_PREVIEW_3D_MODEL( this, m_frame, m_footprint, &m_shapes3D_list );
@ -117,7 +118,7 @@ PANEL_FP_PROPERTIES_3D_MODEL::~PANEL_FP_PROPERTIES_3D_MODEL()
// free the memory used by all models, otherwise models which were // free the memory used by all models, otherwise models which were
// browsed but not used would consume memory // browsed but not used would consume memory
m_frame->Prj().Get3DCacheManager()->FlushCache( false ); PROJECT_PCBNEW::Get3DCacheManager( &m_frame->Prj() )->FlushCache( false );
delete m_previewPane; delete m_previewPane;
} }
@ -154,7 +155,7 @@ void PANEL_FP_PROPERTIES_3D_MODEL::ReloadModelsFromFootprint()
m_modelsGrid->ClearRows(); m_modelsGrid->ClearRows();
wxString origPath, alias, shortPath; wxString origPath, alias, shortPath;
FILENAME_RESOLVER* res = m_frame->Prj().Get3DCacheManager()->GetResolver(); FILENAME_RESOLVER* res = PROJECT_PCBNEW::Get3DCacheManager( &m_frame->Prj() )->GetResolver();
for( const FP_3DMODEL& model : m_footprint->Models() ) for( const FP_3DMODEL& model : m_footprint->Models() )
{ {
@ -213,7 +214,7 @@ void PANEL_FP_PROPERTIES_3D_MODEL::On3DModelCellChanged( wxGridEvent& aEvent )
if( aEvent.GetCol() == COL_FILENAME ) if( aEvent.GetCol() == COL_FILENAME )
{ {
bool hasAlias = false; bool hasAlias = false;
FILENAME_RESOLVER* res = m_frame->Prj().Get3DCacheManager()->GetResolver(); FILENAME_RESOLVER* res = PROJECT_PCBNEW::Get3DCacheManager( &m_frame->Prj() )->GetResolver();
wxString filename = m_modelsGrid->GetCellValue( aEvent.GetRow(), COL_FILENAME ); wxString filename = m_modelsGrid->GetCellValue( aEvent.GetRow(), COL_FILENAME );
// Perform cleanup and validation on the filename if it isn't empty // Perform cleanup and validation on the filename if it isn't empty
@ -308,7 +309,7 @@ void PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel( wxCommandEvent& )
filter = (int) tmp; filter = (int) tmp;
} }
if( !S3D::Select3DModel( m_parentDialog, m_frame->Prj().Get3DCacheManager(), initialpath, filter, &model ) if( !S3D::Select3DModel( m_parentDialog, PROJECT_PCBNEW::Get3DCacheManager( &m_frame->Prj() ), initialpath, filter, &model )
|| model.m_Filename.empty() ) || model.m_Filename.empty() )
{ {
if( selected >= 0 ) if( selected >= 0 )
@ -323,7 +324,7 @@ void PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel( wxCommandEvent& )
prj.SetRString( PROJECT::VIEWER_3D_PATH, initialpath ); prj.SetRString( PROJECT::VIEWER_3D_PATH, initialpath );
sidx = wxString::Format( wxT( "%i" ), filter ); sidx = wxString::Format( wxT( "%i" ), filter );
prj.SetRString( PROJECT::VIEWER_3D_FILTER_INDEX, sidx ); prj.SetRString( PROJECT::VIEWER_3D_FILTER_INDEX, sidx );
FILENAME_RESOLVER* res = m_frame->Prj().Get3DCacheManager()->GetResolver(); FILENAME_RESOLVER* res = PROJECT_PCBNEW::Get3DCacheManager( &m_frame->Prj() )->GetResolver();
wxString alias; wxString alias;
wxString shortPath; wxString shortPath;
wxString filename = model.m_Filename; wxString filename = model.m_Filename;
@ -429,7 +430,7 @@ MODEL_VALIDATE_ERRORS PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists( const w
return MODEL_VALIDATE_ERRORS::NO_FILENAME; return MODEL_VALIDATE_ERRORS::NO_FILENAME;
bool hasAlias = false; bool hasAlias = false;
FILENAME_RESOLVER* resolv = m_frame->Prj().Get3DFilenameResolver(); FILENAME_RESOLVER* resolv = PROJECT_PCBNEW::Get3DFilenameResolver( &m_frame->Prj() );
if( !resolv ) if( !resolv )
return MODEL_VALIDATE_ERRORS::RESOLVE_FAIL; return MODEL_VALIDATE_ERRORS::RESOLVE_FAIL;
@ -441,7 +442,7 @@ MODEL_VALIDATE_ERRORS PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists( const w
const FP_LIB_TABLE_ROW* fpRow = nullptr; const FP_LIB_TABLE_ROW* fpRow = nullptr;
try try
{ {
fpRow = m_frame->Prj().PcbFootprintLibs()->FindRow( libraryName, false ); fpRow = PROJECT_PCBNEW::PcbFootprintLibs( &m_frame->Prj() )->FindRow( libraryName, false );
} }
catch( ... ) catch( ... )
{ {
@ -467,7 +468,7 @@ MODEL_VALIDATE_ERRORS PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists( const w
void PANEL_FP_PROPERTIES_3D_MODEL::Cfg3DPath( wxCommandEvent& event ) void PANEL_FP_PROPERTIES_3D_MODEL::Cfg3DPath( wxCommandEvent& event )
{ {
if( S3D::Configure3DPaths( this, m_frame->Prj().Get3DCacheManager()->GetResolver() ) ) if( S3D::Configure3DPaths( this, PROJECT_PCBNEW::Get3DCacheManager( &m_frame->Prj() )->GetResolver() ) )
m_previewPane->UpdateDummyFootprint(); m_previewPane->UpdateDummyFootprint();
} }

View File

@ -33,6 +33,7 @@
#include <drc/drc_engine.h> #include <drc/drc_engine.h>
#include <drc/drc_item.h> #include <drc/drc_item.h>
#include <drc/drc_test_provider.h> #include <drc/drc_test_provider.h>
#include <project_pcbnew.h>
/* /*
Library parity test. Library parity test.
@ -753,7 +754,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
std::map<LIB_ID, std::shared_ptr<FOOTPRINT>> libFootprintCache; std::map<LIB_ID, std::shared_ptr<FOOTPRINT>> libFootprintCache;
FP_LIB_TABLE* libTable = project->PcbFootprintLibs(); FP_LIB_TABLE* libTable = PROJECT_PCBNEW::PcbFootprintLibs( project );
wxString msg; wxString msg;
int ii = 0; int ii = 0;
const int progressDelta = 250; const int progressDelta = 250;

View File

@ -35,6 +35,7 @@
#include <pad.h> #include <pad.h>
#include <pcb_shape.h> #include <pcb_shape.h>
#include <build_version.h> #include <build_version.h>
#include <project_pcbnew.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
#include "project.h" #include "project.h"
#include "kiway.h" #include "kiway.h"
@ -282,7 +283,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
try try
{ {
fpRow = aPcb->GetProject()->PcbFootprintLibs()->FindRow( libraryName, false ); fpRow = PROJECT_PCBNEW::PcbFootprintLibs( aPcb->GetProject() )->FindRow( libraryName, false );
} }
catch( ... ) catch( ... )
{ {
@ -605,7 +606,7 @@ bool PCB_EDIT_FRAME::Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
// Switch the locale to standard C (needed to print floating point numbers) // Switch the locale to standard C (needed to print floating point numbers)
LOCALE_IO toggle; LOCALE_IO toggle;
resolver = Prj().Get3DCacheManager()->GetResolver(); resolver = PROJECT_PCBNEW::Get3DCacheManager( &Prj() )->GetResolver();
bool ok = true; bool ok = true;
double scale = pcbIUScale.MM_PER_IU; // we must scale internal units to mm for IDF double scale = pcbIUScale.MM_PER_IU; // we must scale internal units to mm for IDF

View File

@ -38,6 +38,7 @@
#include "pad.h" #include "pad.h"
#include "pcb_text.h" #include "pcb_text.h"
#include "pcb_track.h" #include "pcb_track.h"
#include <project_pcbnew.h>
#include <core/arraydim.h> #include <core/arraydim.h>
#include <filename_resolver.h> #include <filename_resolver.h>
#include "plugins/3dapi/ifsg_all.h" #include "plugins/3dapi/ifsg_all.h"
@ -1003,7 +1004,7 @@ void EXPORTER_PCB_VRML::ExportVrmlFootprint( FOOTPRINT* aFootprint, std::ostream
try try
{ {
fpRow = m_board->GetProject()->PcbFootprintLibs()->FindRow( libraryName, false ); fpRow = PROJECT_PCBNEW::PcbFootprintLibs( m_board->GetProject() )->FindRow( libraryName, false );
} }
catch( ... ) catch( ... )
{ {
@ -1250,7 +1251,7 @@ bool EXPORTER_PCB_VRML::ExportVRML_File( PROJECT* aProject, wxString *aMessages,
m_Subdir3DFpModels = subdir.GetAbsolutePath( wxFileName( aFullFileName ).GetPath() ); m_Subdir3DFpModels = subdir.GetAbsolutePath( wxFileName( aFullFileName ).GetPath() );
m_UseRelPathIn3DModelFilename = aUseRelativePaths; m_UseRelPathIn3DModelFilename = aUseRelativePaths;
m_Cache3Dmodels = aProject->Get3DCacheManager(); m_Cache3Dmodels = PROJECT_PCBNEW::Get3DCacheManager( aProject );
// When 3D models are separate files, for historical reasons the VRML unit // When 3D models are separate files, for historical reasons the VRML unit
// is expected to be 0.1 inch (2.54mm) instead of 1mm, so we adjust the m_BoardToVrmlScale // is expected to be 0.1 inch (2.54mm) instead of 1mm, so we adjust the m_BoardToVrmlScale

View File

@ -38,6 +38,7 @@
#include <base_units.h> #include <base_units.h>
#include <filename_resolver.h> #include <filename_resolver.h>
#include <trace_helpers.h> #include <trace_helpers.h>
#include <project_pcbnew.h>
#include <Message.hxx> // OpenCascade messenger #include <Message.hxx> // OpenCascade messenger
#include <Message_PrinterOStream.hxx> // OpenCascade output messenger #include <Message_PrinterOStream.hxx> // OpenCascade output messenger
@ -219,7 +220,7 @@ bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, VECTOR2D aOri
{ {
// FindRow() can throw an exception // FindRow() can throw an exception
const FP_LIB_TABLE_ROW* fpRow = const FP_LIB_TABLE_ROW* fpRow =
m_board->GetProject()->PcbFootprintLibs()->FindRow( libraryName, false ); PROJECT_PCBNEW::PcbFootprintLibs( m_board->GetProject() )->FindRow( libraryName, false );
if( fpRow ) if( fpRow )
footprintBasePath = fpRow->GetFullURI( true ); footprintBasePath = fpRow->GetFullURI( true );

View File

@ -51,6 +51,7 @@
#include <paths.h> #include <paths.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <project_pcbnew.h>
#include <project/project_local_settings.h> #include <project/project_local_settings.h>
#include <project/net_settings.h> #include <project/net_settings.h>
#include <plugins/cadstar/cadstar_pcb_archive_plugin.h> #include <plugins/cadstar/cadstar_pcb_archive_plugin.h>
@ -790,7 +791,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
} }
} }
FP_LIB_TABLE* prjlibtable = Prj().PcbFootprintLibs(); FP_LIB_TABLE* prjlibtable = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
const wxString& project_env = PROJECT_VAR_NAME; const wxString& project_env = PROJECT_VAR_NAME;
wxString rel_path, env_path; wxString rel_path, env_path;
@ -810,7 +811,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
try try
{ {
Prj().PcbFootprintLibs()->Save( tblName ); PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->Save( tblName );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {

View File

@ -52,6 +52,7 @@
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <project.h> #include <project.h>
#include <project_pcbnew.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <tool/action_toolbar.h> #include <tool/action_toolbar.h>
#include <tool/common_control.h> #include <tool/common_control.h>
@ -934,7 +935,7 @@ void FOOTPRINT_EDIT_FRAME::UpdateTitle()
{ {
try try
{ {
writable = Prj().PcbFootprintLibs()->IsFootprintLibWritable( fpid.GetLibNickname() ); writable = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->IsFootprintLibWritable( fpid.GetLibNickname() );
} }
catch( const IO_ERROR& ) catch( const IO_ERROR& )
{ {
@ -987,7 +988,7 @@ void FOOTPRINT_EDIT_FRAME::UpdateView()
void FOOTPRINT_EDIT_FRAME::initLibraryTree() void FOOTPRINT_EDIT_FRAME::initLibraryTree()
{ {
FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs(); FP_LIB_TABLE* fpTable = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 ); WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
@ -1009,7 +1010,7 @@ void FOOTPRINT_EDIT_FRAME::initLibraryTree()
void FOOTPRINT_EDIT_FRAME::SyncLibraryTree( bool aProgress ) void FOOTPRINT_EDIT_FRAME::SyncLibraryTree( bool aProgress )
{ {
FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs(); FP_LIB_TABLE* fpTable = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() ); auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
LIB_ID target = GetTargetFPID(); LIB_ID target = GetTargetFPID();
bool targetSelected = ( target == m_treePane->GetLibTree()->GetSelectedLibId() ); bool targetSelected = ( target == m_treePane->GetLibTree()->GetSelectedLibId() );

View File

@ -43,6 +43,7 @@
#include <widgets/lib_tree.h> #include <widgets/lib_tree.h>
#include <pcb_layer_box_selector.h> #include <pcb_layer_box_selector.h>
#include <pcb_dimension.h> #include <pcb_dimension.h>
#include <project_pcbnew.h>
#include <dialogs/dialog_dimension_properties.h> #include <dialogs/dialog_dimension_properties.h>
using namespace std::placeholders; using namespace std::placeholders;
@ -318,7 +319,7 @@ void FOOTPRINT_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
wxString libNickname; wxString libNickname;
wxString msg; wxString msg;
FP_LIB_TABLE* libTable = Prj().PcbFootprintLibs(); FP_LIB_TABLE* libTable = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( fpFileName.GetPath() ); const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( fpFileName.GetPath() );
if( !libTableRow ) if( !libTableRow )

View File

@ -46,6 +46,7 @@
#include <env_paths.h> #include <env_paths.h>
#include <paths.h> #include <paths.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <project_pcbnew.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <footprint_editor_settings.h> #include <footprint_editor_settings.h>
#include "footprint_viewer_frame.h" #include "footprint_viewer_frame.h"
@ -285,7 +286,7 @@ void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint )
wxString PCB_BASE_EDIT_FRAME::CreateNewProjectLibrary( const wxString& aLibName, wxString PCB_BASE_EDIT_FRAME::CreateNewProjectLibrary( const wxString& aLibName,
const wxString& aProposedName ) const wxString& aProposedName )
{ {
return createNewLibrary( aLibName, aProposedName, Prj().PcbFootprintLibs() ); return createNewLibrary( aLibName, aProposedName, PROJECT_PCBNEW::PcbFootprintLibs( &Prj() ) );
} }
@ -434,7 +435,7 @@ FP_LIB_TABLE* PCB_BASE_EDIT_FRAME::selectLibTable( bool aOptional )
switch( dlg.GetSelection() ) switch( dlg.GetSelection() )
{ {
case 0: return &GFootprintTable; case 0: return &GFootprintTable;
case 1: return Prj().PcbFootprintLibs(); case 1: return PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
default: return nullptr; default: return nullptr;
} }
} }
@ -491,7 +492,7 @@ bool PCB_BASE_EDIT_FRAME::AddLibrary( const wxString& aFilename, FP_LIB_TABLE* a
if( isGlobal ) if( isGlobal )
GFootprintTable.Save( FP_LIB_TABLE::GetGlobalTableFileName() ); GFootprintTable.Save( FP_LIB_TABLE::GetGlobalTableFileName() );
else else
Prj().PcbFootprintLibs()->Save( Prj().FootprintLibTblName() ); PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->Save( Prj().FootprintLibTblName() );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
@ -527,7 +528,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary( const LIB_ID& aFPID, bool
// Legacy libraries are readable, but modifying legacy format is not allowed // Legacy libraries are readable, but modifying legacy format is not allowed
// So prompt the user if he try to delete a footprint from a legacy lib // So prompt the user if he try to delete a footprint from a legacy lib
wxString libfullname = Prj().PcbFootprintLibs()->FindRow( nickname )->GetFullURI(); wxString libfullname = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->FindRow( nickname )->GetFullURI();
if( IO_MGR::GuessPluginTypeFromLibPath( libfullname ) == IO_MGR::LEGACY ) if( IO_MGR::GuessPluginTypeFromLibPath( libfullname ) == IO_MGR::LEGACY )
{ {
@ -535,7 +536,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary( const LIB_ID& aFPID, bool
return false; return false;
} }
if( !Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname ) ) if( !PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->IsFootprintLibWritable( nickname ) )
{ {
wxString msg = wxString::Format( _( "Library '%s' is read only." ), nickname ); wxString msg = wxString::Format( _( "Library '%s' is read only." ), nickname );
ShowInfoBarError( msg ); ShowInfoBarError( msg );
@ -552,7 +553,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary( const LIB_ID& aFPID, bool
try try
{ {
Prj().PcbFootprintLibs()->FootprintDelete( nickname, fpname ); PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->FootprintDelete( nickname, fpname );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
@ -606,7 +607,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr
{ {
try try
{ {
FP_LIB_TABLE* tbl = prj.PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &prj );
if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards. if( !footprint->GetFPID().GetLibItemName().empty() ) // Handle old boards.
{ {
@ -648,7 +649,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr
if( map ) if( map )
{ {
const LIB_TABLE_ROW* row = Prj().PcbFootprintLibs()->FindRowByURI( libPath ); const LIB_TABLE_ROW* row = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->FindRowByURI( libPath );
if( row ) if( row )
libNickname = row->GetNickName(); libNickname = row->GetNickName();
@ -730,7 +731,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprint( FOOTPRINT* aFootprint )
} }
} }
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
// Legacy libraries are readable, but modifying legacy format is not allowed // Legacy libraries are readable, but modifying legacy format is not allowed
// So prompt the user if he try to add/replace a footprint in a legacy lib // So prompt the user if he try to add/replace a footprint in a legacy lib
@ -779,7 +780,7 @@ bool FOOTPRINT_EDIT_FRAME::DuplicateFootprint( FOOTPRINT* aFootprint )
// Legacy libraries are readable, but modifying legacy format is not allowed // Legacy libraries are readable, but modifying legacy format is not allowed
// So prompt the user if he try to add/replace a footprint in a legacy lib // So prompt the user if he try to add/replace a footprint in a legacy lib
wxString libFullName = Prj().PcbFootprintLibs()->FindRow( libraryName )->GetFullURI(); wxString libFullName = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->FindRow( libraryName )->GetFullURI();
if( IO_MGR::GuessPluginTypeFromLibPath( libFullName ) == IO_MGR::LEGACY ) if( IO_MGR::GuessPluginTypeFromLibPath( libFullName ) == IO_MGR::LEGACY )
{ {
@ -787,7 +788,7 @@ bool FOOTPRINT_EDIT_FRAME::DuplicateFootprint( FOOTPRINT* aFootprint )
return false; return false;
} }
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
int i = 1; int i = 1;
wxString newName = footprintName; wxString newName = footprintName;
@ -811,7 +812,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( FOOTPRINT* aFootprint,
{ {
aFootprint->SetFPID( LIB_ID( wxEmptyString, aFootprint->GetFPID().GetLibItemName() ) ); aFootprint->SetFPID( LIB_ID( wxEmptyString, aFootprint->GetFPID().GetLibItemName() ) );
Prj().PcbFootprintLibs()->FootprintSave( aLibraryName, aFootprint ); PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->FootprintSave( aLibraryName, aFootprint );
aFootprint->SetFPID( LIB_ID( aLibraryName, aFootprint->GetFPID().GetLibItemName() ) ); aFootprint->SetFPID( LIB_ID( aLibraryName, aFootprint->GetFPID().GetLibItemName() ) );
return true; return true;
@ -945,7 +946,7 @@ public:
{ {
COMMON_SETTINGS* cfg = Pgm().GetCommonSettings(); COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
PROJECT_FILE& project = aParent->Prj().GetProjectFile(); PROJECT_FILE& project = aParent->Prj().GetProjectFile();
FP_LIB_TABLE* tbl = aParent->Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &aParent->Prj() );
std::vector<wxString> nicknames = tbl->GetLogicalLibs(); std::vector<wxString> nicknames = tbl->GetLogicalLibs();
wxArrayString headers; wxArrayString headers;
std::vector<wxArrayString> itemsToDisplay; std::vector<wxArrayString> itemsToDisplay;
@ -1046,7 +1047,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( FOOTPRINT* aFootprint )
if( aFootprint == nullptr ) if( aFootprint == nullptr )
return false; return false;
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
SetMsgPanel( aFootprint ); SetMsgPanel( aFootprint );
@ -1075,7 +1076,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( FOOTPRINT* aFootprint )
// Legacy libraries are readable, but modifying legacy format is not allowed // Legacy libraries are readable, but modifying legacy format is not allowed
// So prompt the user if he try to add/replace a footprint in a legacy lib // So prompt the user if he try to add/replace a footprint in a legacy lib
const FP_LIB_TABLE_ROW* row = Prj().PcbFootprintLibs()->FindRow( newLib ); const FP_LIB_TABLE_ROW* row = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->FindRow( newLib );
wxString libPath = row->GetFullURI(); wxString libPath = row->GetFullURI();
IO_MGR::PCB_FILE_T piType = IO_MGR::GuessPluginTypeFromLibPath( libPath ); IO_MGR::PCB_FILE_T piType = IO_MGR::GuessPluginTypeFromLibPath( libPath );
@ -1208,7 +1209,7 @@ private:
FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName, FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName,
const wxString& aLibName, bool aQuiet ) const wxString& aLibName, bool aQuiet )
{ {
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
wxString footprintName = aFootprintName; wxString footprintName = aFootprintName;
wxString msg; wxString msg;
@ -1335,7 +1336,7 @@ wxString PCB_BASE_FRAME::SelectLibrary( const wxString& aNicknameExisting )
COMMON_SETTINGS* cfg = Pgm().GetCommonSettings(); COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
PROJECT_FILE& project = Kiway().Prj().GetProjectFile(); PROJECT_FILE& project = Kiway().Prj().GetProjectFile();
FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* fptbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
std::vector< wxArrayString > itemsToDisplay; std::vector< wxArrayString > itemsToDisplay;
std::vector< wxString > nicknames = fptbl->GetLogicalLibs(); std::vector< wxString > nicknames = fptbl->GetLogicalLibs();

View File

@ -44,6 +44,7 @@
#include <wx/stattext.h> #include <wx/stattext.h>
#include <zoom_defines.h> #include <zoom_defines.h>
#include <dialog_shim.h> #include <dialog_shim.h>
#include <project_pcbnew.h>
FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aParent, FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aParent,
UNITS_PROVIDER* aUnitsProvider, UNITS_PROVIDER* aUnitsProvider,
@ -162,7 +163,7 @@ bool FOOTPRINT_PREVIEW_PANEL::DisplayFootprint( const LIB_ID& aFPID )
m_currentFootprint->SetParent( nullptr ); m_currentFootprint->SetParent( nullptr );
} }
FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* fptbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
try try
{ {

View File

@ -45,6 +45,7 @@
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <footprint_editor_settings.h> #include <footprint_editor_settings.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <project_pcbnew.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <tool/action_toolbar.h> #include <tool/action_toolbar.h>
@ -422,7 +423,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
COMMON_SETTINGS* cfg = Pgm().GetCommonSettings(); COMMON_SETTINGS* cfg = Pgm().GetCommonSettings();
PROJECT_FILE& project = Kiway().Prj().GetProjectFile(); PROJECT_FILE& project = Kiway().Prj().GetProjectFile();
std::vector<wxString> nicknames = Prj().PcbFootprintLibs()->GetLogicalLibs(); std::vector<wxString> nicknames = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->GetLogicalLibs();
std::vector<wxString> pinnedMatches; std::vector<wxString> pinnedMatches;
std::vector<wxString> otherMatches; std::vector<wxString> otherMatches;
@ -507,7 +508,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
wxString nickname = getCurNickname(); wxString nickname = getCurNickname();
fp_info_list->ReadFootprintFiles( Prj().PcbFootprintLibs(), !nickname ? nullptr : &nickname ); fp_info_list->ReadFootprintFiles( PROJECT_PCBNEW::PcbFootprintLibs( &Prj() ), !nickname ? nullptr : &nickname );
if( fp_info_list->GetErrorCount() ) if( fp_info_list->GetErrorCount() )
{ {
@ -934,7 +935,7 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
if( event.GetActive() ) if( event.GetActive() )
{ {
// Ensure we have the right library list: // Ensure we have the right library list:
std::vector< wxString > libNicknames = Prj().PcbFootprintLibs()->GetLogicalLibs(); std::vector< wxString > libNicknames = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->GetLogicalLibs();
bool stale = false; bool stale = false;
if( libNicknames.size() != m_libList->GetCount() ) if( libNicknames.size() != m_libList->GetCount() )
@ -1032,7 +1033,7 @@ bool FOOTPRINT_VIEWER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aParent
if( aFootprint && !aFootprint->IsEmpty() ) if( aFootprint && !aFootprint->IsEmpty() )
{ {
wxString msg; wxString msg;
LIB_TABLE* fpTable = Prj().PcbFootprintLibs(); LIB_TABLE* fpTable = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
LIB_ID fpid; LIB_ID fpid;
fpid.Parse( *aFootprint, true ); fpid.Parse( *aFootprint, true );
@ -1146,7 +1147,7 @@ void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
{ {
try try
{ {
FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs(); FP_LIB_TABLE* libtable = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
const LIB_TABLE_ROW* row = libtable->FindRow( getCurNickname() ); const LIB_TABLE_ROW* row = libtable->FindRow( getCurNickname() );
title = getCurNickname() + wxT( " \u2014 " ) + row->GetFullURI( true ); title = getCurNickname() + wxT( " \u2014 " ) + row->GetFullURI( true );
@ -1200,7 +1201,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
GetBoard()->DeleteAllFootprints(); GetBoard()->DeleteAllFootprints();
GetBoard()->GetNetInfo().RemoveUnusedNets(); GetBoard()->GetNetInfo().RemoveUnusedNets();
FOOTPRINT* footprint = Prj().PcbFootprintLibs()->FootprintLoad( getCurNickname(), FOOTPRINT* footprint = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->FootprintLoad( getCurNickname(),
getCurFootprintName() ); getCurFootprintName() );
if( footprint ) if( footprint )

View File

@ -49,6 +49,7 @@ using namespace std::placeholders;
#include <widgets/lib_tree.h> #include <widgets/lib_tree.h>
#include <widgets/wx_progress_reporters.h> #include <widgets/wx_progress_reporters.h>
#include <dialog_pad_properties.h> #include <dialog_pad_properties.h>
#include <project_pcbnew.h>
static wxArrayString s_FootprintHistoryList; static wxArrayString s_FootprintHistoryList;
@ -233,7 +234,7 @@ FOOTPRINT* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& aFootprintId )
FOOTPRINT* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId ) FOOTPRINT* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId )
{ {
FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* fptbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
wxCHECK_MSG( fptbl, nullptr, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) ); wxCHECK_MSG( fptbl, nullptr, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) );

View File

@ -45,6 +45,7 @@ using namespace std::placeholders;
#include <tools/pcb_actions.h> #include <tools/pcb_actions.h>
#include <tools/pcb_selection_tool.h> #include <tools/pcb_selection_tool.h>
#include <project/project_file.h> // LAST_PATH_TYPE #include <project/project_file.h> // LAST_PATH_TYPE
#include <project_pcbnew.h>
bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename, NETLIST& aNetlist, bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename, NETLIST& aNetlist,
@ -147,7 +148,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
FOOTPRINT* footprint = nullptr; FOOTPRINT* footprint = nullptr;
FOOTPRINT* fpOnBoard = nullptr; FOOTPRINT* fpOnBoard = nullptr;
if( aNetlist.IsEmpty() || Prj().PcbFootprintLibs()->IsEmpty() ) if( aNetlist.IsEmpty() || PROJECT_PCBNEW::PcbFootprintLibs( &Prj() )->IsEmpty() )
return; return;
aNetlist.SortByFPID(); aNetlist.SortByFPID();

View File

@ -51,6 +51,7 @@
#include <pcb_base_frame.h> #include <pcb_base_frame.h>
#include <pcb_draw_panel_gal.h> #include <pcb_draw_panel_gal.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <project_pcbnew.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <zoom_defines.h> #include <zoom_defines.h>
@ -111,7 +112,7 @@ bool PCB_BASE_FRAME::canCloseWindow( wxCloseEvent& aEvent )
// Similarly, wxConvBrokenFileNames uses some statically allocated variables that make it // Similarly, wxConvBrokenFileNames uses some statically allocated variables that make it
// crash when run later from a d'tor. // crash when run later from a d'tor.
Prj().Cleanup3DCache(); PROJECT_PCBNEW::Cleanup3DCache( &Prj() );
return true; return true;
} }
@ -160,46 +161,6 @@ void PCB_BASE_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxStrin
} }
FP_LIB_TABLE* PROJECT::PcbFootprintLibs()
{
// This is a lazy loading function, it loads the project specific table when
// that table is asked for, not before.
FP_LIB_TABLE* tbl = (FP_LIB_TABLE*) GetElem( ELEM_FPTBL );
// its gotta be NULL or a FP_LIB_TABLE, or a bug.
wxASSERT( !tbl || tbl->Type() == FP_LIB_TABLE_T );
if( !tbl )
{
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
// stack this way, all using the same global fallback table.
tbl = new FP_LIB_TABLE( &GFootprintTable );
SetElem( ELEM_FPTBL, tbl );
wxString projectFpLibTableFileName = FootprintLibTblName();
try
{
tbl->Load( projectFpLibTableFileName );
}
catch( const IO_ERROR& ioe )
{
DisplayErrorMessage( nullptr, _( "Error loading project footprint libraries." ),
ioe.What() );
}
catch( ... )
{
DisplayErrorMessage( nullptr, _( "Error loading project footprint library table." ) );
}
}
return tbl;
}
void PCB_BASE_FRAME::SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter ) void PCB_BASE_FRAME::SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter )
{ {
if( m_pcb != aBoard ) if( m_pcb != aBoard )
@ -1192,7 +1153,7 @@ void PCB_BASE_FRAME::setFPWatcher( FOOTPRINT* aFootprint )
} }
wxString libfullname; wxString libfullname;
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
if( !aFootprint || !tbl ) if( !aFootprint || !tbl )
return; return;
@ -1268,7 +1229,7 @@ void PCB_BASE_FRAME::OnFpChangeDebounceTimer( wxTimerEvent& aEvent )
m_watcherLastModified = lastModified; m_watcherLastModified = lastModified;
FOOTPRINT* fp = GetBoard()->GetFirstFootprint(); FOOTPRINT* fp = GetBoard()->GetFirstFootprint();
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &Prj() );
// When loading a footprint from a library in the footprint editor // When loading a footprint from a library in the footprint editor
// the items UUIDs must be keep and not reinitialized // the items UUIDs must be keep and not reinitialized

133
pcbnew/project_pcbnew.cpp Normal file
View File

@ -0,0 +1,133 @@
/*
* 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
*/
#include "project_pcbnew.h"
#include <fp_lib_table.h>
#include <project.h>
#include <confirm.h>
#include <pgm_base.h>
#include <3d_cache/3d_cache.h>
#include <paths.h>
#include <settings/common_settings.h>
#include <mutex>
static std::mutex mutex3D_cacheManager;
FP_LIB_TABLE* PROJECT_PCBNEW::PcbFootprintLibs( PROJECT* aProject )
{
// This is a lazy loading function, it loads the project specific table when
// that table is asked for, not before.
FP_LIB_TABLE* tbl = (FP_LIB_TABLE*) aProject->GetElem( PROJECT::ELEM_FPTBL );
// its gotta be NULL or a FP_LIB_TABLE, or a bug.
wxASSERT( !tbl || tbl->Type() == FP_LIB_TABLE_T );
if( !tbl )
{
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
// stack this way, all using the same global fallback table.
tbl = new FP_LIB_TABLE( &GFootprintTable );
aProject->SetElem( PROJECT::ELEM_FPTBL, tbl );
wxString projectFpLibTableFileName = aProject->FootprintLibTblName();
try
{
tbl->Load( projectFpLibTableFileName );
}
catch( const IO_ERROR& ioe )
{
DisplayErrorMessage( nullptr, _( "Error loading project footprint libraries." ),
ioe.What() );
}
catch( ... )
{
DisplayErrorMessage( nullptr, _( "Error loading project footprint library table." ) );
}
}
return tbl;
}
S3D_CACHE* PROJECT_PCBNEW::Get3DCacheManager( PROJECT* aProject, bool aUpdateProjDir )
{
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
// Get the existing cache from the project
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( aProject->GetElem( PROJECT::ELEM_3DCACHE ) );
if( !cache )
{
// Create a cache if there is not one already
cache = new S3D_CACHE();
wxFileName cfgpath;
cfgpath.AssignDir( PATHS::GetUserSettingsPath() );
cfgpath.AppendDir( wxT( "3d" ) );
cache->SetProgramBase( &Pgm() );
cache->Set3DConfigDir( cfgpath.GetFullPath() );
aProject->SetElem( PROJECT::ELEM_3DCACHE, cache );
aUpdateProjDir = true;
}
if( aUpdateProjDir )
cache->SetProject( aProject );
return cache;
}
FILENAME_RESOLVER* PROJECT_PCBNEW::Get3DFilenameResolver( PROJECT* aProject )
{
return Get3DCacheManager( aProject )->GetResolver();
}
void PROJECT_PCBNEW::Cleanup3DCache( PROJECT* aProject )
{
std::lock_guard<std::mutex> lock( mutex3D_cacheManager );
// Get the existing cache from the project
S3D_CACHE* cache = dynamic_cast<S3D_CACHE*>( aProject->GetElem( PROJECT::ELEM_3DCACHE ) );
if( cache )
{
// We'll delete ".3dc" cache files older than this many days
int clearCacheInterval = 0;
if( Pgm().GetCommonSettings() )
clearCacheInterval = Pgm().GetCommonSettings()->m_System.clear_3d_cache_interval;
// An interval of zero means the user doesn't want to ever clear the cache
if( clearCacheInterval > 0 )
cache->CleanCacheDir( clearCacheInterval );
}
}

55
pcbnew/project_pcbnew.h Normal file
View File

@ -0,0 +1,55 @@
/*
* 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 FP_LIB_TABLE;
class PROJECT;
class S3D_CACHE;
class FILENAME_RESOLVER;
class PROJECT_PCBNEW
{
public:
/**
* Return the table of footprint libraries without Kiway
*/
static FP_LIB_TABLE* PcbFootprintLibs( PROJECT* aProject );
/**
* Return a pointer to an instance of the 3D cache manager.
*
* An instance is created and initialized if appropriate.
*
* @return a pointer to an instance of the 3D cache manager or NULL on failure.
*/
static S3D_CACHE* Get3DCacheManager( PROJECT* aProject, bool updateProjDir = false );
static void Cleanup3DCache( PROJECT* aProject );
/// Accessor for 3D path resolver
static FILENAME_RESOLVER* Get3DFilenameResolver( PROJECT* aProject );
private:
PROJECT_PCBNEW() {}
};

View File

@ -47,6 +47,7 @@
#include <macros.h> #include <macros.h>
#include <pcbnew_scripting_helpers.h> #include <pcbnew_scripting_helpers.h>
#include <project.h> #include <project.h>
#include <project_pcbnew.h>
#include <project/net_settings.h> #include <project/net_settings.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
@ -306,7 +307,7 @@ FP_LIB_TABLE* GetFootprintLibraryTable()
if( !project ) if( !project )
return nullptr; return nullptr;
return project->PcbFootprintLibs(); return PROJECT_PCBNEW::PcbFootprintLibs( project );
} }

View File

@ -45,6 +45,7 @@
#include <widgets/footprint_diff_widget.h> #include <widgets/footprint_diff_widget.h>
#include <drc/drc_item.h> #include <drc/drc_item.h>
#include <pad.h> #include <pad.h>
#include <project_pcbnew.h>
BOARD_INSPECTION_TOOL::BOARD_INSPECTION_TOOL() : BOARD_INSPECTION_TOOL::BOARD_INSPECTION_TOOL() :
@ -1489,7 +1490,7 @@ void BOARD_INSPECTION_TOOL::DiffFootprint( FOOTPRINT* aFootprint )
r->Report( "" ); r->Report( "" );
PROJECT* project = aFootprint->GetBoard()->GetProject(); PROJECT* project = aFootprint->GetBoard()->GetProject();
FP_LIB_TABLE* libTable = project->PcbFootprintLibs(); FP_LIB_TABLE* libTable = PROJECT_PCBNEW::PcbFootprintLibs( project );
const LIB_TABLE_ROW* libTableRow = nullptr; const LIB_TABLE_ROW* libTableRow = nullptr;
try try

View File

@ -43,6 +43,7 @@
#include <footprint_wizard_frame.h> #include <footprint_wizard_frame.h>
#include <kiway.h> #include <kiway.h>
#include <drc/drc_item.h> #include <drc/drc_item.h>
#include <project_pcbnew.h>
#include <memory> #include <memory>
@ -284,7 +285,7 @@ int FOOTPRINT_EDITOR_CONTROL::SaveAs( const TOOL_EVENT& aEvent )
{ {
// Save Library As // Save Library As
const wxString& src_libNickname = m_frame->GetTargetFPID().GetLibNickname(); const wxString& src_libNickname = m_frame->GetTargetFPID().GetLibNickname();
wxString src_libFullName = m_frame->Prj().PcbFootprintLibs()->GetFullURI( src_libNickname ); wxString src_libFullName = PROJECT_PCBNEW::PcbFootprintLibs( &m_frame->Prj() )->GetFullURI( src_libNickname );
if( m_frame->SaveLibraryAs( src_libFullName ) ) if( m_frame->SaveLibraryAs( src_libFullName ) )
m_frame->SyncLibraryTree( true ); m_frame->SyncLibraryTree( true );
@ -359,7 +360,7 @@ int FOOTPRINT_EDITOR_CONTROL::PasteFootprint( const TOOL_EVENT& aEvent )
wxString newLib = m_frame->GetTreeFPID().GetLibNickname(); wxString newLib = m_frame->GetTreeFPID().GetLibNickname();
wxString newName = m_copiedFootprint->GetFPID().GetLibItemName(); wxString newName = m_copiedFootprint->GetFPID().GetLibItemName();
while( m_frame->Prj().PcbFootprintLibs()->FootprintExists( newLib, newName ) ) while( PROJECT_PCBNEW::PcbFootprintLibs( &m_frame->Prj() )->FootprintExists( newLib, newName ) )
newName += _( "_copy" ); newName += _( "_copy" );
m_copiedFootprint->SetFPID( LIB_ID( newLib, newName ) ); m_copiedFootprint->SetFPID( LIB_ID( newLib, newName ) );
@ -426,7 +427,7 @@ private:
int FOOTPRINT_EDITOR_CONTROL::RenameFootprint( const TOOL_EVENT& aEvent ) int FOOTPRINT_EDITOR_CONTROL::RenameFootprint( const TOOL_EVENT& aEvent )
{ {
FP_LIB_TABLE* tbl = m_frame->Prj().PcbFootprintLibs(); FP_LIB_TABLE* tbl = PROJECT_PCBNEW::PcbFootprintLibs( &m_frame->Prj() );
LIB_ID fpID = m_frame->GetTreeFPID(); LIB_ID fpID = m_frame->GetTreeFPID();
wxString libraryName = fpID.GetLibNickname(); wxString libraryName = fpID.GetLibNickname();
wxString oldName = fpID.GetLibItemName(); wxString oldName = fpID.GetLibItemName();
@ -492,7 +493,7 @@ int FOOTPRINT_EDITOR_CONTROL::RenameFootprint( const TOOL_EVENT& aEvent )
m_frame->SaveFootprintInLibrary( footprint, libraryName ); m_frame->SaveFootprintInLibrary( footprint, libraryName );
m_frame->Prj().PcbFootprintLibs()->FootprintDelete( libraryName, oldName ); PROJECT_PCBNEW::PcbFootprintLibs( &m_frame->Prj() )->FootprintDelete( libraryName, oldName );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {

View File

@ -38,6 +38,7 @@
#include <widgets/footprint_preview_widget.h> #include <widgets/footprint_preview_widget.h>
#include <widgets/wx_progress_reporters.h> #include <widgets/wx_progress_reporters.h>
#include <footprint_info_impl.h> #include <footprint_info_impl.h>
#include <project_pcbnew.h>
PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER( PCB_BASE_FRAME* aFrame, wxTopLevelWindow* aParent, PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER( PCB_BASE_FRAME* aFrame, wxTopLevelWindow* aParent,
@ -49,7 +50,7 @@ PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER( PCB_BASE_FRAME* aFrame, wxTopL
m_frame( aFrame ), m_frame( aFrame ),
m_closeHandler( std::move( aCloseHandler ) ) m_closeHandler( std::move( aCloseHandler ) )
{ {
FP_LIB_TABLE* fpTable = aFrame->Prj().PcbFootprintLibs(); FP_LIB_TABLE* fpTable = PROJECT_PCBNEW::PcbFootprintLibs( &aFrame->Prj() );
// Load footprint files: // Load footprint files:
WX_PROGRESS_REPORTER* progressReporter = new WX_PROGRESS_REPORTER( aParent, WX_PROGRESS_REPORTER* progressReporter = new WX_PROGRESS_REPORTER( aParent,