Clear operating points on all sim types.
(We'll fill them back in if we have data.) Also improves handling when a plot tab is closed. Also fixes dirtying of the view for op changes. Fixes https://gitlab.com/kicad/code/kicad/issues/13990
This commit is contained in:
parent
fe2679d965
commit
6fcae34f6b
|
@ -1328,7 +1328,12 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
|
|||
{
|
||||
if( item->Type() == SCH_LINE_T )
|
||||
{
|
||||
static_cast<SCH_LINE*>( item )->SetOperatingPoint( wxEmptyString );
|
||||
SCH_LINE* line = static_cast<SCH_LINE*>( item );
|
||||
|
||||
if( !line->GetOperatingPoint().IsEmpty() )
|
||||
GetCanvas()->GetView()->Update( line );
|
||||
|
||||
line->SetOperatingPoint( wxEmptyString );
|
||||
// update value from netlist, below
|
||||
}
|
||||
else if( item->Type() == SCH_SYMBOL_T )
|
||||
|
@ -1338,7 +1343,12 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
|
|||
std::vector<SCH_PIN*> pins = symbol->GetPins( &GetCurrentSheet() );
|
||||
|
||||
for( SCH_PIN* pin : pins )
|
||||
{
|
||||
if( !pin->GetOperatingPoint().IsEmpty() )
|
||||
GetCanvas()->GetView()->Update( pin );
|
||||
|
||||
pin->SetOperatingPoint( wxEmptyString );
|
||||
}
|
||||
|
||||
if( pins.size() == 2 )
|
||||
{
|
||||
|
@ -1346,7 +1356,10 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
|
|||
settings.m_OPO_IRange );
|
||||
|
||||
if( !op.IsEmpty() && op != wxS( "--" ) && op != wxS( "?" ) )
|
||||
{
|
||||
pins[0]->SetOperatingPoint( op );
|
||||
GetCanvas()->GetView()->Update( symbol );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -96,27 +96,28 @@ SIM_TYPE NGSPICE_CIRCUIT_MODEL::GetSimType()
|
|||
|
||||
SIM_TYPE NGSPICE_CIRCUIT_MODEL::CommandToSimType( const wxString& aCmd )
|
||||
{
|
||||
const std::vector<std::pair<wxString, SIM_TYPE>> simCmds = {
|
||||
{ wxT( "^.ac\\M.*" ), ST_AC },
|
||||
{ wxT( "^.dc\\M.*" ), ST_DC },
|
||||
{ wxT( "^.tran\\M.*" ), ST_TRANSIENT },
|
||||
{ wxT( "^.op\\M.*" ), ST_OP },
|
||||
{ wxT( "^.disto\\M.*" ), ST_DISTORTION },
|
||||
{ wxT( "^.noise\\M.*" ), ST_NOISE },
|
||||
{ wxT( "^.pz\\M.*" ), ST_POLE_ZERO },
|
||||
{ wxT( "^.sens\\M.*" ), ST_SENSITIVITY },
|
||||
{ wxT( "^.tf\\M.*" ), ST_TRANS_FUNC } };
|
||||
wxRegEx simCmd;
|
||||
wxString cmd = aCmd.Lower();
|
||||
|
||||
for( const std::pair<wxString, SIM_TYPE>& c : simCmds )
|
||||
{
|
||||
simCmd.Compile( c.first, wxRE_ADVANCED | wxRE_NOSUB | wxRE_ICASE );
|
||||
|
||||
if( simCmd.Matches( aCmd ) )
|
||||
return c.second;
|
||||
}
|
||||
|
||||
return ST_UNKNOWN;
|
||||
if( cmd.StartsWith( wxT( ".ac" ) ) )
|
||||
return ST_AC;
|
||||
else if( cmd.StartsWith( wxT( ".dc" ) ) )
|
||||
return ST_DC;
|
||||
else if( cmd.StartsWith( wxT( ".tran" ) ) )
|
||||
return ST_TRANSIENT;
|
||||
else if( cmd == wxT( ".op" ) )
|
||||
return ST_OP;
|
||||
else if( cmd.StartsWith( wxT( ".disto" ) ) )
|
||||
return ST_DISTORTION;
|
||||
else if( cmd.StartsWith( wxT( ".noise" ) ) )
|
||||
return ST_NOISE;
|
||||
else if( cmd.StartsWith( wxT( ".pz" ) ) )
|
||||
return ST_POLE_ZERO;
|
||||
else if( cmd.StartsWith( wxT( ".sens" ) ) )
|
||||
return ST_SENSITIVITY;
|
||||
else if( cmd.StartsWith( wxT( ".tf" ) ) )
|
||||
return ST_TRANS_FUNC;
|
||||
else
|
||||
return ST_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2243,9 +2243,21 @@ void SIM_PLOT_FRAME::onPlotClose( wxAuiNotebookEvent& event )
|
|||
|
||||
void SIM_PLOT_FRAME::onPlotClosed( wxAuiNotebookEvent& event )
|
||||
{
|
||||
m_signals.clear();
|
||||
rebuildSignalsGrid( m_filter->GetValue() );
|
||||
updateCursors();
|
||||
CallAfter( [this]()
|
||||
{
|
||||
rebuildSignalsList();
|
||||
rebuildSignalsGrid( m_filter->GetValue() );
|
||||
updateCursors();
|
||||
|
||||
SIM_PANEL_BASE* panel = getCurrentPlotWindow();
|
||||
|
||||
if( !panel || panel->GetType() != ST_OP )
|
||||
{
|
||||
SCHEMATIC& schematic = m_schematicFrame->Schematic();
|
||||
schematic.ClearOperatingPoints();
|
||||
m_schematicFrame->RefreshOperatingPointDisplay();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2648,6 +2660,9 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
|
|||
applyUserDefinedSignals();
|
||||
rebuildSignalsList();
|
||||
|
||||
SCHEMATIC& schematic = m_schematicFrame->Schematic();
|
||||
schematic.ClearOperatingPoints();
|
||||
|
||||
// If there are any signals plotted, update them
|
||||
if( SIM_PANEL_BASE::IsPlottable( simType ) )
|
||||
{
|
||||
|
@ -2700,9 +2715,6 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
|
|||
}
|
||||
else if( simType == ST_OP )
|
||||
{
|
||||
SCHEMATIC& schematic = m_schematicFrame->Schematic();
|
||||
schematic.ClearOperatingPoints();
|
||||
|
||||
m_simConsole->AppendText( _( "\n\nSimulation results:\n\n" ) );
|
||||
m_simConsole->SetInsertionPointEnd();
|
||||
|
||||
|
@ -2735,10 +2747,10 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
|
|||
|
||||
schematic.SetOperatingPoint( signal, val_list.at( 0 ) );
|
||||
}
|
||||
|
||||
m_schematicFrame->RefreshOperatingPointDisplay();
|
||||
}
|
||||
|
||||
m_schematicFrame->RefreshOperatingPointDisplay();
|
||||
|
||||
for( int row = 0; row < m_measurementsGrid->GetNumberRows(); ++row )
|
||||
UpdateMeasurement( row );
|
||||
|
||||
|
|
Loading…
Reference in New Issue