Footprint library table ground work.

* Remove defined CMAKE_INSTALL_PREFIX for Windows from main CMakeList.txt.
* Move footprint library path detection code from pcbnew.cpp to EDA_APP
  object.
* Add CMAKE_INSTALL_PREFIX to config.h.cmake.
* Simplify and fix search path list code.
* Add CMAKE_INSTALL_PREFIX to the list of search paths in case KiCad was
  installed using `make install`.
* Add default global footprint library table to CMake install.
* Add method to set footprint library table to PCB_BASE_FRAME object.
* Remove unused function EDA_APP::GetLibraryFile().
* Minor FP_LIB_TABLE object improvements.
This commit is contained in:
Wayne Stambaugh 2013-09-06 08:17:33 -04:00
parent 36ae78ff94
commit 9ab7c18f46
14 changed files with 256 additions and 126 deletions

View File

@ -197,10 +197,14 @@ else()
endif()
endif()
#================================================
# Locations for install targets.
set( KICAD_BIN bin
CACHE PATH "Location of KiCad binaries." )
set( KICAD_FP_LIB_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}"
CACHE PATH "Default path where footprint libraries are installed." )
if( UNIX )
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
set( KICAD_PLUGINS lib/kicad/plugins
@ -209,12 +213,10 @@ if( UNIX )
CACHE PATH "Location of KiCad data files." )
set( KICAD_DOCS share/doc/kicad
CACHE PATH "Location of KiCad documentation files." )
set( KICAD_FP_LIB_INSTALL_PATH "${KICAD_FP_LIB_INSTALL_PATH}/share/kicad/modules" )
endif()
if( MINGW )
# Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line.
set( CMAKE_INSTALL_PREFIX c:/kicad
CACHE PATH "" )
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
set( KICAD_PLUGINS ${KICAD_BIN}/plugins
CACHE PATH "Location of KiCad plugins." )
@ -222,6 +224,7 @@ if( MINGW )
CACHE PATH "Location of KiCad data files." )
set( KICAD_DOCS doc
CACHE PATH "Location of KiCad documentation files." )
set( KICAD_FP_LIB_INSTALL_PATH "${KICAD_FP_LIB_INSTALL_PATH}/modules" )
endif()
set( KICAD_DEMOS ${KICAD_DATA}/demos

View File

@ -81,6 +81,12 @@
/// Definition to compile with Pcbnew footprint library table implementation.
#cmakedefine USE_FP_LIB_TABLE
/// The install prefix defined in CMAKE_INSTALL_PREFIX.
#define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX"
/// Default footprint library install path when installed with `make install`.
#define DEFAULT_FP_LIB_PATH "@KICAD_FP_LIB_INSTALL_PATH@"
/// When defined, build the GITHUB_PLUGIN for pcbnew.
#cmakedefine BUILD_GITHUB_PLUGIN

View File

@ -64,18 +64,16 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" );
* the size of the array. */
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / sizeof( struct LANGUAGE_DESCR ) )
// Default font size
#define FONT_DEFAULT_SIZE 10 // Default font size.
// some key strings used to store parameters in config
static wxString backgroundColorKey( wxT( "BackgroundColor" ) );
static wxString showPageLimitsKey( wxT( "ShowPageLimits" ) );
static wxString workingDirKey( wxT( "WorkingDir" ) ) ;
static wxString languageCfgKey( wxT( "LanguageID" ) );
static wxString kicadFpLibPath( wxT( "KicadFootprintLibraryPath" ) );
/**
* The real font size will be computed at run time
* A small class to handle the list on existing translations.
* the locale translation is automatic.
* the selection of languages is mainly for maintainer's convenience
@ -354,7 +352,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
wxImage::AddHandler( new wxJPEGHandler );
wxFileSystem::AddHandler( new wxZipFSHandler );
// Analise the command line & init binary path
// Analyze the command line & init binary path
SetBinDir();
SetDefaultSearchPaths();
SetLanguagePath();
@ -496,24 +494,20 @@ void EDA_APP::SetDefaultSearchPaths( void )
* if the user is savvy enough to set an environment variable they know
* what they are doing. */
if( ::wxGetEnv( wxT( "KICAD" ), NULL ) )
m_searchPaths.AddEnvList( wxT( "KICAD" ) );
tmp.AddEnvList( wxT( "KICAD" ) );
// Add the user's home path.
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetUserDataDir() );
tmp.Add( GetTraits()->GetStandardPaths().GetUserDataDir() );
// Standard application data path if it is different from the binary path.
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
{
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
tmp.Add( GetTraits()->GetStandardPaths().GetDataDir() );
}
// Up one level relative to binary path with "share" appended for Windows.
fn.RemoveLastDir();
m_searchPaths.Add( fn.GetPath() );
fn.AppendDir( wxT( "share" ) );
m_searchPaths.Add( fn.GetPath() );
fn.AppendDir( wxT( "kicad" ) );
m_searchPaths.Add( fn.GetPath() );
tmp.Add( fn.GetPath() );
/* The normal OS program file install paths allow for binary to be
* installed in a different path from the library files. This is
@ -524,13 +518,16 @@ void EDA_APP::SetDefaultSearchPaths( void )
#ifdef __WXMSW__
tmp.AddEnvList( wxT( "PROGRAMFILES" ) );
#elif __WXMAC__
m_searchPaths.Add( wxT( "/Library/Application Support/kicad" ) );
m_searchPaths.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) +
wxT("/Library/Application Support/kicad") );
tmp.Add( wxT( "/Library/Application Support" ) );
tmp.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT( "/Library/Application Support" ) );
#else
tmp.AddEnvList( wxT( "PATH" ) );
#endif
// This is the equivalent of CMAKE_INSTALL_PREFIX. Useful when installed by `make install`.
tmp.Add( wxT( DEFAULT_INSTALL_PATH ) );
// Add kicad, kicad/share, share, and share/kicad to each possible base path.
for( i = 0; i < tmp.GetCount(); i++ )
{
fn = wxFileName( tmp[i], wxEmptyString );
@ -621,6 +618,13 @@ void EDA_APP::SetDefaultSearchPaths( void )
fn.RemoveLastDir();
}
}
#if 1 && defined( DEBUG )
wxLogDebug( wxT( "Library search paths:" ) );
for( unsigned i = 0; i < m_libSearchPaths.GetCount(); i++ )
wxLogDebug( wxT( " %s" ), GetChars( m_libSearchPaths[i] ) );
#endif
}
@ -662,11 +666,14 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
}
// FIXME OSX Mountain Lion (10.8)
// Seems that Read doesn't found anything and ColorFromInt Asserts - I'm unable to reproduce on 10.7
// In general terms i think is better have a failsafe default than an uninit variable
// Seems that Read doesn't found anything and ColorFromInt Asserts - I'm unable to reproduce
// on 10.7
// In general terms I think is better have a failsafe default than an uninit variable
int draw_bg_color = (int)BLACK; // Default for all apps but Eeschema
if( m_Id == APP_EESCHEMA_T )
draw_bg_color = (int)WHITE; // Default for Eeschema
m_settings->Read( backgroundColorKey, &draw_bg_color );
g_DrawBgColor = ColorFromInt( draw_bg_color );
@ -979,21 +986,6 @@ wxString EDA_APP::GetHelpFile( void )
}
wxString EDA_APP::GetLibraryFile( const wxString& filename )
{
wxArrayString subdirs;
subdirs.Add( wxT( "share" ) );
#ifndef __WXMSW__
/* Up on level relative to binary path with "share/kicad" appended for
* all other platforms. */
subdirs.Add( wxT( "kicad" ) );
#endif
return FindFileInSearchPaths( filename, &subdirs );
}
wxString EDA_APP::ReturnLastVisitedLibraryPath( const wxString& aSubPathToSearch )
{
if( !m_LastVisitedLibPath.IsEmpty() )
@ -1164,3 +1156,54 @@ bool EDA_APP::LockFile( const wxString& fileName )
return true;
}
bool EDA_APP::SetFootprintLibTablePath()
{
wxString path;
// Set the KISYSMOD environment variable for the current process if it is not already
// defined in the user's environment. This is required to expand the global footprint
// library table paths.
if( wxGetEnv( wxT( "KISYSMOD" ), &path ) && wxFileName::DirExists( path ) )
return true;
// Set the KISYSMOD environment variable to the path defined in the user's configuration
// if it is defined and the path exists.
if( m_commonSettings->Read( kicadFpLibPath, &path ) && wxFileName::DirExists( path ) )
{
wxSetEnv( wxT( "KISYSMOD" ), path );
wxLogDebug( wxT( "Setting $KISYSMOD=\"%s\"." ), GetChars( path ) );
return true;
}
// Attempt to determine where the footprint libraries were installed using the legacy
// library search paths.
if( !GetLibraryPathList().IsEmpty() )
{
unsigned modFileCount = 0;
wxString bestPath;
wxArrayString tmp;
for( unsigned i = 0; i < GetLibraryPathList().GetCount(); i++ )
{
unsigned cnt = wxDir::GetAllFiles( GetLibraryPathList()[i], &tmp, wxT( "*.mod" ),
wxDIR_DEFAULT & ~wxDIR_HIDDEN );
if( cnt > modFileCount )
{
modFileCount = cnt;
bestPath = GetLibraryPathList()[i];
}
}
if( modFileCount != 0 )
{
wxLogDebug( wxT( "Setting $KISYSMOD=\"%s\"." ), GetChars( bestPath ) );
wxSetEnv( wxT( "KISYSMOD" ), bestPath );
return true;
}
}
return false;
}

View File

@ -30,6 +30,7 @@
#include <set>
#include <appl_wxstruct.h>
#include <fp_lib_table_lexer.h>
#include <fp_lib_table.h>
@ -319,23 +320,38 @@ bool FP_LIB_TABLE::IsEmpty() const
}
void FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR )
bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR )
{
bool tableExists = true;
wxFileName fn = GetGlobalTableFileName();
wxLogDebug( wxT( "Loading global footprint table file: %s" ), GetChars( fn.GetFullPath() ) );
if( !fn.FileExists() )
{
/// @todo call some script to create initial global footprint table.
}
else
tableExists = false;
// Attempt to copy the default global file table from the KiCad template folder to
// the users home configuration path.
wxString fileName( wxT( "fp_global_table" ) );
fileName = wxGetApp().FindLibraryPath( fileName );
wxLogDebug( wxT( "Copying global footprint table from <%s>." ), GetChars( fileName ) );
// The fallback is to create an empty global footprint table for the user to populate.
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
{
FP_LIB_TABLE emptyTable;
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
emptyTable.Format( &sf, 0 );
}
}
FILE_LINE_READER reader( fn.GetFullPath() );
FP_LIB_TABLE_LEXER lexer( &reader );
aTable.Parse( &lexer );
}
return tableExists;
}
@ -357,7 +373,26 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
wxString FP_LIB_TABLE::GetFileName()
{
return wxString( wxT( ".fp-lib-table" ) );
return wxString( wxT( "fp-lib-table" ) );
}
void FP_LIB_TABLE::Load( const wxFileName& aFileName, FP_LIB_TABLE* aFallBackTable )
throw( IO_ERROR )
{
wxFileName fn = aFileName;
fallBack = aFallBackTable;
fn.SetName( FP_LIB_TABLE::GetFileName() );
fn.SetExt( wxEmptyString );
if( fn.FileExists() )
{
FILE_LINE_READER reader( fn.GetFullPath() );
FP_LIB_TABLE_LEXER lexer( &reader );
Parse( &lexer );
}
}

View File

@ -1,3 +1,27 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file cvpcb.cpp
*/
@ -22,7 +46,7 @@
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
/* Constant string definitions for CvPcb */
// Constant string definitions for CvPcb
const wxString RetroFileExtension( wxT( "stf" ) );
const wxString FootprintAliasFileExtension( wxT( "equ" ) );
@ -36,7 +60,7 @@ const wxString titleLibLoadError( _( "Library Load Error" ) );
* MacOSX: Needed for file association
* http://wiki.wxwidgets.org/WxMac-specific_topics
*/
void EDA_APP::MacOpenFile(const wxString &fileName)
void EDA_APP::MacOpenFile( const wxString &fileName )
{
wxFileName filename = fileName;
wxString oldPath;
@ -48,7 +72,7 @@ void EDA_APP::MacOpenFile(const wxString &fileName)
if( frame->m_NetlistFileName.DirExists() )
oldPath = frame->m_NetlistFileName.GetPath();
/* Update the library search path list. */
// Update the library search path list.
if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
wxGetApp().GetLibraryPathList().Remove( oldPath );
@ -58,6 +82,7 @@ void EDA_APP::MacOpenFile(const wxString &fileName)
frame->ReadNetListAndLinkFiles();
}
// Create a new application object
IMPLEMENT_APP( EDA_APP )
@ -74,6 +99,10 @@ bool EDA_APP::OnInit()
InitEDA_Appl( wxT( "CvPcb" ), APP_CVPCB_T );
#if defined( USE_FP_LIB_TABLE )
SetFootprintLibTablePath();
#endif
if( m_Checker && m_Checker->IsAnotherRunning() )
{
if( !IsOK( NULL, _( "CvPcb is already running, Continue?" ) ) )
@ -88,7 +117,7 @@ bool EDA_APP::OnInit()
// read current setup and reopen last directory if no filename to open in command line
bool reopenLastUsedDirectory = argc == 1;
GetSettings(reopenLastUsedDirectory);
GetSettings( reopenLastUsedDirectory );
g_DrawBgColor = BLACK;
@ -97,15 +126,13 @@ bool EDA_APP::OnInit()
// Show the frame
SetTopWindow( frame );
frame->LoadProjectFile( filename.GetFullPath() );
frame->Show( true );
frame->BuildFOOTPRINTS_LISTBOX();
frame->BuildLIBRARY_LISTBOX();
frame->m_NetlistFileExtension = wxT( "net" );
if( filename.IsOk() && filename.FileExists() )
{
frame->m_NetlistFileName = filename;
frame->LoadProjectFile( filename.GetFullPath() );
if( frame->ReadNetListAndLinkFiles() )
{
@ -114,9 +141,6 @@ bool EDA_APP::OnInit()
}
}
frame->LoadFootprintFiles();
frame->m_NetlistFileExtension = wxT( "net" );
frame->m_NetlistFileName.Clear();
frame->UpdateTitle();
return true;

View File

@ -344,8 +344,6 @@ public:
*/
wxString GetHelpFile( void );
wxString GetLibraryFile( const wxString& filename );
/**
* Return the preferred editor name.
*/
@ -414,6 +412,25 @@ public:
* @return false if the file was already locked, true otherwise.
*/
bool LockFile( const wxString& fileName );
/**
* Function SetFootprintLibTableEnv
* attempts set the KISYSMOD environment variable to the best possible path.
*
* The path is determined by attempting to find the path with the most footprint library
* files. This may or may not be the best path but it provides the best solution for
* backwards compatibility with the previous library search path implementation. If the
* KISYSMOD environment variable is already set, then it left as is to respect the wishes
* of the user.
*
* @note This must be called after #SetDefaultSearchPaths() is called. Otherwise, the
* list of library search paths will be empty and KISYSMOD will be undefined making
* it impossible for the footprint libraries to be loaded from the footprint library
* table.
*
* @return false if the KISYSMOD path is not valid.
*/
bool SetFootprintLibTablePath();
};

View File

@ -379,8 +379,11 @@ public:
* time being.
*
* @param aTable the #FP_LIB_TABLE object to load.
* @return true if the global library table exists and is loaded properly.
* @throw IO_ERROR if an error occurs attempting to load the footprint library
* table.
*/
static void LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR );
static bool LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR );
/**
* Function GetGlobalTableFileName
@ -394,6 +397,18 @@ public:
*/
static wxString GetFileName();
/**
* Function Load
* loads the footprint library table using the path defined in \a aFileName with
* \a aFallBackTable.
*
* @param aFileName contains the path and possible the file name and extension.
* @param aFallBackTable the fall back footprint library table which can be NULL.
* @throw IO_ERROR if an error occurs attempting to load the footprint library
* table.
*/
void Load( const wxFileName& aFileName, FP_LIB_TABLE* aFallBackTable ) throw( IO_ERROR );
protected:
/**

View File

@ -173,6 +173,17 @@ public:
return m_Pcb;
}
/**
* Function SetFootprintLibTable
* set the footprint library table to \a aFootprintLibTable.
*
* @param aFootprintLibTable is a pointer to the #FP_LIB_TABLE object.
*/
void SetFootprintLibTable( FP_LIB_TABLE* aFootprintLibTable )
{
m_footprintLibTable = aFootprintLibTable;
}
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }

View File

@ -202,12 +202,6 @@ protected:
*/
void duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone );
/**
* Function loadFootprintLibTable
* deletes the existing #FP_LIB_TABLE and creates a new one when a new project is loaded.
*/
void loadFootprintLibTable();
public:
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width

View File

@ -123,8 +123,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( PCB_BASE_FRAME* aParent,
PCB_BASE_FRAME( aParent, MODULE_VIEWER_FRAME_TYPE, _( "Footprint Library Browser" ),
wxDefaultPosition, wxDefaultSize, aStyle, GetFootprintViewerFrameName() )
{
wxASSERT( aTable != NULL );
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
m_footprintLibTable = aTable;

View File

@ -293,8 +293,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_RecordingMacros = -1;
m_microWaveToolBar = NULL;
m_useCmpFileForFpNames = true;
#if defined( USE_FP_LIB_TABLE )
m_footprintLibTable = NULL;
m_globalFootprintTable = NULL;
#endif
#ifdef KICAD_SCRIPTING_WXPYTHON
m_pythonPanel = NULL;
@ -443,12 +446,25 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_auimgr.Update();
#if defined( USE_FP_LIB_TABLE )
if( m_globalFootprintTable == NULL )
{
try
{
m_globalFootprintTable = new FP_LIB_TABLE();
FP_LIB_TABLE::LoadGlobalTable( *m_globalFootprintTable );
if( !FP_LIB_TABLE::LoadGlobalTable( *m_globalFootprintTable ) )
{
DisplayInfoMessage( this, wxT( "You have run Pcbnew for the first time using the "
"new footprint library table method for finding "
"footprints. Pcbnew has either copied the default "
"table or created an empty table in your home "
"folder. You must first configure the library "
"table to include all footprint libraries not "
"included with KiCad. See the \"Footprint Library "
"Table\" section of the CvPcb documentation for "
"more information." ) );
}
}
catch( IO_ERROR ioe )
{
@ -458,6 +474,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
DisplayError( this, msg );
}
}
#endif
}
@ -470,6 +487,7 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
m_Macros[i].m_Record.clear();
delete m_drc;
delete m_footprintLibTable;
delete m_globalFootprintTable;
}

View File

@ -206,30 +206,9 @@ bool EDA_APP::OnInit()
// Some will be overwritten after loading the board file
frame->LoadProjectSettings( fn.GetFullPath() );
// Set the KISYSMOD environment variable for the current process if it is not already
// defined in the user's environment. This is required to expand the global footprint
// library table paths.
if( !wxGetEnv( wxT( "KISYSMOD" ), &msg ) && !GetLibraryPathList().IsEmpty() )
{
unsigned modFileCount = 0;
wxString bestPath;
wxArrayString tmp;
for( unsigned i = 0; i < GetLibraryPathList().GetCount(); i++ )
{
unsigned cnt = wxDir::GetAllFiles( GetLibraryPathList()[i], &tmp,
wxT( "*.mod" ), wxDIR_DEFAULT & ~wxDIR_HIDDEN );
if( cnt > modFileCount )
{
modFileCount = cnt;
bestPath = GetLibraryPathList()[i];
}
}
wxLogDebug( wxT( "Setting $KISYSMOD=\"%s\"." ), GetChars( bestPath ) );
wxSetEnv( wxT( "KISYSMOD" ), bestPath );
}
#if defined( USE_FP_LIB_TABLE )
SetFootprintLibTablePath();
#endif
/* Load file specified in the command line. */
if( fn.IsOk() )

View File

@ -222,13 +222,30 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
SetElementVisibility( RATSNEST_VISIBLE, showRats );
#endif
fn = GetBoard()->GetFileName();
// 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.
#if defined( USE_FP_LIB_TABLE )
delete m_footprintLibTable;
m_footprintLibTable = new FP_LIB_TABLE();
try
{
m_footprintLibTable->Load( fn, m_globalFootprintTable );
}
catch( IO_ERROR ioe )
{
DisplayError( this, ioe.errorText );
}
#endif
// Load the page layout decr file, from the filename stored in
// BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
// If empty, the default descr is loaded
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
pglayout.SetPageLayout(BASE_SCREEN::m_PageLayoutDescrFileName);
loadFootprintLibTable();
pglayout.SetPageLayout( BASE_SCREEN::m_PageLayoutDescrFileName );
return true;
}
@ -550,32 +567,3 @@ void PCB_EDIT_FRAME::ReadMacros()
macrosNode = (XNODE*) macrosNode->GetNext();
}
}
void PCB_EDIT_FRAME::loadFootprintLibTable()
{
delete m_footprintLibTable;
wxFileName fn = GetBoard()->GetFileName();
fn.SetName( FP_LIB_TABLE::GetFileName() );
fn.SetExt( wxEmptyString );
// 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.
m_footprintLibTable = new FP_LIB_TABLE( m_globalFootprintTable );
if( fn.FileExists() )
{
try
{
FILE_LINE_READER reader( fn.GetFullPath() );
FP_LIB_TABLE_LEXER lexer( &reader );
m_footprintLibTable->Parse( &lexer );
}
catch( IO_ERROR ioe )
{
DisplayError( this, ioe.errorText );
}
}
}

View File

@ -1,4 +1,3 @@
install(FILES kicad.pro
install(FILES kicad.pro fp_global_table
DESTINATION ${KICAD_TEMPLATE}
COMPONENT resources)