Straighten out some really confusing terminology in simulator GUI.

This commit is contained in:
Jeff Young 2023-07-09 23:00:25 +01:00
parent 7608350bdc
commit 8f9a67063a
13 changed files with 303 additions and 307 deletions

View File

@ -229,8 +229,8 @@ set( EESCHEMA_SIM_SRCS
sim/simulator_panel.cpp
sim/simulator_panel_base.cpp
sim/sim_plot_colors.cpp
sim/sim_plot_panel_base.cpp
sim/sim_plot_panel.cpp
sim/sim_tab.cpp
sim/sim_plot_tab.cpp
sim/sim_property.cpp
sim/spice_simulator.cpp
sim/spice_value.cpp

View File

@ -25,7 +25,7 @@
#include "sim_plot_colors.h"
#include "sim_plot_panel.h"
#include <sim/sim_plot_tab.h>
#include <wx/stc/stc.h>

View File

@ -26,7 +26,7 @@
*/
#include "sim_plot_colors.h"
#include "sim_plot_panel.h"
#include "sim_plot_tab.h"
#include "simulator_frame.h"
#include "core/kicad_algo.h"
@ -405,9 +405,8 @@ void CURSOR::UpdateReference()
}
SIM_PLOT_PANEL::SIM_PLOT_PANEL( const wxString& aSimCommand, unsigned aSimOptions,
wxWindow* parent ) :
SIM_PLOT_PANEL_BASE( aSimCommand, aSimOptions, parent ),
SIM_PLOT_TAB::SIM_PLOT_TAB( const wxString& aSimCommand, unsigned aSimOptions, wxWindow* parent ) :
SIM_TAB( aSimCommand, aSimOptions, parent ),
m_axis_x( nullptr ),
m_axis_y1( nullptr ),
m_axis_y2( nullptr ),
@ -437,13 +436,13 @@ SIM_PLOT_PANEL::SIM_PLOT_PANEL( const wxString& aSimCommand, unsigned aSimOption
}
SIM_PLOT_PANEL::~SIM_PLOT_PANEL()
SIM_PLOT_TAB::~SIM_PLOT_TAB()
{
// ~mpWindow destroys all the added layers, so there is no need to destroy m_traces contents
}
wxString SIM_PLOT_PANEL::GetUnitsX() const
wxString SIM_PLOT_TAB::GetUnitsX() const
{
LOG_SCALE<mpScaleXLog>* logScale = dynamic_cast<LOG_SCALE<mpScaleXLog>*>( m_axis_x );
LIN_SCALE<mpScaleX>* linScale = dynamic_cast<LIN_SCALE<mpScaleX>*>( m_axis_x );
@ -457,7 +456,7 @@ wxString SIM_PLOT_PANEL::GetUnitsX() const
}
wxString SIM_PLOT_PANEL::GetUnitsY1() const
wxString SIM_PLOT_TAB::GetUnitsY1() const
{
LIN_SCALE<mpScaleY>* linScale = dynamic_cast<LIN_SCALE<mpScaleY>*>( m_axis_y1 );
@ -468,7 +467,7 @@ wxString SIM_PLOT_PANEL::GetUnitsY1() const
}
wxString SIM_PLOT_PANEL::GetUnitsY2() const
wxString SIM_PLOT_TAB::GetUnitsY2() const
{
LIN_SCALE<mpScaleY>* linScale = dynamic_cast<LIN_SCALE<mpScaleY>*>( m_axis_y2 );
@ -479,7 +478,7 @@ wxString SIM_PLOT_PANEL::GetUnitsY2() const
}
wxString SIM_PLOT_PANEL::GetUnitsY3() const
wxString SIM_PLOT_TAB::GetUnitsY3() const
{
LIN_SCALE<mpScaleY>* linScale = dynamic_cast<LIN_SCALE<mpScaleY>*>( m_axis_y3 );
@ -490,7 +489,7 @@ wxString SIM_PLOT_PANEL::GetUnitsY3() const
}
void SIM_PLOT_PANEL::updateAxes( int aNewTraceType )
void SIM_PLOT_TAB::updateAxes( int aNewTraceType )
{
switch( GetSimType() )
{
@ -644,7 +643,7 @@ void SIM_PLOT_PANEL::updateAxes( int aNewTraceType )
}
void SIM_PLOT_PANEL::prepareDCAxes( int aNewTraceType )
void SIM_PLOT_TAB::prepareDCAxes( int aNewTraceType )
{
wxString sim_cmd = GetSimCommand().Lower();
wxString rem;
@ -746,7 +745,7 @@ void SIM_PLOT_PANEL::prepareDCAxes( int aNewTraceType )
}
void SIM_PLOT_PANEL::UpdatePlotColors()
void SIM_PLOT_TAB::UpdatePlotColors()
{
// Update bg and fg colors:
m_plotWin->SetColourTheme( m_colors.GetPlotColor( SIM_PLOT_COLORS::COLOR_SET::BACKGROUND ),
@ -767,14 +766,14 @@ void SIM_PLOT_PANEL::UpdatePlotColors()
}
void SIM_PLOT_PANEL::OnLanguageChanged()
void SIM_PLOT_TAB::OnLanguageChanged()
{
updateAxes();
m_plotWin->UpdateAll();
}
void SIM_PLOT_PANEL::UpdateTraceStyle( TRACE* trace )
void SIM_PLOT_TAB::UpdateTraceStyle( TRACE* trace )
{
int type = trace->GetType();
wxPenStyle penStyle = ( ( ( type & SPT_AC_PHASE ) || ( type & SPT_CURRENT ) ) && m_dotted_cp )
@ -784,7 +783,7 @@ void SIM_PLOT_PANEL::UpdateTraceStyle( TRACE* trace )
}
TRACE* SIM_PLOT_PANEL::AddTrace( const wxString& aVectorName, int aType )
TRACE* SIM_PLOT_TAB::AddTrace( const wxString& aVectorName, int aType )
{
TRACE* trace = GetTrace( aVectorName, aType );
@ -827,8 +826,8 @@ TRACE* SIM_PLOT_PANEL::AddTrace( const wxString& aVectorName, int aType )
}
void SIM_PLOT_PANEL::SetTraceData( TRACE* trace, unsigned int aPoints, const double* aX,
const double* aY )
void SIM_PLOT_TAB::SetTraceData( TRACE* trace, unsigned int aPoints, const double* aX,
const double* aY )
{
std::vector<double> x( aX, aX + aPoints );
std::vector<double> y( aY, aY + aPoints );
@ -879,7 +878,7 @@ void SIM_PLOT_PANEL::SetTraceData( TRACE* trace, unsigned int aPoints, const dou
}
void SIM_PLOT_PANEL::DeleteTrace( TRACE* aTrace )
void SIM_PLOT_TAB::DeleteTrace( TRACE* aTrace )
{
for( const auto& [ name, trace ] : m_traces )
{
@ -901,7 +900,7 @@ void SIM_PLOT_PANEL::DeleteTrace( TRACE* aTrace )
}
bool SIM_PLOT_PANEL::DeleteTrace( const wxString& aVectorName, int aTraceType )
bool SIM_PLOT_TAB::DeleteTrace( const wxString& aVectorName, int aTraceType )
{
if( TRACE* trace = GetTrace( aVectorName, aTraceType ) )
{
@ -913,8 +912,8 @@ bool SIM_PLOT_PANEL::DeleteTrace( const wxString& aVectorName, int aTraceType )
}
void SIM_PLOT_PANEL::EnableCursor( const wxString& aVectorName, int aType, int aCursorId,
bool aEnable, const wxString& aSignalName )
void SIM_PLOT_TAB::EnableCursor( const wxString& aVectorName, int aType, int aCursorId,
bool aEnable, const wxString& aSignalName )
{
TRACE* t = GetTrace( aVectorName, aType );
@ -947,7 +946,7 @@ void SIM_PLOT_PANEL::EnableCursor( const wxString& aVectorName, int aType, int a
}
void SIM_PLOT_PANEL::ResetScales( bool aIncludeX )
void SIM_PLOT_TAB::ResetScales( bool aIncludeX )
{
if( m_axis_x && aIncludeX )
m_axis_x->ResetDataRange();

View File

@ -33,18 +33,18 @@
#include <widgets/mathplot.h>
#include <wx/colour.h>
#include <wx/sizer.h>
#include "sim_plot_panel_base.h"
#include "sim_tab.h"
#include "sim_plot_colors.h"
class SIMULATOR_FRAME;
class SIM_PLOT_PANEL;
class SIM_PLOT_TAB;
class TRACE;
/**
*
* The SIMULATOR_FRAME holds the main user-interface for running simulations.
*
* It contains a workbook with multiple tabs, each tab holding a SIM_PLOT_PANEL, a specific
* It contains a workbook with multiple tabs, each tab holding a SIM_PLOT_TAB, a specific
* simulation command (.TRAN, .AC, etc.), and simulation settings (save all currents, etc.).
*
* Each plot can have multiple TRACEs. While internally each TRACE can have multiple cursors,
@ -63,7 +63,7 @@ class TRACE;
class CURSOR : public mpInfoLayer
{
public:
CURSOR( TRACE* aTrace, SIM_PLOT_PANEL* aPlotPanel ) :
CURSOR( TRACE* aTrace, SIM_PLOT_TAB* aPlotTab ) :
mpInfoLayer( wxRect( 0, 0, DRAG_MARGIN, DRAG_MARGIN ), wxTRANSPARENT_BRUSH ),
m_trace( aTrace ),
m_updateRequired( true ),
@ -191,12 +191,12 @@ protected:
};
class SIM_PLOT_PANEL : public SIM_PLOT_PANEL_BASE
class SIM_PLOT_TAB : public SIM_TAB
{
public:
SIM_PLOT_PANEL( const wxString& aSimCommand, unsigned aSimOptions, wxWindow* parent );
SIM_PLOT_TAB( const wxString& aSimCommand, unsigned aSimOptions, wxWindow* parent );
virtual ~SIM_PLOT_PANEL();
virtual ~SIM_PLOT_TAB();
wxString GetLabelX() const
{

View File

@ -24,21 +24,20 @@
*/
#include "confirm.h"
#include "sim_plot_panel_base.h"
#include "sim_tab.h"
#include "simulator_frame.h"
#include "ngspice_circuit_model.h"
SIM_PLOT_PANEL_BASE::SIM_PLOT_PANEL_BASE() :
SIM_TAB::SIM_TAB() :
m_simCommand( wxEmptyString ),
m_simOptions( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS )
{
}
SIM_PLOT_PANEL_BASE::SIM_PLOT_PANEL_BASE( const wxString& aSimCommand, unsigned aSimOptions,
wxWindow* parent ) :
SIM_TAB::SIM_TAB( const wxString& aSimCommand, unsigned aSimOptions, wxWindow* parent ) :
wxWindow( parent, wxID_ANY ),
m_simCommand( aSimCommand ),
m_simOptions( aSimOptions )
@ -46,12 +45,12 @@ SIM_PLOT_PANEL_BASE::SIM_PLOT_PANEL_BASE( const wxString& aSimCommand, unsigned
}
SIM_PLOT_PANEL_BASE::~SIM_PLOT_PANEL_BASE()
SIM_TAB::~SIM_TAB()
{
}
bool SIM_PLOT_PANEL_BASE::IsPlottable( SIM_TYPE aSimType )
bool SIM_TAB::IsPlottable( SIM_TYPE aSimType )
{
switch( aSimType )
{
@ -69,15 +68,15 @@ bool SIM_PLOT_PANEL_BASE::IsPlottable( SIM_TYPE aSimType )
}
SIM_TYPE SIM_PLOT_PANEL_BASE::GetSimType() const
SIM_TYPE SIM_TAB::GetSimType() const
{
return NGSPICE_CIRCUIT_MODEL::CommandToSimType( m_simCommand );
}
SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( const wxString& aSimCommand, unsigned aSimOptions,
wxWindow* parent ) :
SIM_PLOT_PANEL_BASE( aSimCommand, aSimOptions, parent )
SIM_NOPLOT_TAB::SIM_NOPLOT_TAB( const wxString& aSimCommand, unsigned aSimOptions,
wxWindow* parent ) :
SIM_TAB( aSimCommand, aSimOptions, parent )
{
m_sizer = new wxBoxSizer( wxVERTICAL );
m_sizer->Add( 0, 1, 1, wxEXPAND, 5 );
@ -96,12 +95,12 @@ SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( const wxString& aSimCommand, unsigned aSimOp
}
SIM_NOPLOT_PANEL::~SIM_NOPLOT_PANEL()
SIM_NOPLOT_TAB::~SIM_NOPLOT_TAB()
{
}
void SIM_NOPLOT_PANEL::OnLanguageChanged()
void SIM_NOPLOT_TAB::OnLanguageChanged()
{
m_textInfo->SetLabel( _( "Simulation provided no plots. Please refer to console window "
"for results." ) );

View File

@ -33,12 +33,12 @@
#include <wx/stattext.h>
class SIM_PLOT_PANEL_BASE : public wxWindow
class SIM_TAB : public wxWindow
{
public:
SIM_PLOT_PANEL_BASE();
SIM_PLOT_PANEL_BASE( const wxString& aSimCommand, unsigned aSimOptions, wxWindow* parent );
virtual ~SIM_PLOT_PANEL_BASE();
SIM_TAB();
SIM_TAB( const wxString& aSimCommand, unsigned aSimOptions, wxWindow* parent );
virtual ~SIM_TAB();
static bool IsPlottable( SIM_TYPE aSimType );
@ -66,12 +66,12 @@ private:
};
class SIM_NOPLOT_PANEL : public SIM_PLOT_PANEL_BASE
class SIM_NOPLOT_TAB : public SIM_TAB
{
public:
SIM_NOPLOT_PANEL( const wxString& aSimCommand, unsigned aSimOptions, wxWindow* parent );
SIM_NOPLOT_TAB( const wxString& aSimCommand, unsigned aSimOptions, wxWindow* parent );
virtual ~SIM_NOPLOT_PANEL();
virtual ~SIM_NOPLOT_TAB();
void OnLanguageChanged() override;

View File

@ -52,7 +52,7 @@
#include "ngspice.h"
#include <sim/simulator_frame.h>
#include <sim/simulator_panel.h>
#include <sim/sim_plot_panel.h>
#include <sim/sim_plot_tab.h>
#include <sim/spice_simulator.h>
#include <sim/spice_reporter.h>
#include <eeschema_settings.h>
@ -284,8 +284,8 @@ WINDOW_SETTINGS* SIMULATOR_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
wxString SIMULATOR_FRAME::GetCurrentSimCommand() const
{
if( m_panel->GetCurrentPlotPanel() )
return m_panel->GetCurrentPlotPanel()->GetSimCommand();
if( m_panel->GetCurrentSimTab() )
return m_panel->GetCurrentSimTab()->GetSimCommand();
else
return m_circuitModel->GetSchTextSimCommand();
}
@ -299,8 +299,8 @@ SIM_TYPE SIMULATOR_FRAME::GetCurrentSimType() const
int SIMULATOR_FRAME::GetCurrentOptions() const
{
if( SIM_PLOT_PANEL_BASE* plotPanel = m_panel->GetCurrentPlotPanel() )
return plotPanel->GetSimOptions();
if( SIM_TAB* simTab = m_panel->GetCurrentSimTab() )
return simTab->GetSimOptions();
else
return NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS;
}
@ -361,17 +361,17 @@ bool SIMULATOR_FRAME::LoadSimulator( const wxString& aSimCommand, unsigned aSimO
void SIMULATOR_FRAME::StartSimulation()
{
SIM_PLOT_PANEL_BASE* plotPanel = m_panel->GetCurrentPlotPanel();
SIM_TAB* simTab = m_panel->GetCurrentSimTab();
if( !plotPanel )
if( !simTab )
return;
if( plotPanel->GetSimCommand().Upper().StartsWith( wxT( "FFT" ) ) )
if( simTab->GetSimCommand().Upper().StartsWith( wxT( "FFT" ) ) )
{
wxString tranSpicePlot;
if( SIM_PLOT_PANEL_BASE* tranPlotPanel = m_panel->GetPlotPanel( ST_TRAN ) )
tranSpicePlot = tranPlotPanel->GetSpicePlotName();
if( SIM_TAB* tranPlotTab = m_panel->GetSimTab( ST_TRAN ) )
tranSpicePlot = tranPlotTab->GetSpicePlotName();
if( tranSpicePlot.IsEmpty() )
{
@ -382,7 +382,7 @@ void SIMULATOR_FRAME::StartSimulation()
{
m_simulator->Command( "setplot " + tranSpicePlot.ToStdString() );
wxArrayString commands = wxSplit( plotPanel->GetSimCommand(), '\n' );
wxArrayString commands = wxSplit( simTab->GetSimCommand(), '\n' );
for( const wxString& command : commands )
{
@ -390,7 +390,7 @@ void SIMULATOR_FRAME::StartSimulation()
m_simulator->Command( command.ToStdString() );
}
plotPanel->SetSpicePlotName( m_simulator->CurrentPlotName() );
simTab->SetSpicePlotName( m_simulator->CurrentPlotName() );
m_panel->OnSimRefresh( true );
#if 0
@ -403,21 +403,21 @@ void SIMULATOR_FRAME::StartSimulation()
}
else
{
if( m_panel->GetPlotIndex( plotPanel ) == 0
&& m_circuitModel->GetSchTextSimCommand() != plotPanel->GetLastSchTextSimCommand() )
if( m_panel->GetSimTabIndex( simTab ) == 0
&& m_circuitModel->GetSchTextSimCommand() != simTab->GetLastSchTextSimCommand() )
{
if( plotPanel->GetLastSchTextSimCommand().IsEmpty()
if( simTab->GetLastSchTextSimCommand().IsEmpty()
|| IsOK( this, _( "Schematic sheet simulation command directive has changed. "
"Do you wish to update the Simulation Command?" ) ) )
{
plotPanel->SetSimCommand( m_circuitModel->GetSchTextSimCommand() );
plotPanel->SetLastSchTextSimCommand( plotPanel->GetSimCommand() );
simTab->SetSimCommand( m_circuitModel->GetSchTextSimCommand() );
simTab->SetLastSchTextSimCommand( simTab->GetSimCommand() );
OnModify();
}
}
}
if( !LoadSimulator( plotPanel->GetSimCommand(), plotPanel->GetSimOptions() ) )
if( !LoadSimulator( simTab->GetSimCommand(), simTab->GetSimOptions() ) )
return;
std::unique_lock<std::mutex> simulatorLock( m_simulator->GetMutex(), std::try_to_lock );
@ -436,7 +436,7 @@ void SIMULATOR_FRAME::StartSimulation()
void SIMULATOR_FRAME::NewPlotPanel( const wxString& aSimCommand, unsigned aOptions )
{
m_panel->NewPlotPanel( aSimCommand, aOptions );
m_panel->NewSimTab( aSimCommand, aOptions );
}
@ -482,9 +482,9 @@ void SIMULATOR_FRAME::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aS
}
SIM_PLOT_PANEL_BASE* SIMULATOR_FRAME::GetCurrentPlotPanel() const
SIM_TAB* SIMULATOR_FRAME::GetCurrentSimTab() const
{
return m_panel->GetCurrentPlotPanel();
return m_panel->GetCurrentSimTab();
}
@ -530,12 +530,12 @@ void SIMULATOR_FRAME::ToggleDarkModePlots()
bool SIMULATOR_FRAME::EditSimCommand()
{
SIM_PLOT_PANEL_BASE* plotPanel = m_panel->GetCurrentPlotPanel();
DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() );
wxString errors;
WX_STRING_REPORTER reporter( &errors );
SIM_TAB* simTab = m_panel->GetCurrentSimTab();
DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() );
wxString errors;
WX_STRING_REPORTER reporter( &errors );
if( !plotPanel )
if( !simTab )
return false;
if( !m_circuitModel->ReadSchematicAndLibraries( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS,
@ -545,13 +545,13 @@ bool SIMULATOR_FRAME::EditSimCommand()
+ errors );
}
dlg.SetSimCommand( plotPanel->GetSimCommand() );
dlg.SetSimOptions( plotPanel->GetSimOptions() );
dlg.SetSimCommand( simTab->GetSimCommand() );
dlg.SetSimOptions( simTab->GetSimOptions() );
if( dlg.ShowModal() == wxID_OK )
{
plotPanel->SetSimCommand( dlg.GetSimCommand() );
plotPanel->SetSimOptions( dlg.GetSimOptions() );
simTab->SetSimCommand( dlg.GetSimCommand() );
simTab->SetSimOptions( dlg.GetSimOptions() );
m_panel->OnPlotSettingsChanged();
OnModify();
return true;
@ -615,22 +615,22 @@ void SIMULATOR_FRAME::setupUIConditions()
auto showGridCondition =
[this]( const SELECTION& aSel )
{
SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() );
return plotPanel && plotPanel->IsGridShown();
SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() );
return plotTab && plotTab->IsGridShown();
};
auto showLegendCondition =
[this]( const SELECTION& aSel )
{
SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() );
return plotPanel && plotPanel->IsLegendShown();
SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() );
return plotTab && plotTab->IsLegendShown();
};
auto showDottedCondition =
[this]( const SELECTION& aSel )
{
SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() );
return plotPanel && plotPanel->GetDottedSecondary();
SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() );
return plotTab && plotTab->GetDottedSecondary();
};
auto darkModePlotCondition =
@ -654,13 +654,13 @@ void SIMULATOR_FRAME::setupUIConditions()
auto haveSim =
[this]( const SELECTION& aSel )
{
return GetCurrentPlotPanel() != nullptr;
return GetCurrentSimTab() != nullptr;
};
auto havePlot =
[this]( const SELECTION& aSel )
{
return dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() ) != nullptr;
return dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() ) != nullptr;
};
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )

View File

@ -52,7 +52,7 @@ class ACTION_TOOLBAR;
*
* The SIMULATOR_FRAME holds the main user-interface for running simulations.
*
* It contains a workbook with multiple tabs, each tab holding a SIM_PLOT_PANEL, a specific
* It contains a workbook with multiple tabs, each tab holding a SIM_PLOT_TAB, a specific
* simulation command (.TRAN, .AC, etc.), and simulation settings (save all currents, etc.).
*
* Each plot can have multiple TRACEs. While internally each TRACE can have multiple cursors,
@ -132,7 +132,7 @@ public:
/**
* Return the current tab (or NULL if there is none).
*/
SIM_PLOT_PANEL_BASE* GetCurrentPlotPanel() const;
SIM_TAB* GetCurrentSimTab() const;
/**
* Toggle dark-mode of the plot tabs.

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
#include <sim/simulator_panel_base.h>
#include <sim/sim_types.h>
#include <sim/sim_plot_panel.h>
#include <sim/sim_plot_tab.h>
#include <wx/event.h>
@ -51,7 +51,7 @@ class TUNER_SLIDER;
*
* The SIMULATOR_PANEL holds the main user-interface for running simulations.
*
* It contains a workbook with multiple tabs, each tab holding a SIM_PLOT_PANEL, a specific
* It contains a workbook with multiple tabs, each tab holding a SIM_PLOT_TAB, a specific
* simulation command (.TRAN, .AC, etc.), and simulation settings (save all currents, etc.).
*
* Each plot can have multiple TRACEs. While internally each TRACE can have multiple cursors,
@ -73,13 +73,13 @@ public:
~SIMULATOR_PANEL();
/**
* Create a new plot tab for a given simulation type.
* Create a new simulation tab for a given simulation type.
*
* @param aSimCommand is requested simulation command.
* @param aSimOptions netlisting options
* @return The new plot panel.
*/
SIM_PLOT_PANEL_BASE* NewPlotPanel( const wxString& aSimCommand, unsigned aSimOptions );
SIM_TAB* NewSimTab( const wxString& aSimCommand, unsigned aSimOptions );
std::vector<wxString> SimPlotVectors() const;
@ -196,16 +196,16 @@ public:
/**
* Return the currently opened plot panel (or NULL if there is none).
*/
SIM_PLOT_PANEL_BASE* GetCurrentPlotPanel() const
SIM_TAB* GetCurrentSimTab() const
{
return dynamic_cast<SIM_PLOT_PANEL_BASE*>( m_plotNotebook->GetCurrentPage() );
return dynamic_cast<SIM_TAB*>( m_plotNotebook->GetCurrentPage() );
}
SIM_PLOT_PANEL_BASE* GetPlotPanel( SIM_TYPE aType ) const
SIM_TAB* GetSimTab( SIM_TYPE aType ) const
{
for( int ii = 0; ii < (int) m_plotNotebook->GetPageCount(); ++ii )
{
auto* candidate = dynamic_cast<SIM_PLOT_PANEL_BASE*>( m_plotNotebook->GetPage( ii ) );
SIM_TAB* candidate = dynamic_cast<SIM_TAB*>( m_plotNotebook->GetPage( ii ) );
if( candidate && candidate->GetSimType() == aType )
return candidate;
@ -214,7 +214,7 @@ public:
return nullptr;
}
int GetPlotIndex( SIM_PLOT_PANEL_BASE* aPlot ) const
int GetSimTabIndex( SIM_TAB* aPlot ) const
{
return m_plotNotebook->GetPageIndex( aPlot );
}
@ -229,18 +229,18 @@ private:
/**
* Get the simulator output vector name for a given signal name and type.
*/
wxString vectorNameFromSignalName( SIM_PLOT_PANEL* aPlotPanel, const wxString& aSignalName,
wxString vectorNameFromSignalName( SIM_PLOT_TAB* aPlotTab, const wxString& aSignalName,
int* aTraceType );
/**
* Update a trace in a particular SIM_PLOT_PANEL. If the panel does not contain the given
* Update a trace in a particular SIM_PLOT_TAB. If the panel does not contain the given
* trace, then add it.
*
* @param aVectorName is the SPICE vector name, such as "I(Net-C1-Pad1)".
* @param aTraceType describes the type of plot.
* @param aPlotPanel is the panel that should receive the update.
* @param aPlotTab is the tab that should receive the update.
*/
void updateTrace( const wxString& aVectorName, int aTraceType, SIM_PLOT_PANEL* aPlotPanel );
void updateTrace( const wxString& aVectorName, int aTraceType, SIM_PLOT_TAB* aPlotTab );
/**
* Rebuild the list of signals available from the netlist.
@ -286,7 +286,7 @@ private:
wxString getNoiseSource() const;
void parseTraceParams( SIM_PLOT_PANEL* aPlotPanel, TRACE* aTrace, const wxString& aSignalName,
void parseTraceParams( SIM_PLOT_TAB* aPlotTab, TRACE* aTrace, const wxString& aSignalName,
const wxString& aParams );
std::shared_ptr<SPICE_SIMULATOR> simulator() const;

View File

@ -154,7 +154,7 @@ int SIMULATOR_CONTROL::SaveWorkbook( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::ExportPlotAsPNG( const TOOL_EVENT& aEvent )
{
if( SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() ) )
if( SIM_PLOT_TAB* plotPanel = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentPlotPanel() ) )
{
wxFileDialog saveDlg( m_simulatorFrame, _( "Save Plot as Image" ), "", "",
PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
@ -169,15 +169,15 @@ int SIMULATOR_CONTROL::ExportPlotAsPNG( const TOOL_EVENT& aEvent )
}
SIM_PLOT_PANEL_BASE* SIMULATOR_CONTROL::GetCurrentPlotPanel()
SIM_TAB* SIMULATOR_CONTROL::GetCurrentPlotPanel()
{
return m_simulatorFrame->GetCurrentPlotPanel();
return m_simulatorFrame->GetCurrentSimTab();
}
int SIMULATOR_CONTROL::ExportPlotAsCSV( const TOOL_EVENT& aEvent )
{
if( SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() ) )
if( SIM_PLOT_TAB* plotPanel = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentPlotPanel() ) )
{
const wxChar SEPARATOR = ';';
@ -238,7 +238,7 @@ int SIMULATOR_CONTROL::Close( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::Zoom( const TOOL_EVENT& aEvent )
{
if( SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() ) )
if( SIM_PLOT_TAB* plotPanel = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentPlotPanel() ) )
{
if( aEvent.IsAction( &ACTIONS::zoomInCenter ) ) plotPanel->GetPlotWin()->ZoomIn();
else if( aEvent.IsAction( &ACTIONS::zoomOutCenter ) ) plotPanel->GetPlotWin()->ZoomOut();
@ -251,7 +251,7 @@ int SIMULATOR_CONTROL::Zoom( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::ToggleGrid( const TOOL_EVENT& aEvent )
{
if( SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() ) )
if( SIM_PLOT_TAB* plotPanel = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentPlotPanel() ) )
{
plotPanel->ShowGrid( !plotPanel->IsGridShown() );
m_simulatorFrame->OnModify();
@ -263,7 +263,7 @@ int SIMULATOR_CONTROL::ToggleGrid( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::ToggleLegend( const TOOL_EVENT& aEvent )
{
if( SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() ) )
if( SIM_PLOT_TAB* plotPanel = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentPlotPanel() ) )
{
plotPanel->ShowLegend( !plotPanel->IsLegendShown() );
m_simulatorFrame->OnModify();
@ -275,7 +275,7 @@ int SIMULATOR_CONTROL::ToggleLegend( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::ToggleDottedSecondary( const TOOL_EVENT& aEvent )
{
if( SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( GetCurrentPlotPanel() ) )
if( SIM_PLOT_TAB* plotPanel = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentPlotPanel() ) )
{
plotPanel->SetDottedSecondary( !plotPanel->GetDottedSecondary() );
m_simulatorFrame->OnModify();

View File

@ -30,7 +30,7 @@
class SIMULATOR_FRAME;
class NGSPICE_CIRCUIT_MODEL;
class SPICE_SIMULATOR;
class SIM_PLOT_PANEL_BASE;
class SIM_TAB;
/**
@ -85,7 +85,7 @@ private:
*/
wxString getDefaultPath();
SIM_PLOT_PANEL_BASE* GetCurrentPlotPanel();
SIM_TAB* GetCurrentPlotPanel();
///< Set up handlers for various events.
void setTransitions() override;

View File

@ -26,8 +26,8 @@
#define SIM_NOTEBOOK_H
#include "dialogs/dialog_sim_command.h"
#include "sim/sim_plot_panel_base.h"
#include "sim/sim_plot_panel.h"
#include "sim/sim_tab.h"
#include "sim/sim_plot_tab.h"
class SIM_NOTEBOOK : public wxAuiNotebook