This commit is contained in:
Jeff Young 2023-10-03 12:55:19 +01:00
parent 2dfdf0682f
commit 827942c560
4 changed files with 6 additions and 6 deletions

View File

@ -324,7 +324,7 @@ bool SIMULATOR_FRAME_UI::loadLegacyWorkbook( const wxString& aPath )
else else
{ {
wxString vectorName = vectorNameFromSignalName( plotTab, signalName, nullptr ); wxString vectorName = vectorNameFromSignalName( plotTab, signalName, nullptr );
TRACE* trace = plotTab->AddTrace( vectorName, (int) traceType ); TRACE* trace = plotTab->GetOrAddTrace( vectorName, (int) traceType );
if( version >= 4 && trace ) if( version >= 4 && trace )
parseTraceParams( plotTab, trace, signalName, param ); parseTraceParams( plotTab, trace, signalName, param );

View File

@ -826,7 +826,7 @@ void SIM_PLOT_TAB::UpdateTraceStyle( TRACE* trace )
} }
TRACE* SIM_PLOT_TAB::AddTrace( const wxString& aVectorName, int aType ) TRACE* SIM_PLOT_TAB::GetOrAddTrace( const wxString& aVectorName, int aType )
{ {
TRACE* trace = GetTrace( aVectorName, aType ); TRACE* trace = GetTrace( aVectorName, aType );

View File

@ -344,7 +344,7 @@ public:
///< Getter for math plot window ///< Getter for math plot window
mpWindow* GetPlotWin() const { return m_plotWin; } mpWindow* GetPlotWin() const { return m_plotWin; }
TRACE* AddTrace( const wxString& aVectorName, int aType ); TRACE* GetOrAddTrace( const wxString& aVectorName, int aType );
void SetTraceData( TRACE* aTrace, std::vector<double>& aX, std::vector<double>& aY ); void SetTraceData( TRACE* aTrace, std::vector<double>& aX, std::vector<double>& aY );

View File

@ -1703,7 +1703,7 @@ void SIMULATOR_FRAME_UI::updateTrace( const wxString& aVectorName, int aTraceTyp
for( size_t idx = 0; idx <= outer; idx++ ) for( size_t idx = 0; idx <= outer; idx++ )
{ {
if( TRACE* trace = aPlotTab->AddTrace( aVectorName, aTraceType ) ) if( TRACE* trace = aPlotTab->GetOrAddTrace( aVectorName, aTraceType ) )
{ {
if( data_y.size() >= size ) if( data_y.size() >= size )
{ {
@ -1720,7 +1720,7 @@ void SIMULATOR_FRAME_UI::updateTrace( const wxString& aVectorName, int aTraceTyp
offset += inner; offset += inner;
} }
} }
else if( TRACE* trace = aPlotTab->AddTrace( aVectorName, aTraceType ) ) else if( TRACE* trace = aPlotTab->GetOrAddTrace( aVectorName, aTraceType ) )
{ {
if( data_y.size() >= size ) if( data_y.size() >= size )
aPlotTab->SetTraceData( trace, *aDataX, data_y ); aPlotTab->SetTraceData( trace, *aDataX, data_y );
@ -2023,7 +2023,7 @@ bool SIMULATOR_FRAME_UI::loadJsonWorkbook( const wxString& aPath )
{ {
wxString signalName = trace_js[ "signal" ]; wxString signalName = trace_js[ "signal" ];
wxString vectorName = vectorNameFromSignalName( plotTab, signalName, nullptr ); wxString vectorName = vectorNameFromSignalName( plotTab, signalName, nullptr );
TRACE* trace = plotTab->AddTrace( vectorName, trace_js[ "trace_type" ] ); TRACE* trace = plotTab->GetOrAddTrace( vectorName, trace_js[ "trace_type" ] );
if( trace ) if( trace )
{ {