diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 3258ffcbb0..71b9b3a5f5 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -695,6 +695,12 @@ bool SIM_PLOT_FRAME::updatePlot( const wxString& aName, SIM_PLOT_TYPE aType, con SIM_TYPE simType = m_exporter->GetSimType(); wxString spiceVector = m_exporter->ComponentToVector( aName, aType, aParam ); + wxString plotTitle = wxString::Format( "%s(%s)", aParam, aName ); + if( aType & SPT_AC_MAG ) + plotTitle += " (mag)"; + else if( aType & SPT_AC_PHASE ) + plotTitle += " (phase)"; + if( !SIM_PANEL_BASE::IsPlottable( simType ) ) { // There is no plot to be shown @@ -768,15 +774,16 @@ bool SIM_PLOT_FRAME::updatePlot( const wxString& aName, SIM_PLOT_TYPE aType, con for( size_t idx = 0; idx <= outer; idx++ ) { - name = wxString::Format( "%s (%s = %s V)", aName, source2.m_source, v.ToString() ); + name = wxString::Format( "%s (%s = %s V)", plotTitle, source2.m_source, + v.ToString() ); std::vector sub_x( data_x.begin() + offset, data_x.begin() + offset + inner ); std::vector sub_y( data_y.begin() + offset, data_y.begin() + offset + inner ); - m_workbook->AddTrace( aPlotPanel, name, inner, sub_x.data(), sub_y.data(), aType, - aParam ); + m_workbook->AddTrace( aPlotPanel, name, aName, inner, sub_x.data(), sub_y.data(), + aType, aParam ); v = v + source2.m_vincrement; offset += inner; @@ -786,7 +793,8 @@ bool SIM_PLOT_FRAME::updatePlot( const wxString& aName, SIM_PLOT_TYPE aType, con } } - m_workbook->AddTrace( aPlotPanel, aName, size, data_x.data(), data_y.data(), aType, aParam ); + m_workbook->AddTrace( aPlotPanel, plotTitle, aName, size, data_x.data(), data_y.data(), aType, + aParam ); return true; } diff --git a/eeschema/sim/sim_plot_frame.h b/eeschema/sim/sim_plot_frame.h index 685a4002b5..c009f08290 100644 --- a/eeschema/sim/sim_plot_frame.h +++ b/eeschema/sim/sim_plot_frame.h @@ -178,8 +178,10 @@ private: * Update plot in a particular SIM_PLOT_PANEL. If the panel does not contain * the plot, it will be added. * - * @param aDescriptor contains the plot description. - * @param aPanel is the panel that should receive the update. + * @param aName is the device/net name. + * @param aType describes the type of plot. + * @param aParam is the parameter for the device/net (e.g. I, Id, V). + * @param aPlotPanel is the panel that should receive the update. * @return True if a plot was successfully added/updated. */ bool updatePlot( const wxString& aName, SIM_PLOT_TYPE aType, const wxString& aParam, diff --git a/eeschema/sim/sim_plot_panel.cpp b/eeschema/sim/sim_plot_panel.cpp index 9da0e3cc11..7e02383ea4 100644 --- a/eeschema/sim/sim_plot_panel.cpp +++ b/eeschema/sim/sim_plot_panel.cpp @@ -449,16 +449,12 @@ void SIM_PLOT_PANEL::UpdateTraceStyle( TRACE* trace ) } -bool SIM_PLOT_PANEL::addTrace( const wxString& aName, int aPoints, const double* aX, - const double* aY, SIM_PLOT_TYPE aType, const wxString& aParam ) +bool SIM_PLOT_PANEL::addTrace( const wxString& aTitle, const wxString& aName, int aPoints, + const double* aX, const double* aY, SIM_PLOT_TYPE aType, + const wxString& aParam ) { TRACE* trace = nullptr; - wxString name = aName; - - if( aType & SPT_AC_MAG ) - name += " (mag)"; - else if( aType & SPT_AC_PHASE ) - name += " (phase)"; + wxString name = aTitle; // Find previous entry, if there is one auto prev = m_traces.find( name ); diff --git a/eeschema/sim/sim_plot_panel.h b/eeschema/sim/sim_plot_panel.h index 17a7522216..b79af8f8ee 100644 --- a/eeschema/sim/sim_plot_panel.h +++ b/eeschema/sim/sim_plot_panel.h @@ -290,8 +290,8 @@ public: } protected: - bool addTrace( const wxString& aName, int aPoints, const double* aX, const double* aY, - SIM_PLOT_TYPE aType, const wxString& aParam ); + bool addTrace( const wxString& aTitle, const wxString& aName, int aPoints, const double* aX, + const double* aY, SIM_PLOT_TYPE aType, const wxString& aParam ); bool deleteTrace( const wxString& aName ); diff --git a/eeschema/sim/sim_workbook.cpp b/eeschema/sim/sim_workbook.cpp index c074f443cd..bf25a9dca0 100644 --- a/eeschema/sim/sim_workbook.cpp +++ b/eeschema/sim/sim_workbook.cpp @@ -70,10 +70,11 @@ bool SIM_WORKBOOK::DeletePage( size_t page ) } -bool SIM_WORKBOOK::AddTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aName, int aPoints, const - double* aX, const double* aY, SIM_PLOT_TYPE aType, const wxString& aParam ) +bool SIM_WORKBOOK::AddTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aTitle, + const wxString& aName, int aPoints, const double* aX, const double* aY, + SIM_PLOT_TYPE aType, const wxString& aParam ) { - bool res = aPlotPanel->addTrace( aName, aPoints, aX, aY, aType, aParam ); + bool res = aPlotPanel->addTrace( aTitle, aName, aPoints, aX, aY, aType, aParam ); setModified( res ); return res; } diff --git a/eeschema/sim/sim_workbook.h b/eeschema/sim/sim_workbook.h index 09bc235e1b..bae9110aa5 100644 --- a/eeschema/sim/sim_workbook.h +++ b/eeschema/sim/sim_workbook.h @@ -48,8 +48,9 @@ public: // Custom methods - bool AddTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aName, int aPoints, const double* - aX, const double* aY, SIM_PLOT_TYPE aType, const wxString& aParam ); + bool AddTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aTitle, const wxString& aName, + int aPoints, const double* aX, const double* aY, SIM_PLOT_TYPE aType, + const wxString& aParam ); bool DeleteTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aName ); void SetSimCommand( SIM_PANEL_BASE* aPlotPanel, const wxString& aSimCommand )