Renaming to support potential future usage of SIMULATOR_PANEL as a panel within SIMULATOR_FRAME.

This commit is contained in:
Jeff Young 2023-06-14 16:59:19 +01:00
parent fc1d540036
commit 5c4ca9f092
9 changed files with 50 additions and 51 deletions

View File

@ -227,8 +227,8 @@ set( EESCHEMA_SIM_SRCS
sim/ngspice.cpp sim/ngspice.cpp
sim/simulator_frame.cpp sim/simulator_frame.cpp
sim/simulator_frame_base.cpp sim/simulator_frame_base.cpp
sim/sim_panel_base.cpp
sim/sim_plot_colors.cpp sim/sim_plot_colors.cpp
sim/sim_plot_panel_base.cpp
sim/sim_plot_panel.cpp sim/sim_plot_panel.cpp
sim/sim_property.cpp sim/sim_property.cpp
sim/spice_simulator.cpp sim/spice_simulator.cpp

View File

@ -379,7 +379,7 @@ void CURSOR::UpdateReference()
SIM_PLOT_PANEL::SIM_PLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent, SIM_PLOT_PANEL::SIM_PLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent,
wxWindowID id, const wxPoint& pos, const wxSize& size, long style, wxWindowID id, const wxPoint& pos, const wxSize& size, long style,
const wxString& name ) : const wxString& name ) :
SIM_PANEL_BASE( aCommand, aOptions, parent, id, pos, size, style, name ), SIM_PLOT_PANEL_BASE( aCommand, aOptions, parent, id, pos, size, style, name ),
m_axis_x( nullptr ), m_axis_x( nullptr ),
m_axis_y1( nullptr ), m_axis_y1( nullptr ),
m_axis_y2( nullptr ), m_axis_y2( nullptr ),

View File

@ -33,7 +33,7 @@
#include <widgets/mathplot.h> #include <widgets/mathplot.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include "sim_panel_base.h" #include "sim_plot_panel_base.h"
#include "sim_plot_colors.h" #include "sim_plot_colors.h"
class SIMULATOR_FRAME; class SIMULATOR_FRAME;
@ -191,7 +191,7 @@ protected:
}; };
class SIM_PLOT_PANEL : public SIM_PANEL_BASE class SIM_PLOT_PANEL : public SIM_PLOT_PANEL_BASE
{ {
public: public:
SIM_PLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent, wxWindowID id, SIM_PLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent, wxWindowID id,

View File

@ -24,22 +24,22 @@
*/ */
#include "confirm.h" #include "confirm.h"
#include "sim_panel_base.h" #include "sim_plot_panel_base.h"
#include "simulator_frame.h" #include "simulator_frame.h"
#include "ngspice_circuit_model.h" #include "ngspice_circuit_model.h"
SIM_PANEL_BASE::SIM_PANEL_BASE() : SIM_PLOT_PANEL_BASE::SIM_PLOT_PANEL_BASE() :
m_simCommand( wxEmptyString ), m_simCommand( wxEmptyString ),
m_simOptions( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS ) m_simOptions( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS )
{ {
} }
SIM_PANEL_BASE::SIM_PANEL_BASE( const wxString& aCommand, int aOptions, wxWindow* parent, SIM_PLOT_PANEL_BASE::SIM_PLOT_PANEL_BASE( const wxString& aCommand, int aOptions, wxWindow* parent,
wxWindowID id, const wxPoint& pos, const wxSize& size, long style, wxWindowID id, const wxPoint& pos, const wxSize& size,
const wxString& name ) : long style, const wxString& name ) :
wxWindow( parent, id, pos, size, style, name ), wxWindow( parent, id, pos, size, style, name ),
m_simCommand( aCommand ), m_simCommand( aCommand ),
m_simOptions( aOptions ) m_simOptions( aOptions )
@ -47,12 +47,12 @@ SIM_PANEL_BASE::SIM_PANEL_BASE( const wxString& aCommand, int aOptions, wxWindow
} }
SIM_PANEL_BASE::~SIM_PANEL_BASE() SIM_PLOT_PANEL_BASE::~SIM_PLOT_PANEL_BASE()
{ {
} }
bool SIM_PANEL_BASE::IsPlottable( SIM_TYPE aSimType ) bool SIM_PLOT_PANEL_BASE::IsPlottable( SIM_TYPE aSimType )
{ {
switch( aSimType ) switch( aSimType )
{ {
@ -67,7 +67,7 @@ bool SIM_PANEL_BASE::IsPlottable( SIM_TYPE aSimType )
} }
SIM_TYPE SIM_PANEL_BASE::GetType() const SIM_TYPE SIM_PLOT_PANEL_BASE::GetType() const
{ {
return NGSPICE_CIRCUIT_MODEL::CommandToSimType( m_simCommand ); return NGSPICE_CIRCUIT_MODEL::CommandToSimType( m_simCommand );
} }
@ -76,7 +76,7 @@ SIM_TYPE SIM_PANEL_BASE::GetType() const
SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent, SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent,
wxWindowID id, const wxPoint& pos, const wxSize& size, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) : long style, const wxString& name ) :
SIM_PANEL_BASE( aCommand, aOptions, parent, id, pos, size, style, name ) SIM_PLOT_PANEL_BASE( aCommand, aOptions, parent, id, pos, size, style, name )
{ {
m_sizer = new wxBoxSizer( wxVERTICAL ); m_sizer = new wxBoxSizer( wxVERTICAL );
m_sizer->Add( 0, 1, 1, wxEXPAND, 5 ); m_sizer->Add( 0, 1, 1, wxEXPAND, 5 );

View File

@ -33,14 +33,14 @@
#include <wx/stattext.h> #include <wx/stattext.h>
class SIM_PANEL_BASE : public wxWindow class SIM_PLOT_PANEL_BASE : public wxWindow
{ {
public: public:
SIM_PANEL_BASE(); SIM_PLOT_PANEL_BASE();
SIM_PANEL_BASE( const wxString& aCommand, int aOptions, wxWindow* parent, wxWindowID id, SIM_PLOT_PANEL_BASE( const wxString& aCommand, int aOptions, wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = wxPanelNameStr ); long style = 0, const wxString& name = wxPanelNameStr );
virtual ~SIM_PANEL_BASE(); virtual ~SIM_PLOT_PANEL_BASE();
static bool IsPlottable( SIM_TYPE aSimType ); static bool IsPlottable( SIM_TYPE aSimType );
@ -66,7 +66,7 @@ private:
}; };
class SIM_NOPLOT_PANEL : public SIM_PANEL_BASE class SIM_NOPLOT_PANEL : public SIM_PLOT_PANEL_BASE
{ {
public: public:
SIM_NOPLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent, wxWindowID id, SIM_NOPLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent, wxWindowID id,

View File

@ -627,7 +627,7 @@ void SIMULATOR_FRAME::ShowChangedLanguage()
for( int ii = 0; ii < (int) m_plotNotebook->GetPageCount(); ++ii ) for( int ii = 0; ii < (int) m_plotNotebook->GetPageCount(); ++ii )
{ {
SIM_PANEL_BASE* plot = dynamic_cast<SIM_PLOT_PANEL*>( m_plotNotebook->GetPage( ii ) ); auto plot = dynamic_cast<SIM_PLOT_PANEL_BASE*>( m_plotNotebook->GetPage( ii ) );
wxCHECK( plot, /* void */ ); wxCHECK( plot, /* void */ );
@ -1018,9 +1018,9 @@ void SIMULATOR_FRAME::StartSimulation()
return; return;
} }
wxString schTextSimCommand = m_circuitModel->GetSchTextSimCommand(); wxString schTextSimCommand = m_circuitModel->GetSchTextSimCommand();
SIM_TYPE schTextSimType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( schTextSimCommand ); SIM_TYPE schTextSimType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( schTextSimCommand );
SIM_PANEL_BASE* plotWindow = getCurrentPlotWindow(); SIM_PLOT_PANEL_BASE* plotWindow = getCurrentPlotWindow();
if( !plotWindow ) if( !plotWindow )
{ {
@ -1070,23 +1070,22 @@ void SIMULATOR_FRAME::StartSimulation()
} }
SIM_PANEL_BASE* SIMULATOR_FRAME::NewPlotPanel( const wxString& aSimCommand, int aOptions ) SIM_PLOT_PANEL_BASE* SIMULATOR_FRAME::NewPlotPanel( const wxString& aSimCommand, int aOptions )
{ {
SIM_PANEL_BASE* plotPanel = nullptr; SIM_PLOT_PANEL_BASE* plotPanel = nullptr;
SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand ); SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand );
if( SIM_PANEL_BASE::IsPlottable( simType ) ) if( SIM_PLOT_PANEL_BASE::IsPlottable( simType ) )
{ {
SIM_PLOT_PANEL* panel = new SIM_PLOT_PANEL( aSimCommand, aOptions, m_plotNotebook, wxID_ANY ); SIM_PLOT_PANEL* panel = new SIM_PLOT_PANEL( aSimCommand, aOptions, m_plotNotebook, wxID_ANY );
plotPanel = dynamic_cast<SIM_PANEL_BASE*>( panel ); plotPanel = panel;
COMMON_SETTINGS::INPUT cfg = Pgm().GetCommonSettings()->m_Input; COMMON_SETTINGS::INPUT cfg = Pgm().GetCommonSettings()->m_Input;
panel->GetPlotWin()->EnableMouseWheelPan( cfg.scroll_modifier_zoom != 0 ); panel->GetPlotWin()->EnableMouseWheelPan( cfg.scroll_modifier_zoom != 0 );
} }
else else
{ {
SIM_NOPLOT_PANEL* panel = new SIM_NOPLOT_PANEL( aSimCommand, aOptions, m_plotNotebook, wxID_ANY ); plotPanel = new SIM_NOPLOT_PANEL( aSimCommand, aOptions, m_plotNotebook, wxID_ANY );
plotPanel = dynamic_cast<SIM_PANEL_BASE*>( panel );
} }
wxString pageTitle( m_simulator->TypeToName( simType, true ) ); wxString pageTitle( m_simulator->TypeToName( simType, true ) );
@ -1472,7 +1471,7 @@ void SIMULATOR_FRAME::AddCurrentTrace( const wxString& aDeviceName )
void SIMULATOR_FRAME::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol ) void SIMULATOR_FRAME::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol )
{ {
SIM_PANEL_BASE* plotPanel = getCurrentPlotWindow(); SIM_PLOT_PANEL_BASE* plotPanel = getCurrentPlotWindow();
if( !plotPanel ) if( !plotPanel )
return; return;
@ -1594,7 +1593,7 @@ void SIMULATOR_FRAME::AddMeasurement( const wxString& aCmd )
SIM_PLOT_PANEL* SIMULATOR_FRAME::GetCurrentPlot() const SIM_PLOT_PANEL* SIMULATOR_FRAME::GetCurrentPlot() const
{ {
SIM_PANEL_BASE* curPage = getCurrentPlotWindow(); SIM_PLOT_PANEL_BASE* curPage = getCurrentPlotWindow();
return !curPage || curPage->GetType() == ST_UNKNOWN ? nullptr return !curPage || curPage->GetType() == ST_UNKNOWN ? nullptr
: dynamic_cast<SIM_PLOT_PANEL*>( curPage ); : dynamic_cast<SIM_PLOT_PANEL*>( curPage );
@ -1626,7 +1625,7 @@ void SIMULATOR_FRAME::doAddTrace( const wxString& aName, SIM_TRACE_TYPE aType )
m_simConsole->SetInsertionPointEnd(); m_simConsole->SetInsertionPointEnd();
return; return;
} }
else if( !SIM_PANEL_BASE::IsPlottable( simType ) ) else if( !SIM_PLOT_PANEL_BASE::IsPlottable( simType ) )
{ {
m_simConsole->AppendText( _( "Error: simulation type doesn't support plotting.\n" ) ); m_simConsole->AppendText( _( "Error: simulation type doesn't support plotting.\n" ) );
m_simConsole->SetInsertionPointEnd(); m_simConsole->SetInsertionPointEnd();
@ -1719,7 +1718,7 @@ void SIMULATOR_FRAME::updateTrace( const wxString& aVectorName, int aTraceType,
if( aTraceType & SPT_POWER ) if( aTraceType & SPT_POWER )
simVectorName = simVectorName.AfterFirst( '(' ).BeforeLast( ')' ) + wxS( ":power" ); simVectorName = simVectorName.AfterFirst( '(' ).BeforeLast( ')' ) + wxS( ":power" );
if( !SIM_PANEL_BASE::IsPlottable( simType ) ) if( !SIM_PLOT_PANEL_BASE::IsPlottable( simType ) )
{ {
// There is no plot to be shown // There is no plot to be shown
m_simulator->Command( wxString::Format( wxT( "print %s" ), aVectorName ).ToStdString() ); m_simulator->Command( wxString::Format( wxT( "print %s" ), aVectorName ).ToStdString() );
@ -2208,7 +2207,7 @@ bool SIMULATOR_FRAME::LoadWorkbook( const wxString& aPath )
for( int ii = 0; ii < (int) m_plotNotebook->GetPageCount(); ++ii ) for( int ii = 0; ii < (int) m_plotNotebook->GetPageCount(); ++ii )
{ {
auto* plot = dynamic_cast<const SIM_PANEL_BASE*>( m_plotNotebook->GetPage( ii ) ); auto* plot = dynamic_cast<const SIM_PLOT_PANEL_BASE*>( m_plotNotebook->GetPage( ii ) );
if( plot && plot->GetType() == schTextSimType ) if( plot && plot->GetType() == schTextSimType )
{ {
@ -2280,7 +2279,7 @@ bool SIMULATOR_FRAME::SaveWorkbook( const wxString& aPath )
for( size_t i = 0; i < m_plotNotebook->GetPageCount(); i++ ) for( size_t i = 0; i < m_plotNotebook->GetPageCount(); i++ )
{ {
const SIM_PANEL_BASE* basePanel = dynamic_cast<const SIM_PANEL_BASE*>( m_plotNotebook->GetPage( i ) ); auto* basePanel = dynamic_cast<const SIM_PLOT_PANEL_BASE*>( m_plotNotebook->GetPage( i ) );
if( !basePanel ) if( !basePanel )
{ {
@ -2473,7 +2472,7 @@ void SIMULATOR_FRAME::onPlotClosed( wxAuiNotebookEvent& event )
rebuildSignalsGrid( m_filter->GetValue() ); rebuildSignalsGrid( m_filter->GetValue() );
updateCursors(); updateCursors();
SIM_PANEL_BASE* panel = getCurrentPlotWindow(); SIM_PLOT_PANEL_BASE* panel = getCurrentPlotWindow();
if( !panel || panel->GetType() != ST_OP ) if( !panel || panel->GetType() != ST_OP )
{ {
@ -2508,10 +2507,10 @@ void SIMULATOR_FRAME::onNotebookModified( wxCommandEvent& event )
bool SIMULATOR_FRAME::EditSimCommand() bool SIMULATOR_FRAME::EditSimCommand()
{ {
SIM_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow(); SIM_PLOT_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow();
DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() ); DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() );
wxString errors; wxString errors;
WX_STRING_REPORTER reporter( &errors ); WX_STRING_REPORTER reporter( &errors );
if( !m_circuitModel->ReadSchematicAndLibraries( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS, if( !m_circuitModel->ReadSchematicAndLibraries( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS,
reporter ) ) reporter ) )
@ -2856,7 +2855,7 @@ void SIMULATOR_FRAME::onSimFinished( wxCommandEvent& aEvent )
if( simType == ST_UNKNOWN ) if( simType == ST_UNKNOWN )
return; return;
SIM_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow(); SIM_PLOT_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow();
if( !plotPanelWindow || plotPanelWindow->GetType() != simType ) if( !plotPanelWindow || plotPanelWindow->GetType() != simType )
{ {
@ -2894,7 +2893,7 @@ void SIMULATOR_FRAME::onSimFinished( wxCommandEvent& aEvent )
schematic.ClearOperatingPoints(); schematic.ClearOperatingPoints();
// If there are any signals plotted, update them // If there are any signals plotted, update them
if( SIM_PANEL_BASE::IsPlottable( simType ) ) if( SIM_PLOT_PANEL_BASE::IsPlottable( simType ) )
{ {
SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( plotPanelWindow ); SIM_PLOT_PANEL* plotPanel = dynamic_cast<SIM_PLOT_PANEL*>( plotPanelWindow );
wxCHECK_RET( plotPanel, wxT( "not a SIM_PLOT_PANEL" ) ); wxCHECK_RET( plotPanel, wxT( "not a SIM_PLOT_PANEL" ) );

View File

@ -49,7 +49,7 @@ class SPICE_SIMULATOR_SETTINGS;
class NGSPICE_CIRCUIT_MODEL; class NGSPICE_CIRCUIT_MODEL;
#include <sim/sim_plot_panel.h> #include <sim/sim_plot_panel.h>
#include <sim/sim_panel_base.h> #include <sim/sim_plot_panel_base.h>
#include "widgets/sim_notebook.h" #include "widgets/sim_notebook.h"
class SIM_THREAD_REPORTER; class SIM_THREAD_REPORTER;
@ -96,7 +96,7 @@ public:
* @param aSimOptions netlisting options * @param aSimOptions netlisting options
* @return The new plot panel. * @return The new plot panel.
*/ */
SIM_PANEL_BASE* NewPlotPanel( const wxString& aSimCommand, int aSimOptions ); SIM_PLOT_PANEL_BASE* NewPlotPanel( const wxString& aSimCommand, int aSimOptions );
/** /**
* Shows a dialog for editing the current tab's simulation command, or creating a new tab * Shows a dialog for editing the current tab's simulation command, or creating a new tab
@ -322,9 +322,9 @@ private:
/** /**
* Return the currently opened plot panel (or NULL if there is none). * Return the currently opened plot panel (or NULL if there is none).
*/ */
SIM_PANEL_BASE* getCurrentPlotWindow() const SIM_PLOT_PANEL_BASE* getCurrentPlotWindow() const
{ {
return dynamic_cast<SIM_PANEL_BASE*>( m_plotNotebook->GetCurrentPage() ); return dynamic_cast<SIM_PLOT_PANEL_BASE*>( m_plotNotebook->GetCurrentPage() );
} }
/** /**
@ -386,7 +386,7 @@ private:
///< Panel that was used as the most recent one for simulations ///< Panel that was used as the most recent one for simulations
SIM_PANEL_BASE* m_lastSimPlot; SIM_PLOT_PANEL_BASE* m_lastSimPlot;
SPICE_VALUE_FORMAT m_cursorFormats[3][2]; SPICE_VALUE_FORMAT m_cursorFormats[3][2];

View File

@ -64,7 +64,7 @@ int SIMULATOR_CONTROL::NewPlot( const TOOL_EVENT& aEvent )
{ {
SIM_TYPE type = m_circuitModel->GetSimType(); SIM_TYPE type = m_circuitModel->GetSimType();
if( SIM_PANEL_BASE::IsPlottable( type ) ) if( SIM_PLOT_PANEL_BASE::IsPlottable( type ) )
{ {
m_simulatorFrame->NewPlotPanel( m_circuitModel->GetSimCommand(), m_simulatorFrame->NewPlotPanel( m_circuitModel->GetSimCommand(),
m_circuitModel->GetSimOptions() ); m_circuitModel->GetSimOptions() );

View File

@ -26,7 +26,7 @@
#define SIM_NOTEBOOK_H #define SIM_NOTEBOOK_H
#include "dialogs/dialog_sim_command.h" #include "dialogs/dialog_sim_command.h"
#include "sim/sim_panel_base.h" #include "sim/sim_plot_panel_base.h"
#include "sim/sim_plot_panel.h" #include "sim/sim_plot_panel.h"