From 1e054071fcbb3fb48fed2a7c49ba4fcc9edffa76 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 15 Feb 2018 09:49:53 +0100 Subject: [PATCH] Refresh track & via net names after netlist update Fixes: lp:1749411 * https://bugs.launchpad.net/kicad/+bug/1749411 --- pcbnew/dialogs/dialog_update_pcb.cpp | 18 +++++++++++++----- pcbnew/netlist.cpp | 4 ++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pcbnew/dialogs/dialog_update_pcb.cpp b/pcbnew/dialogs/dialog_update_pcb.cpp index 9dddb61081..0d2221f365 100644 --- a/pcbnew/dialogs/dialog_update_pcb.cpp +++ b/pcbnew/dialogs/dialog_update_pcb.cpp @@ -37,14 +37,15 @@ #include #include #include +#include #include using namespace std::placeholders; -DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST *aNetlist ) : - DIALOG_UPDATE_PCB_BASE ( aParent ), - m_frame (aParent), - m_netlist (aNetlist) +DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist ) : + DIALOG_UPDATE_PCB_BASE( aParent ), + m_frame( aParent ), + m_netlist( aNetlist ) { m_messagePanel->SetLabel( _("Changes to be applied:") ); m_messagePanel->SetLazyUpdate( true ); @@ -98,7 +99,7 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun ) BOARD_NETLIST_UPDATER updater( m_frame, m_frame->GetBoard() ); updater.SetReporter ( &reporter ); - updater.SetIsDryRun( aDryRun); + updater.SetIsDryRun( aDryRun ); updater.SetLookupByTimestamp( m_matchByTimestamp->GetValue() ); updater.SetDeleteUnusedComponents ( true ); updater.SetReplaceFootprints( true ); @@ -113,6 +114,13 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun ) m_frame->SetCurItem( NULL ); m_frame->SetMsgPanel( board ); + // Update rendered tracks and vias net labels + auto view = m_frame->GetGalCanvas()->GetView(); + + // TODO is there a way to extract information about which nets were modified? + for( auto track : board->Tracks() ) + view->Update( track ); + std::vector newFootprints = updater.GetAddedComponents(); // Spread new footprints. diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 8078f6bd4b..83b8afa15b 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -169,6 +169,10 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName, // Rebuild the board connectivity: board->GetConnectivity()->Build( board ); + // TODO is there a way to extract information about which nets were modified? + for( auto track : board->Tracks() ) + view->Update( track ); + SetMsgPanel( board ); m_canvas->Refresh(); }