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/simulator_frame.cpp
sim/simulator_frame_base.cpp
sim/sim_panel_base.cpp
sim/sim_plot_colors.cpp
sim/sim_plot_panel_base.cpp
sim/sim_plot_panel.cpp
sim/sim_property.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,
wxWindowID id, const wxPoint& pos, const wxSize& size, 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_axis_x( nullptr ),
m_axis_y1( nullptr ),
m_axis_y2( nullptr ),

View File

@ -33,7 +33,7 @@
#include <widgets/mathplot.h>
#include <wx/colour.h>
#include <wx/sizer.h>
#include "sim_panel_base.h"
#include "sim_plot_panel_base.h"
#include "sim_plot_colors.h"
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:
SIM_PLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent, wxWindowID id,

View File

@ -24,22 +24,22 @@
*/
#include "confirm.h"
#include "sim_panel_base.h"
#include "sim_plot_panel_base.h"
#include "simulator_frame.h"
#include "ngspice_circuit_model.h"
SIM_PANEL_BASE::SIM_PANEL_BASE() :
SIM_PLOT_PANEL_BASE::SIM_PLOT_PANEL_BASE() :
m_simCommand( wxEmptyString ),
m_simOptions( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS )
{
}
SIM_PANEL_BASE::SIM_PANEL_BASE( const wxString& aCommand, int aOptions, wxWindow* parent,
wxWindowID id, const wxPoint& pos, const wxSize& size, long style,
const wxString& name ) :
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, const wxString& name ) :
wxWindow( parent, id, pos, size, style, name ),
m_simCommand( aCommand ),
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 )
{
@ -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 );
}
@ -76,7 +76,7 @@ SIM_TYPE SIM_PANEL_BASE::GetType() const
SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( const wxString& aCommand, int aOptions, wxWindow* parent,
wxWindowID id, const wxPoint& pos, const wxSize& size,
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->Add( 0, 1, 1, wxEXPAND, 5 );

View File

@ -33,14 +33,14 @@
#include <wx/stattext.h>
class SIM_PANEL_BASE : public wxWindow
class SIM_PLOT_PANEL_BASE : public wxWindow
{
public:
SIM_PANEL_BASE();
SIM_PANEL_BASE( const wxString& aCommand, int aOptions, wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = wxPanelNameStr );
virtual ~SIM_PANEL_BASE();
SIM_PLOT_PANEL_BASE();
SIM_PLOT_PANEL_BASE( const wxString& aCommand, int aOptions, wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = wxPanelNameStr );
virtual ~SIM_PLOT_PANEL_BASE();
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:
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 )
{
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 */ );
@ -1018,9 +1018,9 @@ void SIMULATOR_FRAME::StartSimulation()
return;
}
wxString schTextSimCommand = m_circuitModel->GetSchTextSimCommand();
SIM_TYPE schTextSimType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( schTextSimCommand );
SIM_PANEL_BASE* plotWindow = getCurrentPlotWindow();
wxString schTextSimCommand = m_circuitModel->GetSchTextSimCommand();
SIM_TYPE schTextSimType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( schTextSimCommand );
SIM_PLOT_PANEL_BASE* plotWindow = getCurrentPlotWindow();
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_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand );
SIM_PLOT_PANEL_BASE* plotPanel = nullptr;
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 );
plotPanel = dynamic_cast<SIM_PANEL_BASE*>( panel );
plotPanel = panel;
COMMON_SETTINGS::INPUT cfg = Pgm().GetCommonSettings()->m_Input;
panel->GetPlotWin()->EnableMouseWheelPan( cfg.scroll_modifier_zoom != 0 );
}
else
{
SIM_NOPLOT_PANEL* panel = new SIM_NOPLOT_PANEL( aSimCommand, aOptions, m_plotNotebook, wxID_ANY );
plotPanel = dynamic_cast<SIM_PANEL_BASE*>( panel );
plotPanel = new SIM_NOPLOT_PANEL( aSimCommand, aOptions, m_plotNotebook, wxID_ANY );
}
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 )
{
SIM_PANEL_BASE* plotPanel = getCurrentPlotWindow();
SIM_PLOT_PANEL_BASE* plotPanel = getCurrentPlotWindow();
if( !plotPanel )
return;
@ -1594,7 +1593,7 @@ void SIMULATOR_FRAME::AddMeasurement( const wxString& aCmd )
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
: dynamic_cast<SIM_PLOT_PANEL*>( curPage );
@ -1626,7 +1625,7 @@ void SIMULATOR_FRAME::doAddTrace( const wxString& aName, SIM_TRACE_TYPE aType )
m_simConsole->SetInsertionPointEnd();
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->SetInsertionPointEnd();
@ -1719,7 +1718,7 @@ void SIMULATOR_FRAME::updateTrace( const wxString& aVectorName, int aTraceType,
if( aTraceType & SPT_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
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 )
{
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 )
{
@ -2280,7 +2279,7 @@ bool SIMULATOR_FRAME::SaveWorkbook( const wxString& aPath )
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 )
{
@ -2473,7 +2472,7 @@ void SIMULATOR_FRAME::onPlotClosed( wxAuiNotebookEvent& event )
rebuildSignalsGrid( m_filter->GetValue() );
updateCursors();
SIM_PANEL_BASE* panel = getCurrentPlotWindow();
SIM_PLOT_PANEL_BASE* panel = getCurrentPlotWindow();
if( !panel || panel->GetType() != ST_OP )
{
@ -2508,10 +2507,10 @@ void SIMULATOR_FRAME::onNotebookModified( wxCommandEvent& event )
bool SIMULATOR_FRAME::EditSimCommand()
{
SIM_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow();
DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() );
wxString errors;
WX_STRING_REPORTER reporter( &errors );
SIM_PLOT_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow();
DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() );
wxString errors;
WX_STRING_REPORTER reporter( &errors );
if( !m_circuitModel->ReadSchematicAndLibraries( NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS,
reporter ) )
@ -2856,7 +2855,7 @@ void SIMULATOR_FRAME::onSimFinished( wxCommandEvent& aEvent )
if( simType == ST_UNKNOWN )
return;
SIM_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow();
SIM_PLOT_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow();
if( !plotPanelWindow || plotPanelWindow->GetType() != simType )
{
@ -2894,7 +2893,7 @@ void SIMULATOR_FRAME::onSimFinished( wxCommandEvent& aEvent )
schematic.ClearOperatingPoints();
// 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 );
wxCHECK_RET( plotPanel, wxT( "not a SIM_PLOT_PANEL" ) );

View File

@ -49,7 +49,7 @@ class SPICE_SIMULATOR_SETTINGS;
class NGSPICE_CIRCUIT_MODEL;
#include <sim/sim_plot_panel.h>
#include <sim/sim_panel_base.h>
#include <sim/sim_plot_panel_base.h>
#include "widgets/sim_notebook.h"
class SIM_THREAD_REPORTER;
@ -96,7 +96,7 @@ public:
* @param aSimOptions netlisting options
* @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
@ -322,9 +322,9 @@ private:
/**
* 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
SIM_PANEL_BASE* m_lastSimPlot;
SIM_PLOT_PANEL_BASE* m_lastSimPlot;
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();
if( SIM_PANEL_BASE::IsPlottable( type ) )
if( SIM_PLOT_PANEL_BASE::IsPlottable( type ) )
{
m_simulatorFrame->NewPlotPanel( m_circuitModel->GetSimCommand(),
m_circuitModel->GetSimOptions() );

View File

@ -26,7 +26,7 @@
#define SIM_NOTEBOOK_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"