remove USE_FP_LIB_TABLE code, make it the norm. Add lazy loading support to FOOTPRINT_INFO.

This commit is contained in:
Dick Hollenbeck 2013-12-12 10:01:03 -06:00
parent b85a713395
commit 7ba078b620
29 changed files with 120 additions and 887 deletions

View File

@ -47,8 +47,6 @@ option( KICAD_SCRIPTING_WXPYTHON
# python binary file should be is exec path. # python binary file should be is exec path.
option( USE_FP_LIB_TABLE "Use the new footprint library table implementation. ( default OFF)" ON )
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." OFF ) option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." OFF )

View File

@ -58,9 +58,6 @@
/// The legacy file format revision of the *.brd file created by this build /// The legacy file format revision of the *.brd file created by this build
#define LEGACY_BOARD_FILE_VERSION 2 #define LEGACY_BOARD_FILE_VERSION 2
/// Definition to compile with Pcbnew footprint library table implementation.
#cmakedefine USE_FP_LIB_TABLE
/// The install prefix defined in CMAKE_INSTALL_PREFIX. /// The install prefix defined in CMAKE_INSTALL_PREFIX.
#define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX" #define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX"

View File

@ -566,12 +566,7 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
tmp << wxT( "OFF\n" ); tmp << wxT( "OFF\n" );
#endif #endif
tmp << wxT( " USE_FP_LIB_TABLE=" ); tmp << wxT( " USE_FP_LIB_TABLE=HARD_CODED_ON\n" );
#ifdef USE_FP_LIB_TABLE
tmp << wxT( "ON\n" );
#else
tmp << wxT( "OFF\n" );
#endif
tmp << wxT( " BUILD_GITHUB_PLUGIN=" ); tmp << wxT( " BUILD_GITHUB_PLUGIN=" );
#ifdef BUILD_GITHUB_PLUGIN #ifdef BUILD_GITHUB_PLUGIN

View File

@ -30,7 +30,6 @@
#define USE_WORKER_THREADS 1 // 1:yes, 0:no. use worker thread to load libraries #define USE_WORKER_THREADS 1 // 1:yes, 0:no. use worker thread to load libraries
/* /*
* Functions to read footprint libraries and fill m_footprints by available footprints names * Functions to read footprint libraries and fill m_footprints by available footprints names
* and their documentation (comments and keywords) * and their documentation (comments and keywords)
@ -46,10 +45,7 @@
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <fpid.h> #include <fpid.h>
#include <class_module.h> #include <class_module.h>
#include <boost/thread.hpp>
#if defined(USE_FP_LIB_TABLE)
#include <boost/thread.hpp>
#endif
/* /*
@ -97,94 +93,22 @@ static wxString ToHTMLFragment( const IO_ERROR* aDerivative )
*/ */
#if !defined( USE_FP_LIB_TABLE ) void FOOTPRINT_INFO::load()
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintLibNames )
{ {
bool retv = true; FP_LIB_TABLE* fptable = m_owner->GetTable();
// Clear data before reading files wxASSERT( fptable );
m_error_count = 0;
m_errors.clear();
m_list.clear();
// try std::auto_ptr<MODULE> m( fptable->FootprintLoad( m_nickname, m_fpname ) );
{
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
// Parse Libraries Listed m_pad_count = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
for( unsigned ii = 0; ii < aFootprintLibNames.GetCount(); ii++ ) m_keywords = m->GetKeywords();
{ m_doc = m->GetDescription();
// Footprint library file names can be fully qualified or file name only.
wxFileName filename = aFootprintLibNames[ii];
if( !filename.FileExists() ) // tell ensure_loaded() I'm loaded.
{ m_loaded = true;
filename = wxGetApp().FindLibraryPath( filename.GetFullName() );
if( !filename.FileExists() )
{
filename = wxFileName( wxEmptyString, aFootprintLibNames[ii],
LegacyFootprintLibPathExtension );
filename = wxGetApp().FindLibraryPath( filename.GetFullName() );
}
}
wxLogDebug( wxT( "Path <%s> -> <%s>." ), GetChars( aFootprintLibNames[ii] ),
GetChars( filename.GetFullPath() ) );
try
{
wxArrayString fpnames = pi->FootprintEnumerate( filename.GetFullPath() );
for( unsigned i=0; i<fpnames.GetCount(); ++i )
{
std::auto_ptr<MODULE> m( pi->FootprintLoad( filename.GetFullPath(),
fpnames[i] ) );
// we're loading what we enumerated, all must be there.
wxASSERT( m.get() );
FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO();
fpinfo->SetNickname( filename.GetName() );
fpinfo->SetLibPath( filename.GetFullPath() );
fpinfo->m_Module = fpnames[i];
fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();
AddItem( fpinfo );
}
}
catch( const PARSE_ERROR& pe )
{
m_errors.push_back( new PARSE_ERROR( pe ) );
retv = false;
}
catch( const IO_ERROR& ioe )
{
m_errors.push_back( new IO_ERROR( ioe ) );
retv = false;
}
}
}
/* caller should catch this, UI seems not wanted here.
catch( const IO_ERROR& ioe )
{
DisplayError( NULL, ioe.errorText );
return false;
}
*/
m_list.sort();
return retv;
} }
#else // yes USE_FP_LIB_TABLE, by all means:
#define JOBZ 6 // no. libraries per worker thread. It takes about #define JOBZ 6 // no. libraries per worker thread. It takes about
// a second to load a GITHUB library, so assigning // a second to load a GITHUB library, so assigning
@ -214,18 +138,9 @@ void FOOTPRINT_LIST::loader_job( const wxString* aNicknameList, int aJobZ )
for( unsigned ni=0; ni<fpnames.GetCount(); ++ni ) for( unsigned ni=0; ni<fpnames.GetCount(); ++ni )
{ {
std::auto_ptr<MODULE> m( m_lib_table->FootprintLoad( nickname, fpnames[ni] ) ); FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO( this, nickname, fpnames[ni] );
FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO(); addItem( fpinfo );
fpinfo->SetNickname( nickname );
fpinfo->m_Module = fpnames[ni];
fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();
AddItem( fpinfo );
} }
} }
catch( const PARSE_ERROR& pe ) catch( const PARSE_ERROR& pe )
@ -346,27 +261,12 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
return retv; return retv;
} }
#endif // USE_FP_LIB_TABLE
void FOOTPRINT_LIST::AddItem( FOOTPRINT_INFO* aItem ) FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
{ {
#if defined( USE_FP_LIB_TABLE ) BOOST_FOREACH( FOOTPRINT_INFO& fp, m_list )
// m_list is not thread safe, and this function is called from
// worker threads, lock m_list.
MUTLOCK lock( m_list_lock );
#endif
m_list.push_back( aItem );
}
const FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
{
BOOST_FOREACH( const FOOTPRINT_INFO& footprint, m_list )
{ {
#if defined( USE_FP_LIB_TABLE )
FPID fpid; FPID fpid;
wxCHECK_MSG( fpid.Parse( aFootprintName ) < 0, NULL, wxCHECK_MSG( fpid.Parse( aFootprintName ) < 0, NULL,
@ -376,42 +276,17 @@ const FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintN
wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() ); wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() );
wxString footprintName = FROM_UTF8( fpid.GetFootprintName().c_str() ); wxString footprintName = FROM_UTF8( fpid.GetFootprintName().c_str() );
if( libNickname == footprint.m_nickname && footprintName == footprint.m_Module ) if( libNickname == fp.GetNickname() && footprintName == fp.GetFootprintName() )
return &footprint; return &fp;
#else
if( aFootprintName.CmpNoCase( footprint.m_Module ) == 0 )
return &footprint;
#endif
} }
return NULL; return NULL;
} }
bool FOOTPRINT_INFO::InLibrary( const wxString& aLibrary ) const bool FOOTPRINT_INFO::InLibrary( const wxString& aLibrary ) const
{ {
#if defined( USE_FP_LIB_TABLE )
return aLibrary == m_nickname; return aLibrary == m_nickname;
#else
if( aLibrary.IsEmpty() )
return false;
if( aLibrary == m_nickname || aLibrary == m_lib_path )
return true;
wxFileName filename = aLibrary;
if( filename.GetExt().IsEmpty() )
filename.SetExt( LegacyFootprintLibPathExtension );
if( filename.GetFullPath() == m_lib_path )
return true;
if( filename.GetPath().IsEmpty() )
filename = wxGetApp().FindLibraryPath( filename.GetFullName() );
return filename.GetFullPath() == m_lib_path;
#endif
} }

View File

@ -185,7 +185,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
for( size_t jj = 0; jj < filtercount && !found; jj++ ) for( size_t jj = 0; jj < filtercount && !found; jj++ )
{ {
found = module->m_Module.Matches( component->GetFootprintFilters()[jj] ); found = module->GetFootprintName().Matches( component->GetFootprintFilters()[jj] );
} }
} }
else else

View File

@ -89,7 +89,6 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
// User library path takes precedent over default library search paths. // User library path takes precedent over default library search paths.
wxGetApp().InsertLibraryPath( m_UserLibraryPath, 1 ); wxGetApp().InsertLibraryPath( m_UserLibraryPath, 1 );
#if defined( USE_FP_LIB_TABLE )
delete m_footprintLibTable; delete m_footprintLibTable;
// Attempt to load the project footprint library table if it exists. // Attempt to load the project footprint library table if it exists.
@ -111,7 +110,6 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
{ {
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
} }
#endif
} }

View File

@ -479,7 +479,6 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
try try
{ {
#if defined( USE_FP_LIB_TABLE )
FPID fpid; FPID fpid;
if( fpid.Parse( aFootprintName ) >= 0 ) if( fpid.Parse( aFootprintName ) >= 0 )
@ -496,35 +495,6 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
fpname.c_str(), nickname.c_str() ); fpname.c_str(), nickname.c_str() );
footprint = m_footprintLibTable->FootprintLoad( FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) ); footprint = m_footprintLibTable->FootprintLoad( FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) );
#else
CVPCB_MAINFRAME* parent = ( CVPCB_MAINFRAME* ) GetParent();
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
for( unsigned i = 0; i < parent->m_ModuleLibNames.GetCount(); ++i )
{
wxFileName fn( wxEmptyString, parent->m_ModuleLibNames[i],
LegacyFootprintLibPathExtension );
wxString libPath = wxGetApp().FindLibraryPath( fn );
if( !libPath )
{
wxString msg = wxString::Format( _( "PCB footprint library file <%s> could not "
"be found in the default search paths." ),
fn.GetFullName().GetData() );
// @todo we should not be using wxMessageBox directly.
wxMessageBox( msg, wxEmptyString, wxOK | wxICON_ERROR, this );
continue;
}
footprint = pi->FootprintLoad( libPath, aFootprintName );
if( footprint != NULL )
break;
}
#endif
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {

View File

@ -135,14 +135,9 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
{ {
if( aFilterType == UNFILTERED ) if( aFilterType == UNFILTERED )
{ {
#if !defined( USE_FP_LIB_TABLE )
msg.Printf( wxT( "%3zu %s" ), newList.GetCount() + 1,
GetChars( aList.GetItem( ii ).m_Module ) );
#else
msg.Printf( wxT( "%3zu %s:%s" ), newList.GetCount() + 1, msg.Printf( wxT( "%3zu %s:%s" ), newList.GetCount() + 1,
GetChars( aList.GetItem( ii ).GetNickname() ), GetChars( aList.GetItem( ii ).GetNickname() ),
GetChars( aList.GetItem( ii ).m_Module ) ); GetChars( aList.GetItem( ii ).GetFootprintName() ) );
#endif
newList.Add( msg ); newList.Add( msg );
continue; continue;
} }
@ -151,22 +146,17 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
&& !aList.GetItem( ii ).InLibrary( aLibName ) ) && !aList.GetItem( ii ).InLibrary( aLibName ) )
continue; continue;
if( (aFilterType & BY_COMPONENT) && (aComponent != NULL) if( (aFilterType & BY_COMPONENT) && aComponent
&& !aComponent->MatchesFootprintFilters( aList.GetItem( ii ).m_Module ) ) && !aComponent->MatchesFootprintFilters( aList.GetItem( ii ).GetFootprintName() ) )
continue; continue;
if( (aFilterType & BY_PIN_COUNT) && (aComponent!= NULL) if( (aFilterType & BY_PIN_COUNT) && aComponent
&& (aComponent->GetNetCount() != aList.GetItem( ii ).m_padCount) ) && aComponent->GetNetCount() != aList.GetItem( ii ).GetPadCount() )
continue; continue;
#if !defined( USE_FP_LIB_TABLE )
msg.Printf( wxT( "%3zu %s" ), newList.GetCount() + 1,
aList.GetItem( ii ).m_Module.GetData() );
#else
msg.Printf( wxT( "%3zu %s:%s" ), newList.GetCount() + 1, msg.Printf( wxT( "%3zu %s:%s" ), newList.GetCount() + 1,
GetChars( aList.GetItem( ii ).GetNickname() ), GetChars( aList.GetItem( ii ).GetNickname() ),
GetChars( aList.GetItem( ii ).m_Module ) ); GetChars( aList.GetItem( ii ).GetFootprintName() ) );
#endif
newList.Add( msg ); newList.Add( msg );
} }

View File

@ -73,9 +73,7 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
EVT_MENU( ID_SAVE_PROJECT_AS, CVPCB_MAINFRAME::SaveProjectFile ) EVT_MENU( ID_SAVE_PROJECT_AS, CVPCB_MAINFRAME::SaveProjectFile )
EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave ) EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave )
#if defined( USE_FP_LIB_TABLE )
EVT_MENU( ID_CVPCB_LIB_TABLE_EDIT, CVPCB_MAINFRAME::OnEditFootprintLibraryTable ) EVT_MENU( ID_CVPCB_LIB_TABLE_EDIT, CVPCB_MAINFRAME::OnEditFootprintLibraryTable )
#endif
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, CVPCB_MAINFRAME::SetLanguage ) EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, CVPCB_MAINFRAME::SetLanguage )
@ -122,10 +120,8 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
m_undefinedComponentCnt = 0; m_undefinedComponentCnt = 0;
m_skipComponentSelect = false; m_skipComponentSelect = false;
#if defined( USE_FP_LIB_TABLE )
m_globalFootprintTable = NULL; m_globalFootprintTable = NULL;
m_footprintLibTable = NULL; m_footprintLibTable = NULL;
#endif
/* Name of the document footprint list /* Name of the document footprint list
* usually located in share/modules/footprints_doc * usually located in share/modules/footprints_doc
@ -199,7 +195,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
m_auimgr.Update(); m_auimgr.Update();
#if defined( USE_FP_LIB_TABLE )
if( m_globalFootprintTable == NULL ) if( m_globalFootprintTable == NULL )
{ {
try try
@ -229,8 +224,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
m_footprintLibTable = new FP_LIB_TABLE( m_globalFootprintTable ); m_footprintLibTable = new FP_LIB_TABLE( m_globalFootprintTable );
} }
#endif
} }
@ -511,7 +504,6 @@ void CVPCB_MAINFRAME::ConfigCvpcb( wxCommandEvent& event )
} }
#if defined( USE_FP_LIB_TABLE )
void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent ) void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
{ {
bool tableChanged = false; bool tableChanged = false;
@ -558,7 +550,6 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
if( tableChanged ) if( tableChanged )
BuildLIBRARY_LISTBOX(); BuildLIBRARY_LISTBOX();
} }
#endif
void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event ) void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
@ -705,14 +696,14 @@ void CVPCB_MAINFRAME::DisplayStatus()
{ {
wxString footprintName = m_FootprintList->GetSelectedFootprint(); wxString footprintName = m_FootprintList->GetSelectedFootprint();
const FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName ); FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName );
if( module ) // can be NULL if no netlist loaded if( module ) // can be NULL if no netlist loaded
{ {
msg = _( "Description: " ) + module->m_Doc; msg = _( "Description: " ) + module->GetDoc();
SetStatusText( msg, 0 ); SetStatusText( msg, 0 );
msg = _( "Key words: " ) + module->m_KeyWord; msg = _( "Key words: " ) + module->GetKeywords();
SetStatusText( msg, 1 ); SetStatusText( msg, 1 );
} }
} }
@ -762,12 +753,8 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
return false; return false;
} }
#if !defined( USE_FP_LIB_TABLE )
m_footprints.ReadFootprintFiles( m_ModuleLibNames );
#else
if( m_footprintLibTable != NULL ) if( m_footprintLibTable != NULL )
m_footprints.ReadFootprintFiles( m_footprintLibTable ); m_footprints.ReadFootprintFiles( m_footprintLibTable );
#endif
if( m_footprints.GetErrorCount() ) if( m_footprints.GetErrorCount() )
{ {
@ -936,9 +923,7 @@ void CVPCB_MAINFRAME::CreateScreenCmp()
wxSize( 600, 400 ), wxSize( 600, 400 ),
KICAD_DEFAULT_DRAWFRAME_STYLE ); KICAD_DEFAULT_DRAWFRAME_STYLE );
#if defined( USE_FP_LIB_TABLE )
m_DisplayFootprintFrame->SetFootprintLibTable( m_footprintLibTable ); m_DisplayFootprintFrame->SetFootprintLibTable( m_footprintLibTable );
#endif
m_DisplayFootprintFrame->Show( true ); m_DisplayFootprintFrame->Show( true );
} }
@ -1035,7 +1020,6 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
wxFONTWEIGHT_NORMAL ) ); wxFONTWEIGHT_NORMAL ) );
} }
#if defined( USE_FP_LIB_TABLE )
if( m_footprintLibTable ) if( m_footprintLibTable )
{ {
wxArrayString libNames; wxArrayString libNames;
@ -1047,9 +1031,6 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
m_LibraryList->SetLibraryList( libNames ); m_LibraryList->SetLibraryList( libNames );
} }
#else
m_LibraryList->SetLibraryList( m_ModuleLibNames );
#endif
} }

View File

@ -99,9 +99,7 @@ bool EDA_APP::OnInit()
InitEDA_Appl( wxT( "CvPcb" ), APP_CVPCB_T ); InitEDA_Appl( wxT( "CvPcb" ), APP_CVPCB_T );
#if defined( USE_FP_LIB_TABLE )
SetFootprintLibTablePath(); SetFootprintLibTablePath();
#endif
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
{ {

View File

@ -55,7 +55,6 @@ class CVPCB_MAINFRAME : public EDA_BASE_FRAME
{ {
wxArrayString m_footprintListEntries; wxArrayString m_footprintListEntries;
#if defined( USE_FP_LIB_TABLE )
/// The global footprint library table. /// The global footprint library table.
FP_LIB_TABLE* m_globalFootprintTable; FP_LIB_TABLE* m_globalFootprintTable;
@ -63,7 +62,6 @@ class CVPCB_MAINFRAME : public EDA_BASE_FRAME
/// footprint library table and the global footprint table. This is the one to /// footprint library table and the global footprint table. This is the one to
/// use when finding a #MODULE. /// use when finding a #MODULE.
FP_LIB_TABLE* m_footprintLibTable; FP_LIB_TABLE* m_footprintLibTable;
#endif
public: public:
bool m_KeepCvpcbOpen; bool m_KeepCvpcbOpen;
@ -148,9 +146,7 @@ public:
* Function OnEditLibraryTable * Function OnEditLibraryTable
* envokes the footpirnt library table edit dialog. * envokes the footpirnt library table edit dialog.
*/ */
#if defined( USE_FP_LIB_TABLE )
void OnEditFootprintLibraryTable( wxCommandEvent& aEvent ); void OnEditFootprintLibraryTable( wxCommandEvent& aEvent );
#endif
void OnKeepOpenOnSave( wxCommandEvent& event ); void OnKeepOpenOnSave( wxCommandEvent& event );
void DisplayModule( wxCommandEvent& event ); void DisplayModule( wxCommandEvent& event );

View File

@ -110,17 +110,9 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Menu Preferences: // Menu Preferences:
wxMenu* preferencesMenu = new wxMenu; wxMenu* preferencesMenu = new wxMenu;
#if !defined( USE_FP_LIB_TABLE )
// Libraries to load
AddMenuItem( preferencesMenu, wxID_PREFERENCES,
_( "&Libraries" ),
_( "Set footprint libraries to load and library search paths" ),
KiBitmap( config_xpm ) );
#else
AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT, AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT,
_( "Li&brary Tables" ), _( "Setup footprint libraries" ), _( "Li&brary Tables" ), _( "Setup footprint libraries" ),
KiBitmap( library_table_xpm ) ); KiBitmap( library_table_xpm ) );
#endif
// Language submenu // Language submenu
wxGetApp().AddMenuLanguageList( preferencesMenu ); wxGetApp().AddMenuLanguageList( preferencesMenu );

View File

@ -159,8 +159,6 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
isLegacy = false; // None of the components have footprints assigned. isLegacy = false; // None of the components have footprints assigned.
} }
#if defined( USE_FP_LIB_TABLE )
wxString missingLibs; wxString missingLibs;
// Check if footprint links were generated before the footprint library table was implemented. // Check if footprint links were generated before the footprint library table was implemented.
@ -217,7 +215,6 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
} }
} }
} }
#endif
for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{ {
@ -272,7 +269,6 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
if( !fn.HasExt() ) if( !fn.HasExt() )
fn.SetExt( ComponentFileExtension ); fn.SetExt( ComponentFileExtension );
#if defined( USE_FP_LIB_TABLE )
// Save the project specific footprint library table. // Save the project specific footprint library table.
if( !m_footprintLibTable->IsEmpty( false ) ) if( !m_footprintLibTable->IsEmpty( false ) )
{ {
@ -298,8 +294,6 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
} }
} }
} }
#endif
} }
if( !IsWritable( fn.GetFullPath() ) ) if( !IsWritable( fn.GetFullPath() ) )

View File

@ -33,14 +33,15 @@
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#if defined( USE_FP_LIB_TABLE ) #include <ki_mutex.h>
#include <ki_mutex.h>
#endif
#include <kicad_string.h> #include <kicad_string.h>
#define USE_FPI_LAZY 0 // 1:yes lazy, 0:no early
class FP_LIB_TABLE; class FP_LIB_TABLE;
class FOOTPRINT_LIST;
class wxTopLevelWindow; class wxTopLevelWindow;
@ -51,38 +52,52 @@ class wxTopLevelWindow;
*/ */
class FOOTPRINT_INFO class FOOTPRINT_INFO
{ {
friend bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 );
public: public:
// friend bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 ); // These two accessors do not have to call ensure_loaded(), because constructor
// fills in these fields:
wxString m_nickname; ///< the library nickname, eventually const wxString& GetFootprintName() const { return m_fpname; }
#if !defined(USE_FP_LIB_TABLE)
wxString m_lib_path;
#endif
wxString m_Module; ///< Module name.
int m_Num; ///< Order number in the display list.
wxString m_Doc; ///< Footprint description.
wxString m_KeyWord; ///< Footprint key words.
unsigned m_padCount; ///< Number of pads
FOOTPRINT_INFO()
{
m_Num = 0;
m_padCount = 0;
}
const wxString& GetFootprintName() const { return m_Module; }
void SetNickname( const wxString& aLibNickname ) { m_nickname = aLibNickname; }
const wxString& GetNickname() const { return m_nickname; } const wxString& GetNickname() const { return m_nickname; }
#if !defined(USE_FP_LIB_TABLE) FOOTPRINT_INFO( FOOTPRINT_LIST* aOwner, const wxString& aNickname, const wxString& aFootprintName ) :
void SetLibPath( const wxString& aLibPath ) { m_lib_path = aLibPath; } m_owner( aOwner ),
const wxString& GetLibPath() const { return m_lib_path; } m_loaded( false ),
m_nickname( aNickname ),
m_fpname( aFootprintName ),
m_num( 0 ),
m_pad_count( 0 )
{
#if !USE_FPI_LAZY
load();
#endif #endif
}
const wxString& GetDoc()
{
ensure_loaded();
return m_doc;
}
const wxString& GetKeywords()
{
ensure_loaded();
return m_keywords;
}
unsigned GetPadCount()
{
ensure_loaded();
return m_pad_count;
}
int GetOrderNum()
{
ensure_loaded();
return m_num;
}
/** /**
* Function InLibrary * Function InLibrary
@ -94,20 +109,40 @@ public:
* false. * false.
*/ */
bool InLibrary( const wxString& aLibrary ) const; bool InLibrary( const wxString& aLibrary ) const;
private:
void ensure_loaded()
{
if( !m_loaded )
load();
}
/// lazily load stuff not filled in by constructor. This may throw IO_ERRORS.
void load();
FOOTPRINT_LIST* m_owner; ///< provides access to FP_LIB_TABLE
bool m_loaded;
wxString m_nickname; ///< library as known in FP_LIB_TABLE
wxString m_fpname; ///< Module name.
int m_num; ///< Order number in the display list.
int m_pad_count; ///< Number of pads
wxString m_doc; ///< Footprint description.
wxString m_keywords; ///< Footprint keywords.
}; };
/// FOOTPRINT object list sort function. /// FOOTPRINT object list sort function.
inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 ) inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 )
{ {
#if defined( USE_FP_LIB_TABLE )
int retv = StrNumCmp( item1.m_nickname, item2.m_nickname, INT_MAX, true ); int retv = StrNumCmp( item1.m_nickname, item2.m_nickname, INT_MAX, true );
if( retv != 0 ) if( retv != 0 )
return retv < 0; return retv < 0;
#endif
return StrNumCmp( item1.m_Module, item2.m_Module, INT_MAX, true ) < 0; return StrNumCmp( item1.m_fpname, item2.m_fpname, INT_MAX, true ) < 0;
} }
@ -121,17 +156,14 @@ class FOOTPRINT_LIST
FP_LIB_TABLE* m_lib_table; ///< no ownership FP_LIB_TABLE* m_lib_table; ///< no ownership
volatile int m_error_count; ///< thread safe to read. volatile int m_error_count; ///< thread safe to read.
typedef boost::ptr_vector< FOOTPRINT_INFO > FPILIST; typedef boost::ptr_vector< FOOTPRINT_INFO > FPILIST;
typedef boost::ptr_vector< IO_ERROR > ERRLIST; typedef boost::ptr_vector< IO_ERROR > ERRLIST;
FPILIST m_list; FPILIST m_list;
ERRLIST m_errors; ///< some can be PARSE_ERRORs also ERRLIST m_errors; ///< some can be PARSE_ERRORs also
#if defined( USE_FP_LIB_TABLE )
MUTEX m_errors_lock; MUTEX m_errors_lock;
MUTEX m_list_lock; MUTEX m_list_lock;
#endif
/** /**
* Function loader_job * Function loader_job
@ -143,6 +175,16 @@ class FOOTPRINT_LIST
*/ */
void loader_job( const wxString* aNicknameList, int aJobZ ); void loader_job( const wxString* aNicknameList, int aJobZ );
void addItem( FOOTPRINT_INFO* aItem )
{
// m_list is not thread safe, and this function is called from
// worker threads, lock m_list.
MUTLOCK lock( m_list_lock );
m_list.push_back( aItem );
}
public: public:
FOOTPRINT_LIST() : FOOTPRINT_LIST() :
@ -163,16 +205,16 @@ public:
/** /**
* Function GetModuleInfo * Function GetModuleInfo
* @param aFootprintName = the footprint name inside the FOOTPRINT_INFO of interest. * @param aFootprintName = the footprint name inside the FOOTPRINT_INFO of interest.
* @return const FOOTPRINT_INF* - the item stored in list if found * @return FOOTPRINT_INF* - the item stored in list if found
*/ */
const FOOTPRINT_INFO* GetModuleInfo( const wxString& aFootprintName ); FOOTPRINT_INFO* GetModuleInfo( const wxString& aFootprintName );
/** /**
* Function GetItem * Function GetItem
* @param aIdx = index of the given item * @param aIdx = index of the given item
* @return the aIdx item in list * @return the aIdx item in list
*/ */
const FOOTPRINT_INFO& GetItem( unsigned aIdx ) const { return m_list[aIdx]; } FOOTPRINT_INFO& GetItem( unsigned aIdx ) { return m_list[aIdx]; }
/** /**
* Function AddItem * Function AddItem
@ -185,15 +227,6 @@ public:
const IO_ERROR* GetError( unsigned aIdx ) const { return &m_errors[aIdx]; } const IO_ERROR* GetError( unsigned aIdx ) const { return &m_errors[aIdx]; }
#if !defined( USE_FP_LIB_TABLE )
/**
* Function ReadFootprintFiles
*
* @param aFootprintsLibNames = an array string giving the list of libraries to load
*/
bool ReadFootprintFiles( wxArrayString& aFootprintsLibNames );
#endif
/** /**
* Function ReadFootprintFiles * Function ReadFootprintFiles
* reads all the footprints provided by the combination of aTable and aNickname. * reads all the footprints provided by the combination of aTable and aNickname.
@ -208,6 +241,8 @@ public:
bool ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname = NULL ); bool ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname = NULL );
void DisplayErrors( wxTopLevelWindow* aCaller = NULL ); void DisplayErrors( wxTopLevelWindow* aCaller = NULL );
FP_LIB_TABLE* GetTable() const { return m_lib_table; }
}; };
#endif // FOOTPRINT_INFO_H_ #endif // FOOTPRINT_INFO_H_

View File

@ -640,26 +640,4 @@ protected:
FP_LIB_TABLE* fallBack; FP_LIB_TABLE* fallBack;
}; };
#if 0 // I don't think this is going to be needed.
/**
* Function LookupPart
* finds and loads a MODULE, and parses it. As long as the part is
* accessible in any LIB_SOURCE, opened or not opened, this function
* will find it and load it into its containing LIB, even if that means
* having to open a LIB in this table that was not previously opened.
*
* @param aFootprintId The fully qualified name of the footprint to look up.
*
* @return MODULE* - this will never be NULL, and no ownership is transferred because
* all MODULEs live in LIBs. You only get to point to them in some LIB. If the MODULE
* cannot be found, then an exception is thrown.
*
* @throw IO_ERROR if any problem occurs or if the footprint cannot be found.
*/
MODULE* LookupFootprint( const FP_LIB_ID& aFootprintId ) throw( IO_ERROR );
#endif
#endif // FP_LIB_TABLE_H_ #endif // FP_LIB_TABLE_H_

View File

@ -141,7 +141,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
{ {
Clear_Pcb( true ); Clear_Pcb( true );
#if defined( USE_FP_LIB_TABLE )
// Create a new empty footprint library table for the new board. // Create a new empty footprint library table for the new board.
delete m_footprintLibTable; delete m_footprintLibTable;
m_footprintLibTable = new FP_LIB_TABLE( m_globalFootprintTable ); m_footprintLibTable = new FP_LIB_TABLE( m_globalFootprintTable );
@ -158,7 +157,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
wxFileName emptyFileName; wxFileName emptyFileName;
FP_LIB_TABLE::SetProjectPathEnvVariable( emptyFileName ); FP_LIB_TABLE::SetProjectPathEnvVariable( emptyFileName );
#endif
wxFileName fn; wxFileName fn;
fn.AssignCwd(); fn.AssignCwd();
@ -535,7 +533,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
GetChars( pcbFileName.GetFullPath() ) )) ) GetChars( pcbFileName.GetFullPath() ) )) )
return false; return false;
#if defined( USE_FP_LIB_TABLE )
// Save the project specific footprint library table. // Save the project specific footprint library table.
if( !m_footprintLibTable->IsEmpty( false ) ) if( !m_footprintLibTable->IsEmpty( false ) )
{ {
@ -561,8 +558,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
} }
} }
} }
#endif
} }
else else
{ {

View File

@ -464,8 +464,6 @@ wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary()
bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary() bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary()
{ {
#if defined(USE_FP_LIB_TABLE)
wxString nickname = getLibNickName(); wxString nickname = getLibNickName();
if( !m_footprintLibTable->IsFootprintLibWritable( nickname ) ) if( !m_footprintLibTable->IsFootprintLibWritable( nickname ) )
@ -509,48 +507,9 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary()
SetStatusText( msg ); SetStatusText( msg );
return true; return true;
#else
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent();
wxString libPath = getLibPath();
wxString footprintName = PCB_BASE_FRAME::SelectFootprint( this, libPath,
wxEmptyString, wxEmptyString,
parent->GetFootprintLibraryTable() );
if( !footprintName )
return false;
// Confirmation
wxString msg = wxString::Format( FMT_OK_DELETE, footprintName.GetData(), libPath.GetData() );
if( !IsOK( this, msg ) )
return false;
IO_MGR::PCB_FILE_T pluginType = IO_MGR::GuessPluginTypeFromLibPath( libPath );
try
{
PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
pi->FootprintDelete( libPath, footprintName );
}
catch( IO_ERROR ioe )
{
DisplayError( NULL, ioe.errorText );
return false;
}
msg.Printf( FMT_MOD_DELETED, footprintName.GetData(), libPath.GetData() );
SetStatusText( msg );
return true;
#endif
} }
#if defined(USE_FP_LIB_TABLE)
void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly ) void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly )
{ {
if( GetBoard()->m_Modules == NULL ) if( GetBoard()->m_Modules == NULL )
@ -608,90 +567,6 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly )
DisplayError( this, ioe.errorText ); DisplayError( this, ioe.errorText );
} }
} }
#else
void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly )
{
wxString fileName;
wxString path;
if( GetBoard()->m_Modules == NULL )
{
DisplayInfoMessage( this, FMT_NO_MODULES );
return;
}
path = wxGetApp().ReturnLastVisitedLibraryPath();
{
wxFileDialog dlg( this, FMT_LIBRARY, path,
wxEmptyString,
wxGetTranslation( LegacyFootprintLibPathWildcard ),
wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL )
return;
fileName = dlg.GetPath();
}
wxFileName fn( fileName );
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
bool lib_exists = wxFileExists( fileName );
if( !aNewModulesOnly && lib_exists )
{
wxString msg = wxString::Format( FMT_OK_OVERWRITE, GetChars( fileName ) );
if( !IsOK( this, msg ) )
return;
}
m_canvas->SetAbortRequest( false );
try
{
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
// Delete old library if we're replacing it entirely.
if( lib_exists && !aNewModulesOnly )
{
pi->FootprintLibDelete( fileName );
lib_exists = false;
}
if( !lib_exists )
{
pi->FootprintLibCreate( fileName );
}
if( !aNewModulesOnly )
{
for( MODULE* m = GetBoard()->m_Modules; m; m = m->Next() )
{
pi->FootprintSave( fileName, m );
}
}
else
{
for( MODULE* m = GetBoard()->m_Modules; m; m = m->Next() )
{
if( !Save_Module_In_Library( fileName, m, false, false ) )
break;
// Check for request to stop backup (ESCAPE key actuated)
if( m_canvas->GetAbortRequest() )
break;
}
}
}
catch( IO_ERROR ioe )
{
DisplayError( this, ioe.errorText );
}
}
#endif
bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary, bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary,
@ -744,7 +619,6 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary,
bool module_exists = false; bool module_exists = false;
#if defined(USE_FP_LIB_TABLE)
try try
{ {
MODULE* m = m_footprintLibTable->FootprintLoad( aLibrary, footprintName ); MODULE* m = m_footprintLibTable->FootprintLoad( aLibrary, footprintName );
@ -774,45 +648,6 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary,
// this always overwrites any existing footprint, but should yell on its // this always overwrites any existing footprint, but should yell on its
// own if the library or footprint is not writable. // own if the library or footprint is not writable.
m_footprintLibTable->FootprintSave( aLibrary, aModule ); m_footprintLibTable->FootprintSave( aLibrary, aModule );
#else
IO_MGR::PCB_FILE_T pluginType = IO_MGR::GuessPluginTypeFromLibPath( aLibrary );
try
{
PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
MODULE* m = pi->FootprintLoad( aLibrary, footprintName );
if( m )
{
delete m;
module_exists = true;
// an existing footprint is found in current lib
if( aDisplayDialog )
{
wxString msg = wxString::Format( FMT_MOD_EXISTS,
footprintName.GetData(), aLibrary.GetData() );
SetStatusText( msg );
}
if( !aOverwrite )
{
// Do not save the given footprint: an old one exists
return true;
}
}
// this always overwrites any existing footprint, but should yell on its
// own if the library or footprint is not writable.
pi->FootprintSave( aLibrary, aModule );
#endif
} }
catch( IO_ERROR ioe ) catch( IO_ERROR ioe )
{ {
@ -890,50 +725,6 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
} }
#if !defined( USE_FP_LIB_TABLE )
wxString PCB_BASE_FRAME::SelectLibrary( const wxString& aNicknameExisting )
{
if( g_LibraryNames.GetCount() == 0 )
return wxEmptyString;
wxArrayString headers;
headers.Add( _( "Library" ) );
std::vector<wxArrayString> itemsToDisplay;
// Conversion from wxArrayString to vector of ArrayString
for( unsigned i = 0; i < g_LibraryNames.GetCount(); i++ )
{
wxArrayString item;
item.Add( g_LibraryNames[i] );
itemsToDisplay.push_back( item );
}
EDA_LIST_DIALOG dlg( this, FMT_SELECT_LIB, headers, itemsToDisplay, aNicknameExisting );
if( dlg.ShowModal() != wxID_OK )
return wxEmptyString;
wxFileName fileName = wxFileName( wxEmptyString, dlg.GetTextSelection(),
LegacyFootprintLibPathExtension );
fileName = wxGetApp().FindLibraryPath( fileName );
if( !fileName.IsOk() || !fileName.FileExists() )
{
wxString msg = wxString::Format( FMT_BAD_PATHS, GetChars( dlg.GetTextSelection() ) );
DisplayError( this, msg );
return wxEmptyString;
}
return fileName.GetFullPath();
}
#else
wxString PCB_BASE_FRAME::SelectLibrary( const wxString& aNicknameExisting ) wxString PCB_BASE_FRAME::SelectLibrary( const wxString& aNicknameExisting )
{ {
wxArrayString headers; wxArrayString headers;
@ -965,5 +756,3 @@ wxString PCB_BASE_FRAME::SelectLibrary( const wxString& aNicknameExisting )
return nickname; return nickname;
} }
#endif

View File

@ -138,13 +138,7 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser()
if( !!fpname ) if( !!fpname )
{ {
#if !defined( USE_FP_LIB_TABLE )
// Returns the full fp name, i.e. the lib name and the fp name,
// separated by a '/' (/ is now an illegal char in fp names)
fpid = viewer->GetSelectedLibraryFullName() + wxT( "/" ) + fpname;
#else
fpid = viewer->GetSelectedLibrary() + wxT( ":" ) + fpname; fpid = viewer->GetSelectedLibrary() + wxT( ":" ) + fpname;
#endif
} }
viewer->Destroy(); viewer->Destroy();
@ -179,13 +173,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
{ {
// SelectFootprintFromLibBrowser() returns the "full" footprint name, i.e. // SelectFootprintFromLibBrowser() returns the "full" footprint name, i.e.
// <lib_name>/<footprint name> or FPID format "lib_name:fp_name:rev#" // <lib_name>/<footprint name> or FPID format "lib_name:fp_name:rev#"
#if !defined( USE_FP_LIB_TABLE )
wxString full_fpname = SelectFootprintFromLibBrowser();
moduleName = full_fpname.AfterLast( '/' );
libName = full_fpname.BeforeLast( '/' );
#else
moduleName = SelectFootprintFromLibBrowser(); moduleName = SelectFootprintFromLibBrowser();
#endif
} }
else else
{ {
@ -223,9 +211,6 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
} }
} }
#if !defined( USE_FP_LIB_TABLE )
module = GetModuleLibrary( libName, moduleName, false );
#else
FPID fpid; FPID fpid;
wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL, wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL,
@ -241,7 +226,6 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ), wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
fpid.Format().c_str(), GetChars( ioe.errorText ) ); fpid.Format().c_str(), GetChars( ioe.errorText ) );
} }
#endif
if( !module && allowWildSeach ) // Search with wild card if( !module && allowWildSeach ) // Search with wild card
{ {
@ -259,9 +243,6 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
} }
else else
{ {
#if !defined( USE_FP_LIB_TABLE )
module = GetModuleLibrary( libName, moduleName, true );
#else
FPID fpid; FPID fpid;
wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL, wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL,
@ -277,7 +258,6 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ), wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
fpid.Format().c_str(), GetChars( ioe.errorText ) ); fpid.Format().c_str(), GetChars( ioe.errorText ) );
} }
#endif
} }
} }
@ -514,27 +494,6 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
std::vector< wxArrayString > rows; std::vector< wxArrayString > rows;
#if !defined( USE_FP_LIB_TABLE )
if( aLibraryName.IsEmpty() )
{
libraries = g_LibraryNames;
}
else
{
libraries.Add( aLibraryName );
}
if( libraries.IsEmpty() )
{
DisplayError( aWindow, _( "No footprint libraries were specified." ) );
return wxEmptyString;
}
MList.ReadFootprintFiles( libraries );
#else
wxASSERT( aTable != NULL ); wxASSERT( aTable != NULL );
MList.ReadFootprintFiles( aTable, !aLibraryName ? NULL : &aLibraryName ); MList.ReadFootprintFiles( aTable, !aLibraryName ? NULL : &aLibraryName );
@ -545,8 +504,6 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
return wxEmptyString; return wxEmptyString;
} }
#endif
if( MList.GetCount() == 0 ) if( MList.GetCount() == 0 )
{ {
wxString tmp; wxString tmp;
@ -567,7 +524,7 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
{ {
for( unsigned ii = 0; ii < MList.GetCount(); ii++ ) for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
{ {
if( KeyWordOk( aKeyWord, MList.GetItem( ii ).m_KeyWord ) ) if( KeyWordOk( aKeyWord, MList.GetItem( ii ).GetKeywords() ) )
{ {
wxArrayString cols; wxArrayString cols;
cols.Add( MList.GetItem( ii ).GetFootprintName() ); cols.Add( MList.GetItem( ii ).GetFootprintName() );
@ -580,7 +537,7 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
{ {
for( unsigned ii = 0; ii < MList.GetCount(); ii++ ) for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
{ {
const wxString& candidate = MList.GetItem( ii ).m_Module; const wxString& candidate = MList.GetItem( ii ).GetFootprintName();
if( WildCompareString( aMask, candidate, false ) ) if( WildCompareString( aMask, candidate, false ) )
{ {
@ -617,9 +574,7 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
{ {
fpname = dlg.GetTextSelection(); fpname = dlg.GetTextSelection();
#if defined( USE_FP_LIB_TABLE )
fpname = dlg.GetTextSelection( 1 ) + wxT( ":" ) + fpname; fpname = dlg.GetTextSelection( 1 ) + wxT( ":" ) + fpname;
#endif
SkipNextLeftButtonReleaseEvent(); SkipNextLeftButtonReleaseEvent();
} }
@ -643,7 +598,7 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
static void DisplayCmpDoc( wxString& aName ) static void DisplayCmpDoc( wxString& aName )
{ {
const FOOTPRINT_INFO* module_info = MList.GetModuleInfo( aName ); FOOTPRINT_INFO* module_info = MList.GetModuleInfo( aName );
if( !module_info ) if( !module_info )
{ {
@ -651,8 +606,8 @@ static void DisplayCmpDoc( wxString& aName )
return; return;
} }
aName = _( "Description: " ) + module_info->m_Doc; aName = _( "Description: " ) + module_info->GetDoc();
aName += _( "\nKey words: " ) + module_info->m_KeyWord; aName += _( "\nKey words: " ) + module_info->GetKeywords();
} }

View File

@ -142,8 +142,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( tools_xpm ) ); KiBitmap( tools_xpm ) );
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_D356_FILE, AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_D356_FILE,
_( "IPC-D-356 Netlist File" ), _( "IPC-D-356 Netlist File" ),
_( "Generate IPC-D-356 netlist file" ), _( "Generate IPC-D-356 netlist file" ),
KiBitmap( netlist_xpm ) ); KiBitmap( netlist_xpm ) );
// Component File // Component File
@ -467,15 +467,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
// Library // Library
#if !defined( USE_FP_LIB_TABLE )
AddMenuItem( configmenu, ID_CONFIG_REQ,
_( "Li&brary" ), _( "Setting libraries, directories and others..." ),
KiBitmap( library_xpm ) );
#else
AddMenuItem( configmenu, ID_PCB_LIB_TABLE_EDIT, AddMenuItem( configmenu, ID_PCB_LIB_TABLE_EDIT,
_( "Li&brary Tables" ), _( "Setup footprint libraries" ), _( "Li&brary Tables" ), _( "Setup footprint libraries" ),
KiBitmap( library_table_xpm ) ); KiBitmap( library_table_xpm ) );
#endif
// Colors and Visibility are also handled by the layers manager toolbar // Colors and Visibility are also handled by the layers manager toolbar
AddMenuItem( configmenu, ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, AddMenuItem( configmenu, ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,

View File

@ -254,14 +254,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( library.size() ) if( library.size() )
{ {
#if defined(USE_FP_LIB_TABLE)
setLibNickName( library ); setLibNickName( library );
#else
wxFileName fileName( library );
setLibNickName( fileName.GetName() );
setLibPath( fileName.GetFullPath() );
#endif
updateTitle(); updateTitle();
} }
} }
@ -364,19 +357,11 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_MODEDIT_SAVE_LIBMODULE: case ID_MODEDIT_SAVE_LIBMODULE:
#if defined(USE_FP_LIB_TABLE)
if( GetBoard()->m_Modules && getLibNickName().size() ) if( GetBoard()->m_Modules && getLibNickName().size() )
{ {
Save_Module_In_Library( getLibNickName(), GetBoard()->m_Modules, true, true ); Save_Module_In_Library( getLibNickName(), GetBoard()->m_Modules, true, true );
GetScreen()->ClrModify(); GetScreen()->ClrModify();
} }
#else
if( GetBoard()->m_Modules && getLibPath() != wxEmptyString )
{
Save_Module_In_Library( getLibPath(), GetBoard()->m_Modules, true, true );
GetScreen()->ClrModify();
}
#endif
break; break;
case ID_MODEDIT_INSERT_MODULE_IN_BOARD: case ID_MODEDIT_INSERT_MODULE_IN_BOARD:
@ -507,11 +492,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Clear_Pcb( true ); Clear_Pcb( true );
SetCrossHairPosition( wxPoint( 0, 0 ) ); SetCrossHairPosition( wxPoint( 0, 0 ) );
#if !defined( USE_FP_LIB_TABLE )
LoadModuleFromLibrary( getLibPath(), m_footprintLibTable, true );
#else
LoadModuleFromLibrary( getLibNickName(), m_footprintLibTable, true ); LoadModuleFromLibrary( getLibNickName(), m_footprintLibTable, true );
#endif
redraw = true; redraw = true;
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )

View File

@ -437,18 +437,8 @@ protected:
void setLibNickName( const wxString& aNickname ); void setLibNickName( const wxString& aNickname );
#if !defined(USE_FP_LIB_TABLE)
wxString m_lib_path;
void setLibPath( const wxString& aLibPath ) { m_lib_path = aLibPath; }
/// The libPath is the full string used in the PLUGIN::Footprint*() calls.
wxString getLibPath() const { return m_lib_path; }
#else
/// The libPath is not publicly visible, grab it from the FP_LIB_TABLE if we must. /// The libPath is not publicly visible, grab it from the FP_LIB_TABLE if we must.
wxString getLibPath(); wxString getLibPath();
#endif
}; };
#endif // MODULE_EDITOR_FRAME_H_ #endif // MODULE_EDITOR_FRAME_H_

View File

@ -268,7 +268,6 @@ void FOOTPRINT_EDIT_FRAME::setLibNickName( const wxString& aNickname )
} }
#if 1 && defined(USE_FP_LIB_TABLE)
wxString FOOTPRINT_EDIT_FRAME::getLibPath() wxString FOOTPRINT_EDIT_FRAME::getLibPath()
{ {
try try
@ -284,7 +283,7 @@ wxString FOOTPRINT_EDIT_FRAME::getLibPath()
return wxEmptyString; return wxEmptyString;
} }
} }
#endif
const wxChar* FOOTPRINT_EDIT_FRAME::GetFootprintEditorFrameName() const wxChar* FOOTPRINT_EDIT_FRAME::GetFootprintEditorFrameName()
{ {
@ -363,15 +362,9 @@ void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
case wxID_YES: case wxID_YES:
// code from FOOTPRINT_EDIT_FRAME::Process_Special_Functions, // code from FOOTPRINT_EDIT_FRAME::Process_Special_Functions,
// at case ID_MODEDIT_SAVE_LIBMODULE // at case ID_MODEDIT_SAVE_LIBMODULE
#if defined(USE_FP_LIB_TABLE)
if( GetBoard()->m_Modules && getLibNickName().size() ) if( GetBoard()->m_Modules && getLibNickName().size() )
{ {
if( Save_Module_In_Library( getLibNickName(), GetBoard()->m_Modules, true, true ) ) if( Save_Module_In_Library( getLibNickName(), GetBoard()->m_Modules, true, true ) )
#else
if( GetBoard()->m_Modules && getLibPath() != wxEmptyString )
{
if( Save_Module_In_Library( getLibPath(), GetBoard()->m_Modules, true, true ) )
#endif
{ {
// save was correct // save was correct
GetScreen()->ClrModify(); GetScreen()->ClrModify();
@ -492,11 +485,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent
void FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib( wxUpdateUIEvent& aEvent ) void FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib( wxUpdateUIEvent& aEvent )
{ {
#if defined( USE_FP_LIB_TABLE )
aEvent.Enable( m_footprintLibTable && !m_footprintLibTable->IsEmpty() ); aEvent.Enable( m_footprintLibTable && !m_footprintLibTable->IsEmpty() );
#else
aEvent.Enable( !g_LibraryNames.IsEmpty() );
#endif
} }
@ -623,42 +612,6 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
{ {
wxString title = _( "Module Editor " ); wxString title = _( "Module Editor " );
#if !defined(USE_FP_LIB_TABLE)
wxString libPath = getLibPath();
if( !libPath )
{
L_none:
title += _( "(no active library)" );
}
else
{
// See if we can open and test write-ability of the library.
IO_MGR::PCB_FILE_T pluginType = IO_MGR::GuessPluginTypeFromLibPath( libPath );
PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
try
{
bool writable = pi->IsFootprintLibWritable( libPath );
// no exception was thrown, this means libPath is valid, but it may be read only.
title = _( "Module Editor (active library: " ) + getLibNickName() + wxT( ")" );
if( !writable )
title += _( " [Read Only]" );
}
catch( IO_ERROR ioe )
{
// user may be bewildered as to why after selecting a library it is not showing up
// in the title, we could show an error message, but that should have been done at time
// of libary selection UI.
goto L_none;
}
}
#else
wxString nickname = getLibNickName(); wxString nickname = getLibNickName();
if( !nickname ) if( !nickname )
@ -686,7 +639,6 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
goto L_none; goto L_none;
} }
} }
#endif
SetTitle( title ); SetTitle( title );
} }

View File

@ -195,18 +195,10 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent,
// If a footprint was previously loaded, reload it // If a footprint was previously loaded, reload it
if( !m_libraryName.IsEmpty() && !m_footprintName.IsEmpty() ) if( !m_libraryName.IsEmpty() && !m_footprintName.IsEmpty() )
{ {
#if !defined( USE_FP_LIB_TABLE )
MODULE* footprint = GetModuleLibrary( m_libraryName + wxT( "." ) + LegacyFootprintLibPathExtension,
m_footprintName, false );
if( footprint )
GetBoard()->Add( footprint, ADD_APPEND );
#else
FPID id; FPID id;
id.SetLibNickname( m_libraryName ); id.SetLibNickname( m_libraryName );
id.SetFootprintName( m_footprintName ); id.SetFootprintName( m_footprintName );
GetBoard()->Add( loadFootprint( id ) ); GetBoard()->Add( loadFootprint( id ) );
#endif
} }
if( m_canvas ) if( m_canvas )
@ -338,17 +330,10 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
m_LibList->Clear(); m_LibList->Clear();
#if !defined( USE_FP_LIB_TABLE )
for( unsigned ii = 0; ii < g_LibraryNames.GetCount(); ii++ )
{
m_LibList->Append( g_LibraryNames[ii] );
}
#else
std::vector< wxString > libName = m_footprintLibTable->GetLogicalLibs(); std::vector< wxString > libName = m_footprintLibTable->GetLogicalLibs();
for( unsigned ii = 0; ii < libName.size(); ii++ ) for( unsigned ii = 0; ii < libName.size(); ii++ )
m_LibList->Append( libName[ii] ); m_LibList->Append( libName[ii] );
#endif
// Search for a previous selection: // Search for a previous selection:
int index = m_LibList->FindString( m_libraryName ); int index = m_LibList->FindString( m_libraryName );
@ -388,17 +373,8 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
FOOTPRINT_LIST fp_info_list; FOOTPRINT_LIST fp_info_list;
wxArrayString libsList; wxArrayString libsList;
#if !defined( USE_FP_LIB_TABLE )
libsList.Add( m_libraryName );
fp_info_list.ReadFootprintFiles( libsList );
#else
fp_info_list.ReadFootprintFiles( m_footprintLibTable, &m_libraryName ); fp_info_list.ReadFootprintFiles( m_footprintLibTable, &m_libraryName );
#endif
if( fp_info_list.GetErrorCount() ) if( fp_info_list.GetErrorCount() )
{ {
fp_info_list.DisplayErrors( this ); fp_info_list.DisplayErrors( this );
@ -409,7 +385,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
BOOST_FOREACH( const FOOTPRINT_INFO& footprint, fp_info_list.GetList() ) BOOST_FOREACH( const FOOTPRINT_INFO& footprint, fp_info_list.GetList() )
{ {
fpList.Add( footprint.m_Module ); fpList.Add( footprint.GetFootprintName() );
} }
m_FootprintList->Append( fpList ); m_FootprintList->Append( fpList );
@ -461,13 +437,6 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
SetCurItem( NULL ); SetCurItem( NULL );
// Delete the current footprint // Delete the current footprint
GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
#if !defined( USE_FP_LIB_TABLE )
MODULE* footprint = GetModuleLibrary( m_libraryName + wxT( "." ) + LegacyFootprintLibPathExtension,
m_footprintName, true );
if( footprint )
GetBoard()->Add( footprint, ADD_APPEND );
#else
FPID id; FPID id;
id.SetLibNickname( m_libraryName ); id.SetLibNickname( m_libraryName );
id.SetFootprintName( m_footprintName ); id.SetFootprintName( m_footprintName );
@ -484,7 +453,6 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
GetChars( ioe.errorText ) ); GetChars( ioe.errorText ) );
DisplayError( this, msg ); DisplayError( this, msg );
} }
#endif
DisplayLibInfos(); DisplayLibInfos();
Zoom_Automatique( false ); Zoom_Automatique( false );
@ -555,21 +523,6 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
m_selectedFootprintName.Empty(); m_selectedFootprintName.Empty();
// Ensure we have the right library list: // Ensure we have the right library list:
#if !defined( USE_FP_LIB_TABLE )
if( g_LibraryNames.GetCount() == m_LibList->GetCount() )
{
unsigned ii;
for( ii = 0; ii < g_LibraryNames.GetCount(); ii++ )
{
if( m_LibList->GetString( ii ) != g_LibraryNames[ii] )
break;
}
if( ii == g_LibraryNames.GetCount() )
return;
}
#else
std::vector< wxString > libNicknames = m_footprintLibTable->GetLogicalLibs(); std::vector< wxString > libNicknames = m_footprintLibTable->GetLogicalLibs();
if( libNicknames.size() == m_LibList->GetCount() ) if( libNicknames.size() == m_LibList->GetCount() )
@ -585,7 +538,6 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
if( ii == libNicknames.size() ) if( ii == libNicknames.size() )
return; return;
} }
#endif
// If we are here, the library list has changed, rebuild it // If we are here, the library list has changed, rebuild it
ReCreateLibraryList(); ReCreateLibraryList();

View File

@ -161,164 +161,8 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName()
} }
#if !defined( USE_FP_LIB_TABLE )
void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
throw( IO_ERROR, PARSE_ERROR )
{
wxString msg;
FPID lastFPID;
std::vector< FPID > nofoundFootprints; // A list of footprints used in netlist
// but not found in any library
// to avoid a full search in all libs
// each time a non existent footprint is needed
COMPONENT* component;
MODULE* module = 0;
MODULE* fpOnBoard;
if( aNetlist.IsEmpty() )
return;
aNetlist.SortByFPID();
wxString libPath;
wxFileName fn;
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
for( unsigned ii = 0; ii < aNetlist.GetCount(); ii++ )
{
component = aNetlist.GetComponent( ii );
if( component->GetFPID().empty() )
{
if( aReporter )
{
msg.Printf( _( "No footprint defined for component '%s'.\n" ),
GetChars( component->GetReference() ) );
aReporter->Report( msg );
}
continue;
}
// Check if component footprint is already on BOARD and only load the footprint from
// the library if it's needed.
if( aNetlist.IsFindByTimeStamp() )
fpOnBoard = m_Pcb->FindModule( aNetlist.GetComponent( ii )->GetTimeStamp(), true );
else
fpOnBoard = m_Pcb->FindModule( aNetlist.GetComponent( ii )->GetReference() );
bool footprintMisMatch = fpOnBoard &&
fpOnBoard->GetFPID() != component->GetFPID();
if( footprintMisMatch && !aNetlist.GetReplaceFootprints() )
{
if( aReporter )
{
msg.Printf( _( "* Warning: component '%s' has footprint '%s' and should be '%s'\n" ),
GetChars( component->GetReference() ),
fpOnBoard->GetFPID().Format().c_str(),
component->GetFPID().GetFootprintName().c_str() );
aReporter->Report( msg );
}
continue;
}
if( !aNetlist.GetReplaceFootprints() )
footprintMisMatch = false;
bool loadFootprint = (fpOnBoard == NULL) || footprintMisMatch;
if( loadFootprint && (component->GetFPID() != lastFPID) )
{
module = NULL;
// Speed up the search: a search for a non existent footprint
// is hightly costly in time becuse the full set of libs is read.
// So it should be made only once.
// Therefore search in not found list first:
bool alreadySearched = false;
for( unsigned ii = 0; ii < nofoundFootprints.size(); ii++ )
{
if( component->GetFPID() == nofoundFootprints[ii] )
{
alreadySearched = true;
break;
}
}
if( alreadySearched )
continue;
for( unsigned ii = 0; ii < g_LibraryNames.GetCount(); ii++ )
{
fn = wxFileName( wxEmptyString, g_LibraryNames[ii],
LegacyFootprintLibPathExtension );
libPath = wxGetApp().FindLibraryPath( fn );
if( !libPath )
{
if( aReporter )
{
msg.Printf( _( "*** Warning: Cannot find footprint library file \"%s\" "
"in any of the standard KiCad library search paths. ***\n" ),
GetChars( fn.GetFullPath() ) );
aReporter->Report( msg );
}
continue;
}
module = pi->FootprintLoad( libPath,
FROM_UTF8( component->GetFPID().GetFootprintName().c_str() ) );
if( module )
{
lastFPID = component->GetFPID();
break;
}
}
if( module == NULL && !alreadySearched )
{
if( aReporter )
{
msg.Printf( _( "*** Warning: component '%s' footprint '%s' was not found in "
"any libraries. ***\n" ),
GetChars( component->GetReference() ),
component->GetFPID().GetFootprintName().c_str() );
aReporter->Report( msg );
}
nofoundFootprints.push_back( component->GetFPID() );
continue;
}
}
else
{
// Footprint already loaded from a library, duplicate it (faster)
if( module == NULL )
continue; // Module does not exist in any library.
module = new MODULE( *module );
}
if( loadFootprint && module != NULL )
component->SetModule( module );
}
}
#else
#define ALLOW_PARTIAL_FPID 1 #define ALLOW_PARTIAL_FPID 1
void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter ) void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
throw( IO_ERROR, PARSE_ERROR ) throw( IO_ERROR, PARSE_ERROR )
{ {
@ -444,4 +288,3 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
} }
} }
#endif

View File

@ -315,10 +315,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_microWaveToolBar = NULL; m_microWaveToolBar = NULL;
m_useCmpFileForFpNames = true; m_useCmpFileForFpNames = true;
#if defined( USE_FP_LIB_TABLE )
m_footprintLibTable = NULL; m_footprintLibTable = NULL;
m_globalFootprintTable = NULL; m_globalFootprintTable = NULL;
#endif
#ifdef KICAD_SCRIPTING_WXPYTHON #ifdef KICAD_SCRIPTING_WXPYTHON
m_pythonPanel = NULL; m_pythonPanel = NULL;
@ -471,7 +469,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_auimgr.Update(); m_auimgr.Update();
#if defined( USE_FP_LIB_TABLE )
if( m_globalFootprintTable == NULL ) if( m_globalFootprintTable == NULL )
{ {
try try
@ -499,7 +496,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
DisplayError( this, msg ); DisplayError( this, msg );
} }
} }
#endif
setupTools(); setupTools();
} }
@ -515,10 +511,8 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
delete m_drc; delete m_drc;
#if defined( USE_FP_LIB_TABLE )
delete m_footprintLibTable; delete m_footprintLibTable;
delete m_globalFootprintTable; delete m_globalFootprintTable;
#endif
} }

View File

@ -213,10 +213,8 @@ bool EDA_APP::OnInit()
* display the real hotkeys in menus or tool tips */ * display the real hotkeys in menus or tool tips */
ReadHotkeyConfig( wxT( "PcbFrame" ), g_Board_Editor_Hokeys_Descr ); ReadHotkeyConfig( wxT( "PcbFrame" ), g_Board_Editor_Hokeys_Descr );
#if defined( USE_FP_LIB_TABLE )
// Set any environment variables before loading FP_LIB_TABLE // Set any environment variables before loading FP_LIB_TABLE
SetFootprintLibTablePath(); SetFootprintLibTablePath();
#endif
frame = new PCB_EDIT_FRAME( NULL, wxT( "Pcbnew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) ); frame = new PCB_EDIT_FRAME( NULL, wxT( "Pcbnew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );

View File

@ -256,7 +256,6 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
// Check if a project footprint table is defined and load it. If no project footprint // Check if a project footprint table is defined and load it. If no project footprint
// table is defined, then the global library table is the footprint library table. // table is defined, then the global library table is the footprint library table.
#if defined( USE_FP_LIB_TABLE )
FP_LIB_TABLE::SetProjectPathEnvVariable( fn ); FP_LIB_TABLE::SetProjectPathEnvVariable( fn );
delete m_footprintLibTable; delete m_footprintLibTable;
@ -284,7 +283,6 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
if( viewFrame ) if( viewFrame )
viewFrame->SetFootprintLibTable( m_footprintLibTable ); viewFrame->SetFootprintLibTable( m_footprintLibTable );
#endif
// Load the page layout decr file, from the filename stored in // Load the page layout decr file, from the filename stored in
// BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file // BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file

View File

@ -397,11 +397,7 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* aModule,
wxString moduleName = FROM_UTF8( aNewFootprintFPID.GetFootprintName().c_str() ); wxString moduleName = FROM_UTF8( aNewFootprintFPID.GetFootprintName().c_str() );
wxString libName = FROM_UTF8( aNewFootprintFPID.GetLibNickname().c_str() ); wxString libName = FROM_UTF8( aNewFootprintFPID.GetLibNickname().c_str() );
#if !defined( USE_FP_LIB_TABLE )
newModule = m_parent->GetModuleLibrary( libName, moduleName, aShowError );
#else
newModule = m_parent->LoadFootprint( aNewFootprintFPID ); newModule = m_parent->LoadFootprint( aNewFootprintFPID );
#endif
if( newModule == NULL ) // New module not found, redraw the old one. if( newModule == NULL ) // New module not found, redraw the old one.
{ {

View File

@ -30,7 +30,6 @@ WORKING_TREES=~/kicad_sources
# CMake Options # CMake Options
OPTS="$OPTS -DCMAKE_BUILD_TYPE=Release" OPTS="$OPTS -DCMAKE_BUILD_TYPE=Release"
OPTS="$OPTS -DUSE_FP_LIB_TABLE=ON"
OPTS="$OPTS -DBUILD_GITHUB_PLUGIN=ON" OPTS="$OPTS -DBUILD_GITHUB_PLUGIN=ON"
# Python scripting, uncomment to enable # Python scripting, uncomment to enable