Commit c3c6b9ef authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Now, archive modules function archives footprints with default...

Pcbnew: Now, archive modules function archives footprints with default orientation (0 degrees) and default side (Front layer)
parent 9cc4f5d0
...@@ -370,7 +370,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( const wxString& aLibName, bool aNewM ...@@ -370,7 +370,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( const wxString& aLibName, bool aNewM
{ {
wxFileDialog dlg( this, _( "Library" ), path, wxFileDialog dlg( this, _( "Library" ), path,
wxEmptyString, ModuleFileWildcard, wxEmptyString, ModuleFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
...@@ -413,12 +413,26 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( const wxString& aLibName, bool aNewM ...@@ -413,12 +413,26 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( const wxString& aLibName, bool aNewM
fclose( lib_module ); fclose( lib_module );
} }
MODULE* Module = (MODULE*) GetBoard()->m_Modules; MODULE* module = (MODULE*) GetBoard()->m_Modules;
for( int ii = 1; Module != NULL; ii++, Module = Module->Next() ) for( int ii = 1; module != NULL; ii++, module = module->Next() )
{ {
if( Save_Module_In_Library( fileName, Module, // Save footprints in default orientation (0.0) and default layer (FRONT layer)
aNewModulesOnly ? false : true, int orient = module->GetOrientation();
false ) == 0 ) if ( orient != 0 )
module->SetOrientation( 0 );
int layer = module->GetLayer();
if(layer != LAYER_N_FRONT )
module->Flip( module->m_Pos );
bool success = Save_Module_In_Library( fileName, module,
aNewModulesOnly ? false : true, false );
// Restore previous orientation and/or side
if(layer != module->GetLayer() )
module->Flip( module->m_Pos );
if ( orient != 0 )
module->SetOrientation( orient );
if( !success )
break; break;
/* Check for request to stop backup (ESCAPE key actuated) */ /* Check for request to stop backup (ESCAPE key actuated) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment