Pcbnew footprint library table fixes.
* Make footprint editor work properly with library table. * Fix bug in Eagle plugin when comparing file timestamps. * Fix bug in footprint viewer when error occur loading footprints from the selected library. * Fix error message display by in footprint viewer on library load error.
This commit is contained in:
parent
de4cceb245
commit
076c2c762a
|
@ -93,6 +93,9 @@ typedef boost::optional<double> opt_double;
|
|||
typedef boost::optional<bool> opt_bool;
|
||||
|
||||
|
||||
const wxChar* traceEaglePlugin = wxT( "KicadEaglePlugin" );
|
||||
|
||||
|
||||
/// segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
|
||||
struct TRIPLET
|
||||
{
|
||||
|
@ -2731,15 +2734,17 @@ void EAGLE_PLUGIN::cacheLib( const wxString& aLibPath )
|
|||
{
|
||||
try
|
||||
{
|
||||
wxDateTime modtime;
|
||||
wxDateTime modtime = getModificationTime( aLibPath );
|
||||
|
||||
if( !m_mod_time.IsValid() )
|
||||
m_mod_time.Now();
|
||||
// Fixes assertions in wxWidgets debug builds for the wxDateTime object. Refresh the
|
||||
// cache if either of the wxDateTime objects are invalid or the last file modification
|
||||
// time differs from the current file modification time.
|
||||
bool load = !m_mod_time.IsValid() || !modtime.IsValid() ||
|
||||
m_mod_time != modtime;
|
||||
|
||||
if( aLibPath != m_lib_path ||
|
||||
m_mod_time != ( modtime = getModificationTime( aLibPath ) ) )
|
||||
if( aLibPath != m_lib_path || load )
|
||||
{
|
||||
//D(printf("Loading '%s'\n", TO_UTF8( aLibPath ) );)
|
||||
wxLogTrace( traceEaglePlugin, wxT( "Loading '%s'" ), TO_UTF8( aLibPath ) );
|
||||
|
||||
PTREE doc;
|
||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||
|
|
|
@ -825,20 +825,10 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
|
|||
wxString uri = m_footprintLibTable->FindRow( dlg.GetTextSelection() )->GetFullURI();
|
||||
wxFileName fileName = FP_LIB_TABLE::ExpandSubstitutions( uri );
|
||||
|
||||
if( fileName.IsOk() && fileName.FileExists() )
|
||||
{
|
||||
wxLogDebug( wxT( "Loading footprint library <%s> from <%s>." ),
|
||||
GetChars( dlg.GetTextSelection() ), GetChars( fileName.GetFullPath() ) );
|
||||
|
||||
setLibPath( fileName.GetFullPath() );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString msg = wxString::Format( FMT_BAD_PATHS, GetChars( dlg.GetTextSelection() ) );
|
||||
|
||||
DisplayError( this, msg );
|
||||
|
||||
setLibNickName( wxEmptyString );
|
||||
setLibPath( wxEmptyString );
|
||||
}
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
|
|
|
@ -511,7 +511,21 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
|
|||
return wxEmptyString;
|
||||
}
|
||||
|
||||
MList.ReadFootprintFiles( libTable );
|
||||
if( !MList.ReadFootprintFiles( libTable ) )
|
||||
{
|
||||
msg.Format( _( "Error occurred attempting to load footprint library <%s>:\n\n" ),
|
||||
GetChars( aLibraryFullFilename ) );
|
||||
|
||||
if( !MList.m_filesNotFound.IsEmpty() )
|
||||
msg += _( "Files not found:\n\n" ) + MList.m_filesNotFound;
|
||||
|
||||
if( !MList.m_filesInvalid.IsEmpty() )
|
||||
msg += _("\n\nFile load errors:\n\n" ) + MList.m_filesInvalid;
|
||||
|
||||
DisplayError( this, msg );
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if( MList.GetCount() == 0 )
|
||||
|
|
|
@ -429,7 +429,6 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
|
|||
bool libLoaded = false;
|
||||
FOOTPRINT_LIST fp_info_list;
|
||||
wxArrayString libsList;
|
||||
wxBusyCursor busyCursor;
|
||||
|
||||
#if !defined( USE_FP_LIB_TABLE )
|
||||
libsList.Add( m_libraryName );
|
||||
|
@ -453,11 +452,18 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
|
|||
|
||||
if( !libLoaded )
|
||||
{
|
||||
m_libraryName = wxEmptyString;
|
||||
|
||||
wxString msg;
|
||||
msg.Format( _( "Error occurred attempting to load footprint library <%s>:\n\n"
|
||||
"Files not found:\n\n%s\n\nFile load errors:\n\n%s" ),
|
||||
GetChars( m_libraryName ), GetChars( fp_info_list.m_filesNotFound ),
|
||||
GetChars( fp_info_list.m_filesInvalid ) );
|
||||
msg.Format( _( "Error occurred attempting to load footprint library <%s>:\n\n" ),
|
||||
GetChars( m_libraryName ) );
|
||||
|
||||
if( !fp_info_list.m_filesNotFound.IsEmpty() )
|
||||
msg += _( "Files not found:\n\n" ) + fp_info_list.m_filesNotFound;
|
||||
|
||||
if( !fp_info_list.m_filesInvalid.IsEmpty() )
|
||||
msg += _("\n\nFile load errors:\n\n" ) + fp_info_list.m_filesInvalid;
|
||||
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
@ -502,6 +508,9 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event )
|
|||
|
||||
void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
|
||||
{
|
||||
if( m_FootprintList->GetCount() == 0 )
|
||||
return;
|
||||
|
||||
int ii = m_FootprintList->GetSelection();
|
||||
|
||||
if( ii < 0 )
|
||||
|
|
Loading…
Reference in New Issue