Add converted footprint library to library table during Eagle project.
This commit is contained in:
parent
a6c436c2cd
commit
864c152a5b
|
@ -879,7 +879,49 @@ bool PCB_EDIT_FRAME::ImportFile( const wxString& aFileName, int aFileType )
|
||||||
GetBoard()->SetFileName( newfilename.GetFullPath() );
|
GetBoard()->SetFileName( newfilename.GetFullPath() );
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
|
|
||||||
ArchiveModulesOnBoard( true, newfilename.GetName() );
|
wxString newLibPath;
|
||||||
|
ArchiveModulesOnBoard( true, newfilename.GetName(), &newLibPath );
|
||||||
|
|
||||||
|
if( newLibPath.Length()>0 )
|
||||||
|
{
|
||||||
|
FP_LIB_TABLE* prjlibtable = Prj().PcbFootprintLibs();
|
||||||
|
const wxString& project_env = PROJECT_VAR_NAME;
|
||||||
|
wxString rel_path;
|
||||||
|
wxString env_path;
|
||||||
|
|
||||||
|
wxGetEnv( project_env, &env_path );
|
||||||
|
|
||||||
|
wxString result( newLibPath );
|
||||||
|
rel_path = result.Replace( env_path, wxString( "$(" + project_env + ")" ) ) ? result : "" ;
|
||||||
|
|
||||||
|
if( !rel_path.IsEmpty() ) newLibPath = rel_path;
|
||||||
|
|
||||||
|
FP_LIB_TABLE_ROW* row = new FP_LIB_TABLE_ROW( newfilename.GetName(),
|
||||||
|
newLibPath,
|
||||||
|
wxT( "KiCad" ),
|
||||||
|
wxEmptyString ); // options
|
||||||
|
prjlibtable->InsertRow( row );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !GetBoard()->GetFileName().IsEmpty() )
|
||||||
|
{
|
||||||
|
wxString tblName = Prj().FootprintLibTblName();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Prj().PcbFootprintLibs()->Save( tblName );
|
||||||
|
}
|
||||||
|
catch( const IO_ERROR& ioe )
|
||||||
|
{
|
||||||
|
wxString msg = wxString::Format( _(
|
||||||
|
"Error occurred saving project specific footprint library "
|
||||||
|
"table:\n\n%s" ),
|
||||||
|
GetChars( ioe.What() )
|
||||||
|
);
|
||||||
|
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -588,7 +588,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString& aLibName )
|
void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString& aLibName, wxString* aLibPath )
|
||||||
{
|
{
|
||||||
if( GetBoard()->m_Modules == NULL )
|
if( GetBoard()->m_Modules == NULL )
|
||||||
{
|
{
|
||||||
|
@ -634,6 +634,9 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString&
|
||||||
if( libPath.IsEmpty() ) // Aborted
|
if( libPath.IsEmpty() ) // Aborted
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
if( aLibPath ) *aLibPath = libPath;
|
||||||
|
|
||||||
IO_MGR::PCB_FILE_T piType = IO_MGR::KICAD_SEXP;
|
IO_MGR::PCB_FILE_T piType = IO_MGR::KICAD_SEXP;
|
||||||
PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
|
PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) );
|
||||||
|
|
||||||
|
|
|
@ -938,7 +938,7 @@ public:
|
||||||
* optional library name to create, stops dialog call.
|
* optional library name to create, stops dialog call.
|
||||||
* must be called with aStoreInNewLib as true
|
* must be called with aStoreInNewLib as true
|
||||||
*/
|
*/
|
||||||
void ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString& aLibName = wxEmptyString );
|
void ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString& aLibName = wxEmptyString , wxString* aLibPath = NULL );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function RecreateBOMFileFromBoard
|
* Function RecreateBOMFileFromBoard
|
||||||
|
|
Loading…
Reference in New Issue