Bruteforce module update after a netlist reload.

This commit is contained in:
Maciej Suminski 2014-04-04 17:42:35 +02:00
parent a6917280fe
commit a0fb4ed0c1
2 changed files with 21 additions and 1 deletions

View File

@ -1475,7 +1475,7 @@ public:
/**
* Function ReadPcbNetlist
* reads \a aNetlistFileName and ppdates the footprints (load missing footprints and
* reads \a aNetlistFileName and updates the footprints (load missing footprints and
* delete on demand extra footprints) on the board.
* Update connectivity info, references, values and "TIME STAMP"
*

View File

@ -27,9 +27,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <boost/bind.hpp>
#include <fctsys.h>
#include <pgm_base.h>
#include <class_drawpanel.h>
#include <class_draw_panel_gal.h>
#include <confirm.h>
#include <dialog_helpers.h>
#include <wxPcbStruct.h>
@ -59,6 +61,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
wxString msg;
NETLIST netlist;
NETLIST_READER* netlistReader;
KIGFX::VIEW* view = GetGalCanvas()->GetView();
netlist.SetIsDryRun( aIsDryRun );
netlist.SetFindByTimeStamp( aSelectByTimeStamp );
@ -93,6 +96,16 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
if( !netlist.IsDryRun() )
GetScreen()->ClearUndoRedoList();
if( !netlist.IsDryRun() )
{
// Remove old modules
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
{
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Remove, view, _1 ) );
view->Remove( module );
}
}
netlist.SortByReference();
GetBoard()->ReplaceNetlist( netlist, aDeleteSinglePadNets, aReporter );
@ -104,6 +117,13 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
SetCurItem( NULL );
// Reload modules
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
{
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
GetGalCanvas()->GetView()->Add( module );
}
if( aDeleteUnconnectedTracks && GetBoard()->m_Track )
{
// Remove erroneous tracks. This should probably pushed down to the #BOARD object.