Router only owns message panel when routing.

Also fixes a pair of copy/paste error not caught earlier.

Fixes https://gitlab.com/kicad/code/kicad/issues/12780
This commit is contained in:
Jeff Young 2022-10-28 22:42:12 +01:00
parent e1af4c5cf6
commit 01b4c20c94
1 changed files with 112 additions and 106 deletions

View File

@ -686,7 +686,7 @@ void ROUTER_TOOL::updateSizesAfterLayerSwitch( PCB_LAYER_ID targetLayer )
if( sizes.TrackWidth() == constraint.m_Value.Opt() ) if( sizes.TrackWidth() == constraint.m_Value.Opt() )
sizes.SetWidthSource( constraint.GetName() ); sizes.SetWidthSource( constraint.GetName() );
else else
sizes.SetDiffPairGapSource( _( "board minimum track width" ) ); sizes.SetWidthSource( _( "board minimum track width" ) );
} }
} }
@ -706,7 +706,7 @@ void ROUTER_TOOL::updateSizesAfterLayerSwitch( PCB_LAYER_ID targetLayer )
if( sizes.DiffPairWidth() == constraint.m_Value.Opt() ) if( sizes.DiffPairWidth() == constraint.m_Value.Opt() )
sizes.SetDiffPairWidthSource( constraint.GetName() ); sizes.SetDiffPairWidthSource( constraint.GetName() );
else else
sizes.SetDiffPairGapSource( _( "board minimum track width" ) ); sizes.SetDiffPairWidthSource( _( "board minimum track width" ) );
} }
constraint = drcEngine->EvalRules( DIFF_PAIR_GAP_CONSTRAINT, &dummyTrack, &dummyTrackB, constraint = drcEngine->EvalRules( DIFF_PAIR_GAP_CONSTRAINT, &dummyTrack, &dummyTrackB,
@ -2398,21 +2398,17 @@ int ROUTER_TOOL::onTrackViaSizeChanged( const TOOL_EVENT& aEvent )
void ROUTER_TOOL::UpdateMessagePanel() void ROUTER_TOOL::UpdateMessagePanel()
{ {
if( !m_router->RoutingInProgress() )
{
frame()->SetMsgPanel( board() );
return;
}
std::vector<MSG_PANEL_ITEM> items; std::vector<MSG_PANEL_ITEM> items;
if( m_router->GetState() == PNS::ROUTER::ROUTE_TRACK )
{
PNS::SIZES_SETTINGS sizes( m_router->Sizes() ); PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
PNS::RULE_RESOLVER* resolver = m_iface->GetRuleResolver(); 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(); std::vector<int> nets = m_router->GetCurrentNets();
wxString description; wxString description;
wxString secondary; wxString secondary;
if( isDiffPair ) if( m_router->Mode() == PNS::ROUTER_MODE::PNS_MODE_ROUTE_DIFF_PAIR )
{ {
wxASSERT( nets.size() >= 2 ); wxASSERT( nets.size() >= 2 );
@ -2475,38 +2471,48 @@ void ROUTER_TOOL::UpdateMessagePanel()
items.emplace_back( _( "Corner Style" ), cornerMode ); items.emplace_back( _( "Corner Style" ), cornerMode );
if( isDiffPair ) #define FORMAT_VALUE( x ) frame()->MessageTextFromValue( x )
if( m_router->Mode() == PNS::ROUTER_MODE::PNS_MODE_ROUTE_DIFF_PAIR )
{ {
items.emplace_back( wxString::Format( _( "Track Width: %s" ), items.emplace_back( wxString::Format( _( "Track Width: %s" ),
frame()->MessageTextFromValue( sizes.DiffPairWidth() ) ), FORMAT_VALUE( sizes.DiffPairWidth() ) ),
wxString::Format( _( "(from %s)" ), wxString::Format( _( "(from %s)" ),
sizes.GetDiffPairWidthSource() ) ); sizes.GetDiffPairWidthSource() ) );
items.emplace_back( wxString::Format( _( "Min Clearance: %s" ), items.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
frame()->MessageTextFromValue( sizes.MinClearance() ) ), FORMAT_VALUE( sizes.MinClearance() ) ),
wxString::Format( _( "(from %s)" ), wxString::Format( _( "(from %s)" ),
sizes.GetClearanceSource() ) ); sizes.GetClearanceSource() ) );
items.emplace_back( wxString::Format( _( "Diff Pair Gap: %s" ), items.emplace_back( wxString::Format( _( "Diff Pair Gap: %s" ),
frame()->MessageTextFromValue( sizes.DiffPairGap() ) ), FORMAT_VALUE( sizes.DiffPairGap() ) ),
wxString::Format( _( "(from %s)" ), wxString::Format( _( "(from %s)" ),
sizes.GetDiffPairGapSource() ) ); sizes.GetDiffPairGapSource() ) );
} }
else else
{ {
items.emplace_back( wxString::Format( _( "Track Width: %s" ), items.emplace_back( wxString::Format( _( "Track Width: %s" ),
frame()->MessageTextFromValue( sizes.TrackWidth() ) ), FORMAT_VALUE( sizes.TrackWidth() ) ),
wxString::Format( _( "(from %s)" ), wxString::Format( _( "(from %s)" ),
sizes.GetWidthSource() ) ); sizes.GetWidthSource() ) );
items.emplace_back( wxString::Format( _( "Min Clearance: %s" ), items.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
frame()->MessageTextFromValue( sizes.MinClearance() ) ), FORMAT_VALUE( sizes.MinClearance() ) ),
wxString::Format( _( "(from %s)" ), wxString::Format( _( "(from %s)" ),
sizes.GetClearanceSource() ) ); sizes.GetClearanceSource() ) );
} }
#undef FORMAT_VALUE
frame()->SetMsgPanel( items ); frame()->SetMsgPanel( items );
} }
else
{
frame()->SetMsgPanel( board() );
return;
}
}
void ROUTER_TOOL::setTransitions() void ROUTER_TOOL::setTransitions()