Don't display OP overlay when we have no data.

Also fixes a copy-pasta bug with settings (and adds a fixup for those
already bitten by it).

Fixes https://gitlab.com/kicad/code/kicad/issues/13881
This commit is contained in:
Jeff Young 2023-02-13 18:07:58 +00:00
parent 8bab429c7d
commit b53e0a85b8
2 changed files with 9 additions and 5 deletions

View File

@ -1283,6 +1283,10 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
SCHEMATIC_SETTINGS& settings = m_schematic->Settings();
SIM_LIB_MGR simLibMgr( &Prj() );
// Patch for bug early in V7.99 dev
if( settings.m_OPO_VRange.EndsWith( 'A' ) )
settings.m_OPO_VRange[ settings.m_OPO_VRange.Length() - 1 ] = 'V';
// Update items which may have ${OP} text variables
//
GetCanvas()->GetView()->UpdateAllItemsConditionally(
@ -1341,7 +1345,7 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
wxString op = m_schematic->GetOperatingPoint( ref, settings.m_OPO_IPrecision,
settings.m_OPO_IRange );
if( !op.IsEmpty() && op != wxS( "?" ) )
if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
pins[0]->SetOperatingPoint( op );
}
else
@ -1356,7 +1360,7 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
settings.m_OPO_IPrecision,
settings.m_OPO_IRange );
if( symbolPin && !op.IsEmpty() && op != wxS( "?" ) )
if( symbolPin && !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
{
symbolPin->SetOperatingPoint( op );
GetCanvas()->GetView()->Update( symbol );
@ -1371,7 +1375,7 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
wxString op = m_schematic->GetOperatingPoint( key.Name, settings.m_OPO_VPrecision,
settings.m_OPO_VRange );
if( !op.IsEmpty() )
if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
{
for( CONNECTION_SUBGRAPH* subgraph : subgraphList )
{

View File

@ -112,10 +112,10 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
&m_OPO_VRange, wxS( "~V" ) ) );
m_params.emplace_back( new PARAM<int>( "drawing.operating_point_overlay_i_precision",
&m_OPO_VPrecision, 3 ) );
&m_OPO_IPrecision, 3 ) );
m_params.emplace_back( new PARAM<wxString>( "drawing.operating_point_overlay_i_range",
&m_OPO_VRange, wxS( "~A" ) ) );
&m_OPO_IRange, wxS( "~A" ) ) );
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.default_line_thickness",
&m_DefaultLineWidth, schIUScale.MilsToIU( defaultLineThickness ), schIUScale.MilsToIU( 5 ), schIUScale.MilsToIU( 1000 ),