Use GetCurrentNets(), not m_startItem for message panel updates.

Fixes https://gitlab.com/kicad/code/kicad/issues/12592

(cherry picked from commit cbb997a3b5)
This commit is contained in:
Jeff Young 2022-10-07 10:32:59 +01:00
parent dde5f2bed1
commit 6390633a7b
1 changed files with 39 additions and 7 deletions

View File

@ -49,6 +49,7 @@ using namespace std::placeholders;
#include <tools/pcb_actions.h>
#include <tools/pcb_selection_tool.h>
#include <tools/pcb_grid_helper.h>
#include <string_utils.h>
#include "router_tool.h"
#include "pns_segment.h"
@ -2085,22 +2086,53 @@ void ROUTER_TOOL::UpdateMessagePanel()
PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
PNS::RULE_RESOLVER* resolver = m_iface->GetRuleResolver();
bool isDiffPair = m_router->Mode() == PNS::ROUTER_MODE::PNS_MODE_ROUTE_DIFF_PAIR;
std::vector<int> nets = m_router->GetCurrentNets();
wxString description;
wxString secondary;
if( m_startItem && m_startItem->Net() > 0 )
if( isDiffPair )
{
wxString description = isDiffPair ? _( "Routing Diff Pair: %s" ) : _( "Routing Track: %s" );
wxASSERT( nets.size() >= 2 );
NETINFO_ITEM* netInfo = board()->FindNet( m_startItem->Net() );
wxASSERT( netInfo );
NETINFO_ITEM* netA = board()->FindNet( nets[0] );
NETINFO_ITEM* netB = board()->FindNet( nets[1] );
wxASSERT( netA );
wxASSERT( netB );
items.emplace_back( wxString::Format( description, netInfo->GetNetname() ),
wxString::Format( _( "Net Class: %s" ), netInfo->GetNetClassName() ) );
description = wxString::Format( _( "Routing Diff Pair: %s" ),
netA->GetNetname() + wxT( "/" ) + netB->GetNetname() );
wxString netclass;
NETCLASS* netclassA = netA->GetNetClass();
NETCLASS* netclassB = netB->GetNetClass();
if( netclassA == netclassB )
netclass = netclassA->GetName();
else
netclass = netclassA->GetName() + wxT( "/" ) + netclassB->GetName();
secondary = wxString::Format( _( "Net Class: %s" ),
UnescapeString( netclass ) );
}
else if( !nets.empty() )
{
NETINFO_ITEM* net = board()->FindNet( nets[0] );
wxASSERT( net );
description = wxString::Format( _( "Routing Track: %s" ),
net->GetNetname() );
secondary = wxString::Format( _( "Net Class: %s" ),
UnescapeString( net->GetNetClass()->GetName() ) );
}
else
{
items.emplace_back( _( "Routing Track" ), _( "(no net)" ) );
description = _( "Routing Track" );
secondary = _( "(no net)" );
}
items.emplace_back( description, secondary );
wxString cornerMode;
if( m_router->Settings().GetFreeAngleMode() )