From c5508f34b33d169d7b36cb285c1a4c7c3ed8e0f1 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 29 Apr 2013 17:00:24 -0400 Subject: [PATCH] Pcbnew bug and warning fixes. * Fixed a bug in PCB_EDIT_FRAME::loadFootprints when no footprint libraries are found when attempting to load footprints. * Add a warning to PCB_EDIT_FRAME::loadFootprints to inform the user when a footprint library file cannot be found in any of the standard library search paths. * Changed FOOTPRINT_INFO::m_padCount to unsigned to prevent signed/unsigned comparison compiler warnings. * Put NestedSpace() function in netlist_reader.cpp inside conditional debug build statement to prevent warning in release builds. --- include/footprint_info.h | 4 ++-- pcbnew/netlist.cpp | 16 +++++++++++++--- pcbnew/netlist_reader.cpp | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/footprint_info.h b/include/footprint_info.h index 4684e34092..e76a881fe5 100644 --- a/include/footprint_info.h +++ b/include/footprint_info.h @@ -23,7 +23,7 @@ public: int m_Num; ///< Order number in the display list. wxString m_Doc; ///< Footprint description. wxString m_KeyWord; ///< Footprint key words. - int m_padCount; ///< Number of pads + unsigned m_padCount; ///< Number of pads FOOTPRINT_INFO() { @@ -80,7 +80,7 @@ public: */ void AddItem( FOOTPRINT_INFO* aItem ) { - m_List.push_back( aItem); + m_List.push_back( aItem ); } /** diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index b664b636e6..d0464e0809 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -188,7 +188,7 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter ) else fpOnBoard = m_Pcb->FindModule( aNetlist.GetComponent( ii )->GetReference() ); - loadFootprint = (fpOnBoard != NULL) && + loadFootprint = (fpOnBoard == NULL) || (fpOnBoard->GetPath() != component->GetFootprintName()); if( loadFootprint && (component->GetFootprintName() != lastFootprintLibName) ) @@ -203,7 +203,17 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter ) libPath = wxGetApp().FindLibraryPath( fn ); if( !libPath ) + { + if( aReporter ) + { + msg.Printf( _( "*** Warning: Cannot find footprint library file \"%s\" " + "in any of the standard KiCad library search paths. ***\n" ), + GetChars( fn.GetFullPath() ) ); + aReporter->Report( msg ); + } + continue; + } module = pi->FootprintLoad( libPath, component->GetFootprintName() ); @@ -238,7 +248,7 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter ) module = new MODULE( *module ); } - wxASSERT( module != NULL ); - component->SetModule( module ); + if( loadFootprint && module != NULL ) + component->SetModule( module ); } } diff --git a/pcbnew/netlist_reader.cpp b/pcbnew/netlist_reader.cpp index 7a52e7e35a..8f127e2d2a 100644 --- a/pcbnew/netlist_reader.cpp +++ b/pcbnew/netlist_reader.cpp @@ -37,6 +37,7 @@ #include +#if defined(DEBUG) /** * Function NestedSpace * outputs nested space for pretty indenting. @@ -53,7 +54,6 @@ static REPORTER& NestedSpace( int aNestLevel, REPORTER& aReporter ) } -#if defined(DEBUG) void COMPONENT_NET::Show( int aNestLevel, REPORTER& aReporter ) { NestedSpace( aNestLevel, aReporter );