Eeschema: fix Bug #1102381 <eeschema: -cache.lib file not created the first time you save a schematic>

This commit is contained in:
Jacobo Aragunde Perez 2013-01-21 20:58:02 +01:00 committed by jean-pierre charras
parent 273244a196
commit 2f3c5e7a1e
3 changed files with 29 additions and 5 deletions

View File

@ -166,7 +166,10 @@ void SCH_EDIT_FRAME::Save_File( wxCommandEvent& event )
break;
case ID_SAVE_ONE_SHEET_UNDER_NEW_NAME:
SaveEEFile( NULL, true );
if( SaveEEFile( NULL, true ) )
{
CreateArchiveLibraryCacheFile();
}
break;
}
}
@ -377,10 +380,7 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent )
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
SaveEEFile( screen );
wxString cachename = fn.GetName() + wxT( "-cache" );
fn.SetName( cachename );
fn.SetExt( SchematicLibraryFileExtension );
CreateArchiveLibrary( fn.GetFullPath() );
CreateArchiveLibraryCacheFile();
}

View File

@ -40,6 +40,21 @@
#include <protos.h>
#include <class_library.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <wildcards_and_files_ext.h>
bool SCH_EDIT_FRAME::CreateArchiveLibraryCacheFile()
{
wxFileName fn;
SCH_SCREENS ScreenList;
fn = ScreenList.GetFirst()->GetFileName();
fn.SetName( fn.GetName() + wxT( "-cache" ) );
fn.SetExt( SchematicLibraryFileExtension );
return CreateArchiveLibrary( fn.GetFullPath() );
}
bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )

View File

@ -1167,6 +1167,15 @@ public:
*/
void LoadLibraries( void );
/**
* Function CreateArchiveLibraryCacheFile
* creates a library file with the name of the root document plus the '-cache' suffix,
* That file will contain all components used in the current schematic.
*
* @return True if the file was written successfully.
*/
bool CreateArchiveLibraryCacheFile( void );
/**
* Function CreateArchiveLibrary
* creates a library \a aFileName that contains all components used in the current schematic.