From a0fb4ed0c1112603077b2611af7fa48577522942 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 4 Apr 2014 17:42:35 +0200 Subject: [PATCH] Bruteforce module update after a netlist reload. --- include/wxPcbStruct.h | 2 +- pcbnew/netlist.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index f382658ee3..e0334d4e6c 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -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" * diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 258bea0c8f..764b5fbe5c 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -27,9 +27,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include #include #include +#include #include #include #include @@ -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.