diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 464b1a4e89..8b15fcb754 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -1328,7 +1328,12 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay() { if( item->Type() == SCH_LINE_T ) { - static_cast( item )->SetOperatingPoint( wxEmptyString ); + SCH_LINE* line = static_cast( 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 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 { diff --git a/eeschema/sim/ngspice_circuit_model.cpp b/eeschema/sim/ngspice_circuit_model.cpp index a8459b78e5..6616a8fc9e 100644 --- a/eeschema/sim/ngspice_circuit_model.cpp +++ b/eeschema/sim/ngspice_circuit_model.cpp @@ -96,27 +96,28 @@ SIM_TYPE NGSPICE_CIRCUIT_MODEL::GetSimType() SIM_TYPE NGSPICE_CIRCUIT_MODEL::CommandToSimType( const wxString& aCmd ) { - const std::vector> 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& 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; } diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 422ca1cf0c..c92aaf2de5 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -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 );