Naming conventions and commenting. No functional changes.

This commit is contained in:
Jeff Young 2023-03-03 22:36:07 +00:00
parent 48740dd3f8
commit b6d0b65261
26 changed files with 304 additions and 264 deletions

View File

@ -356,16 +356,16 @@ if( KICAD_SPICE )
tools/simulator_control.cpp tools/simulator_control.cpp
sim/ngspice_circuit_model.cpp sim/ngspice_circuit_model.cpp
sim/ngspice.cpp sim/ngspice.cpp
sim/sim_notebook.cpp sim/simulator_frame.cpp
sim/simulator_frame_base.cpp
sim/sim_panel_base.cpp sim/sim_panel_base.cpp
sim/sim_plot_colors.cpp sim/sim_plot_colors.cpp
sim/sim_plot_frame.cpp
sim/sim_plot_frame_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
sim/spice_value.cpp sim/spice_value.cpp
sim/toolbars_sim_plot_frame.cpp sim/toolbars_simulator_frame.cpp
widgets/sim_notebook.cpp
widgets/tuner_slider.cpp widgets/tuner_slider.cpp
widgets/tuner_slider_base.cpp widgets/tuner_slider_base.cpp
) )

View File

@ -26,11 +26,11 @@
#include <widgets/grid_text_helpers.h> #include <widgets/grid_text_helpers.h>
#include <grid_tricks.h> #include <grid_tricks.h>
#include <dialogs/html_message_box.h> #include <dialogs/html_message_box.h>
#include <../sim/sim_plot_frame.h> #include <../sim/simulator_frame.h>
#include <dialog_user_defined_signals.h> #include <dialog_user_defined_signals.h>
DIALOG_USER_DEFINED_SIGNALS::DIALOG_USER_DEFINED_SIGNALS( SIM_PLOT_FRAME* aParent, DIALOG_USER_DEFINED_SIGNALS::DIALOG_USER_DEFINED_SIGNALS( SIMULATOR_FRAME* aParent,
std::map<int, wxString>* aSignals ) : std::map<int, wxString>* aSignals ) :
DIALOG_USER_DEFINED_SIGNALS_BASE( aParent ), DIALOG_USER_DEFINED_SIGNALS_BASE( aParent ),
m_frame( aParent ), m_frame( aParent ),

View File

@ -27,7 +27,7 @@
#include <dialog_user_defined_signals_base.h> #include <dialog_user_defined_signals_base.h>
class SIM_PLOT_FRAME; class SIMULATOR_FRAME;
class SCINTILLA_TRICKS; class SCINTILLA_TRICKS;
class HTML_MESSAGE_BOX; class HTML_MESSAGE_BOX;
@ -35,7 +35,7 @@ class HTML_MESSAGE_BOX;
class DIALOG_USER_DEFINED_SIGNALS : public DIALOG_USER_DEFINED_SIGNALS_BASE class DIALOG_USER_DEFINED_SIGNALS : public DIALOG_USER_DEFINED_SIGNALS_BASE
{ {
public: public:
DIALOG_USER_DEFINED_SIGNALS( SIM_PLOT_FRAME* parent, std::map<int, wxString>* aSignals ); DIALOG_USER_DEFINED_SIGNALS( SIMULATOR_FRAME* parent, std::map<int, wxString>* aSignals );
~DIALOG_USER_DEFINED_SIGNALS(); ~DIALOG_USER_DEFINED_SIGNALS();
private: private:
@ -50,7 +50,7 @@ private:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
private: private:
SIM_PLOT_FRAME* m_frame; SIMULATOR_FRAME* m_frame;
std::map<int, wxString>* m_signals; std::map<int, wxString>* m_signals;
HTML_MESSAGE_BOX* m_helpWindow; HTML_MESSAGE_BOX* m_helpWindow;

View File

@ -59,7 +59,7 @@
#include <dialogs/panel_gal_display_options.h> #include <dialogs/panel_gal_display_options.h>
#include <panel_eeschema_display_options.h> #include <panel_eeschema_display_options.h>
#include <panel_sym_display_options.h> #include <panel_sym_display_options.h>
#include <sim/sim_plot_frame.h> #include <sim/simulator_frame.h>
#include <wx/crt.h> #include <wx/crt.h>
@ -172,7 +172,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
#ifdef KICAD_SPICE #ifdef KICAD_SPICE
case FRAME_SIMULATOR: case FRAME_SIMULATOR:
{ {
SIM_PLOT_FRAME* frame = new SIM_PLOT_FRAME( aKiway, aParent ); SIMULATOR_FRAME* frame = new SIMULATOR_FRAME( aKiway, aParent );
return frame; return frame;
} }
#endif #endif

View File

@ -49,7 +49,7 @@
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
#include <schematic.h> #include <schematic.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <sim/sim_plot_frame.h> #include <sim/simulator_frame.h>
#include <tool/actions.h> #include <tool/actions.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/sch_editor_control.h> #include <tools/sch_editor_control.h>
@ -1315,7 +1315,7 @@ bool SCH_EDIT_FRAME::AskToSaveChanges()
// Save any currently open and modified project files. // Save any currently open and modified project files.
for( SCH_SCREEN* screen = screenList.GetFirst(); screen; screen = screenList.GetNext() ) for( SCH_SCREEN* screen = screenList.GetFirst(); screen; screen = screenList.GetNext() )
{ {
SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) Kiway().Player( FRAME_SIMULATOR, false ); SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) Kiway().Player( FRAME_SIMULATOR, false );
// Simulator must be closed before loading another schematic, otherwise it may crash. // Simulator must be closed before loading another schematic, otherwise it may crash.
// If there are any changes in the simulator the user will be prompted to save them. // If there are any changes in the simulator the user will be prompted to save them.

View File

@ -54,7 +54,7 @@
#include <schematic.h> #include <schematic.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <advanced_config.h> #include <advanced_config.h>
#include <sim/sim_plot_frame.h> #include <sim/simulator_frame.h>
#include <sim/spice_settings.h> #include <sim/spice_settings.h>
#include <tool/action_manager.h> #include <tool/action_manager.h>
#include <tool/action_toolbar.h> #include <tool/action_toolbar.h>

View File

@ -26,7 +26,7 @@
#include "confirm.h" #include "confirm.h"
#include "sim_panel_base.h" #include "sim_panel_base.h"
#include "sim_plot_frame.h" #include "simulator_frame.h"
#include "ngspice_circuit_model.h" #include "ngspice_circuit_model.h"
@ -82,9 +82,8 @@ SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( const wxString& aCommand, int aOptions, wxWi
m_sizer->Add( 0, 1, 1, wxEXPAND, 5 ); m_sizer->Add( 0, 1, 1, wxEXPAND, 5 );
m_textInfo = new wxStaticText( dynamic_cast<wxWindow*>( this ), wxID_ANY, "", wxDefaultPosition, m_textInfo = new wxStaticText( dynamic_cast<wxWindow*>( this ), wxID_ANY, "", wxDefaultPosition,
wxDefaultSize, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL ); wxDefaultSize, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL );
m_textInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, m_textInfo->SetFont( KIUI::GetControlFont( this ).Bold() );
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_textInfo->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); m_textInfo->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
m_textInfo->SetLabel( _( "Simulation provided no plots. Please refer to console window " m_textInfo->SetLabel( _( "Simulation provided no plots. Please refer to console window "
"for results." ) ); "for results." ) );

View File

@ -27,7 +27,7 @@
#include "sim_plot_colors.h" #include "sim_plot_colors.h"
#include "sim_plot_panel.h" #include "sim_plot_panel.h"
#include "sim_plot_frame.h" #include "simulator_frame.h"
#include "core/kicad_algo.h" #include "core/kicad_algo.h"
#include <algorithm> #include <algorithm>

View File

@ -36,10 +36,29 @@
#include "sim_panel_base.h" #include "sim_panel_base.h"
#include "sim_plot_colors.h" #include "sim_plot_colors.h"
class SIM_PLOT_FRAME; class SIMULATOR_FRAME;
class SIM_PLOT_PANEL; class SIM_PLOT_PANEL;
class TRACE; 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
* 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,
* the GUI supports only two cursors (and a differential cursor) for each plot.
*
* TRACEs are identified by a signal (V(OUT), I(R2), etc.) and a type (SPT_VOLTAGE, SPT_AC_PHASE,
* etc.).
*
* The simulator outputs simple signals in a vector of the same name. Complex signals (such as
* V(OUT) / V(IN)) are stored in vectors of the format "user%d".
*
*/
///< Cursor attached to a trace to follow its values: ///< Cursor attached to a trace to follow its values:
class CURSOR : public mpInfoLayer class CURSOR : public mpInfoLayer
{ {
@ -106,8 +125,8 @@ class TRACE : public mpFXYVector
{ {
public: public:
TRACE( const wxString& aName, SIM_TRACE_TYPE aType ) : TRACE( const wxString& aName, SIM_TRACE_TYPE aType ) :
mpFXYVector( aName ), mpFXYVector( aName ),
m_type( aType ) m_type( aType )
{ {
SetContinuity( true ); SetContinuity( true );
SetDrawOutsideMargins( false ); SetDrawOutsideMargins( false );
@ -272,10 +291,7 @@ public:
void OnLanguageChanged() override; void OnLanguageChanged() override;
///< Getter for math plot window ///< Getter for math plot window
mpWindow* GetPlotWin() const mpWindow* GetPlotWin() const { return m_plotWin; }
{
return m_plotWin;
}
TRACE* AddTrace( const wxString& aVectorName, int aType ); TRACE* AddTrace( const wxString& aVectorName, int aType );

View File

@ -31,6 +31,13 @@
#include <ki_exception.h> #include <ki_exception.h>
/**
*
* wxPropertyGrid property specializations for simulator.
*
*/
SIM_PROPERTY::SIM_PROPERTY( SIM_MODEL& aModel, int aParamIndex ) : SIM_PROPERTY::SIM_PROPERTY( SIM_MODEL& aModel, int aParamIndex ) :
m_model( aModel ), m_model( aModel ),
m_paramIndex( aParamIndex ), m_paramIndex( aParamIndex ),

View File

@ -34,6 +34,13 @@
#include "libeval/numeric_evaluator.h" #include "libeval/numeric_evaluator.h"
/**
*
* wxPropertyGrid property specializations for simulator.
*
*/
class SIM_VALIDATOR : public wxValidator class SIM_VALIDATOR : public wxValidator
{ {
private: private:

View File

@ -42,7 +42,7 @@ enum SIM_TYPE
ST_TRANSIENT ST_TRANSIENT
}; };
///< Possible plot types ///< Possible trace types
enum SIM_TRACE_TYPE enum SIM_TRACE_TYPE
{ {
// Y axis // Y axis

View File

@ -52,7 +52,7 @@
#include <string_utils.h> #include <string_utils.h>
#include <pgm_base.h> #include <pgm_base.h>
#include "ngspice.h" #include "ngspice.h"
#include "sim_plot_frame.h" #include "simulator_frame.h"
#include "sim_plot_panel.h" #include "sim_plot_panel.h"
#include "spice_simulator.h" #include "spice_simulator.h"
#include "spice_reporter.h" #include "spice_reporter.h"
@ -75,7 +75,7 @@ SIM_TRACE_TYPE operator|( SIM_TRACE_TYPE aFirst, SIM_TRACE_TYPE aSecond )
class SIM_THREAD_REPORTER : public SPICE_REPORTER class SIM_THREAD_REPORTER : public SPICE_REPORTER
{ {
public: public:
SIM_THREAD_REPORTER( SIM_PLOT_FRAME* aParent ) : SIM_THREAD_REPORTER( SIMULATOR_FRAME* aParent ) :
m_parent( aParent ) m_parent( aParent )
{ {
} }
@ -108,7 +108,7 @@ public:
} }
private: private:
SIM_PLOT_FRAME* m_parent; SIMULATOR_FRAME* m_parent;
}; };
@ -158,7 +158,7 @@ enum
class SIGNALS_GRID_TRICKS : public GRID_TRICKS class SIGNALS_GRID_TRICKS : public GRID_TRICKS
{ {
public: public:
SIGNALS_GRID_TRICKS( SIM_PLOT_FRAME* aParent, WX_GRID* aGrid ) : SIGNALS_GRID_TRICKS( SIMULATOR_FRAME* aParent, WX_GRID* aGrid ) :
GRID_TRICKS( aGrid ), GRID_TRICKS( aGrid ),
m_parent( aParent ), m_parent( aParent ),
m_menuRow( 0 ), m_menuRow( 0 ),
@ -170,7 +170,7 @@ protected:
void doPopupSelection( wxCommandEvent& event ) override; void doPopupSelection( wxCommandEvent& event ) override;
protected: protected:
SIM_PLOT_FRAME* m_parent; SIMULATOR_FRAME* m_parent;
int m_menuRow; int m_menuRow;
int m_menuCol; int m_menuCol;
}; };
@ -283,7 +283,7 @@ void SIGNALS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
class CURSORS_GRID_TRICKS : public GRID_TRICKS class CURSORS_GRID_TRICKS : public GRID_TRICKS
{ {
public: public:
CURSORS_GRID_TRICKS( SIM_PLOT_FRAME* aParent, WX_GRID* aGrid ) : CURSORS_GRID_TRICKS( SIMULATOR_FRAME* aParent, WX_GRID* aGrid ) :
GRID_TRICKS( aGrid ), GRID_TRICKS( aGrid ),
m_parent( aParent ), m_parent( aParent ),
m_menuRow( 0 ), m_menuRow( 0 ),
@ -295,7 +295,7 @@ protected:
void doPopupSelection( wxCommandEvent& event ) override; void doPopupSelection( wxCommandEvent& event ) override;
protected: protected:
SIM_PLOT_FRAME* m_parent; SIMULATOR_FRAME* m_parent;
int m_menuRow; int m_menuRow;
int m_menuCol; int m_menuCol;
}; };
@ -340,7 +340,7 @@ void CURSORS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
class MEASUREMENTS_GRID_TRICKS : public GRID_TRICKS class MEASUREMENTS_GRID_TRICKS : public GRID_TRICKS
{ {
public: public:
MEASUREMENTS_GRID_TRICKS( SIM_PLOT_FRAME* aParent, WX_GRID* aGrid ) : MEASUREMENTS_GRID_TRICKS( SIMULATOR_FRAME* aParent, WX_GRID* aGrid ) :
GRID_TRICKS( aGrid ), GRID_TRICKS( aGrid ),
m_parent( aParent ), m_parent( aParent ),
m_menuRow( 0 ), m_menuRow( 0 ),
@ -352,7 +352,7 @@ protected:
void doPopupSelection( wxCommandEvent& event ) override; void doPopupSelection( wxCommandEvent& event ) override;
protected: protected:
SIM_PLOT_FRAME* m_parent; SIMULATOR_FRAME* m_parent;
int m_menuRow; int m_menuRow;
int m_menuCol; int m_menuCol;
}; };
@ -441,7 +441,7 @@ void MEASUREMENTS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
class SUPPRESS_GRID_CELL_EVENTS class SUPPRESS_GRID_CELL_EVENTS
{ {
public: public:
SUPPRESS_GRID_CELL_EVENTS( SIM_PLOT_FRAME* aFrame ) : SUPPRESS_GRID_CELL_EVENTS( SIMULATOR_FRAME* aFrame ) :
m_frame( aFrame ) m_frame( aFrame )
{ {
m_frame->m_SuppressGridEvents++; m_frame->m_SuppressGridEvents++;
@ -453,12 +453,12 @@ public:
} }
private: private:
SIM_PLOT_FRAME* m_frame; SIMULATOR_FRAME* m_frame;
}; };
SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SIM_PLOT_FRAME_BASE( aParent ), SIMULATOR_FRAME_BASE( aParent ),
m_SuppressGridEvents( 0 ), m_SuppressGridEvents( 0 ),
m_lastSimPlot( nullptr ), m_lastSimPlot( nullptr ),
m_darkMode( true ), m_darkMode( true ),
@ -534,16 +534,16 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateMenuBar(); ReCreateMenuBar();
Bind( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME::onExit ), this, Bind( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIMULATOR_FRAME::onExit ), this,
wxID_EXIT ); wxID_EXIT );
Bind( EVT_SIM_UPDATE, &SIM_PLOT_FRAME::onSimUpdate, this ); Bind( EVT_SIM_UPDATE, &SIMULATOR_FRAME::onSimUpdate, this );
Bind( EVT_SIM_REPORT, &SIM_PLOT_FRAME::onSimReport, this ); Bind( EVT_SIM_REPORT, &SIMULATOR_FRAME::onSimReport, this );
Bind( EVT_SIM_STARTED, &SIM_PLOT_FRAME::onSimStarted, this ); Bind( EVT_SIM_STARTED, &SIMULATOR_FRAME::onSimStarted, this );
Bind( EVT_SIM_FINISHED, &SIM_PLOT_FRAME::onSimFinished, this ); Bind( EVT_SIM_FINISHED, &SIMULATOR_FRAME::onSimFinished, this );
Bind( EVT_SIM_CURSOR_UPDATE, &SIM_PLOT_FRAME::onCursorUpdate, this ); Bind( EVT_SIM_CURSOR_UPDATE, &SIMULATOR_FRAME::onCursorUpdate, this );
Bind( EVT_WORKBOOK_MODIFIED, &SIM_PLOT_FRAME::onNotebookModified, this ); Bind( EVT_WORKBOOK_MODIFIED, &SIMULATOR_FRAME::onNotebookModified, this );
#ifndef wxHAS_NATIVE_TABART #ifndef wxHAS_NATIVE_TABART
// Default non-native tab art has ugly gradients we don't want // Default non-native tab art has ugly gradients we don't want
@ -569,7 +569,7 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
} }
SIM_PLOT_FRAME::~SIM_PLOT_FRAME() SIMULATOR_FRAME::~SIMULATOR_FRAME()
{ {
// Delete the GRID_TRICKS. // Delete the GRID_TRICKS.
m_signalsGrid->PopEventHandler( true ); m_signalsGrid->PopEventHandler( true );
@ -584,7 +584,7 @@ SIM_PLOT_FRAME::~SIM_PLOT_FRAME()
} }
void SIM_PLOT_FRAME::setupTools() void SIMULATOR_FRAME::setupTools()
{ {
// Create the manager // Create the manager
m_toolManager = new TOOL_MANAGER; m_toolManager = new TOOL_MANAGER;
@ -603,7 +603,7 @@ void SIM_PLOT_FRAME::setupTools()
} }
void SIM_PLOT_FRAME::ShowChangedLanguage() void SIMULATOR_FRAME::ShowChangedLanguage()
{ {
EDA_BASE_FRAME::ShowChangedLanguage(); EDA_BASE_FRAME::ShowChangedLanguage();
@ -640,7 +640,7 @@ void SIM_PLOT_FRAME::ShowChangedLanguage()
} }
void SIM_PLOT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) void SIMULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{ {
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg ); EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
wxASSERT( cfg ); wxASSERT( cfg );
@ -667,7 +667,7 @@ void SIM_PLOT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
} }
void SIM_PLOT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) void SIMULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{ {
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg ); EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
wxASSERT( cfg ); wxASSERT( cfg );
@ -694,7 +694,7 @@ void SIM_PLOT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
} }
WINDOW_SETTINGS* SIM_PLOT_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg ) WINDOW_SETTINGS* SIMULATOR_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
{ {
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg ); EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
wxASSERT( cfg ); wxASSERT( cfg );
@ -703,7 +703,7 @@ WINDOW_SETTINGS* SIM_PLOT_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
} }
void SIM_PLOT_FRAME::initWorkbook() void SIMULATOR_FRAME::initWorkbook()
{ {
if( !m_simulator->Settings()->GetWorkbookFilename().IsEmpty() ) if( !m_simulator->Settings()->GetWorkbookFilename().IsEmpty() )
{ {
@ -724,7 +724,7 @@ void SIM_PLOT_FRAME::initWorkbook()
} }
void SIM_PLOT_FRAME::updateTitle() void SIMULATOR_FRAME::updateTitle()
{ {
bool unsaved = true; bool unsaved = true;
bool readOnly = false; bool readOnly = false;
@ -758,7 +758,7 @@ void SIM_PLOT_FRAME::updateTitle()
} }
void SIM_PLOT_FRAME::setSubWindowsSashSize() void SIMULATOR_FRAME::setSubWindowsSashSize()
{ {
if( m_splitterLeftRightSashPosition > 0 ) if( m_splitterLeftRightSashPosition > 0 )
m_splitterLeftRight->SetSashPosition( m_splitterLeftRightSashPosition ); m_splitterLeftRight->SetSashPosition( m_splitterLeftRightSashPosition );
@ -777,7 +777,7 @@ void SIM_PLOT_FRAME::setSubWindowsSashSize()
} }
void SIM_PLOT_FRAME::rebuildSignalsGrid( wxString aFilter ) void SIMULATOR_FRAME::rebuildSignalsGrid( wxString aFilter )
{ {
SUPPRESS_GRID_CELL_EVENTS raii( this ); SUPPRESS_GRID_CELL_EVENTS raii( this );
@ -867,7 +867,7 @@ void SIM_PLOT_FRAME::rebuildSignalsGrid( wxString aFilter )
} }
void SIM_PLOT_FRAME::rebuildSignalsList() void SIMULATOR_FRAME::rebuildSignalsList()
{ {
m_signals.clear(); m_signals.clear();
@ -968,7 +968,7 @@ void SIM_PLOT_FRAME::rebuildSignalsList()
} }
bool SIM_PLOT_FRAME::LoadSimulator() bool SIMULATOR_FRAME::LoadSimulator()
{ {
wxString errors; wxString errors;
WX_STRING_REPORTER reporter( &errors ); WX_STRING_REPORTER reporter( &errors );
@ -986,7 +986,7 @@ bool SIM_PLOT_FRAME::LoadSimulator()
} }
void SIM_PLOT_FRAME::StartSimulation() void SIMULATOR_FRAME::StartSimulation()
{ {
if( m_circuitModel->CommandToSimType( GetCurrentSimCommand() ) == ST_UNKNOWN ) if( m_circuitModel->CommandToSimType( GetCurrentSimCommand() ) == ST_UNKNOWN )
{ {
@ -1049,7 +1049,7 @@ void SIM_PLOT_FRAME::StartSimulation()
} }
SIM_PANEL_BASE* SIM_PLOT_FRAME::NewPlotPanel( const wxString& aSimCommand, int aOptions ) SIM_PANEL_BASE* SIMULATOR_FRAME::NewPlotPanel( const wxString& aSimCommand, int aOptions )
{ {
SIM_PANEL_BASE* plotPanel = nullptr; SIM_PANEL_BASE* plotPanel = nullptr;
SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand ); SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand );
@ -1078,13 +1078,13 @@ SIM_PANEL_BASE* SIM_PLOT_FRAME::NewPlotPanel( const wxString& aSimCommand, int a
} }
void SIM_PLOT_FRAME::OnFilterText( wxCommandEvent& aEvent ) void SIMULATOR_FRAME::OnFilterText( wxCommandEvent& aEvent )
{ {
rebuildSignalsGrid( m_filter->GetValue() ); rebuildSignalsGrid( m_filter->GetValue() );
} }
void SIM_PLOT_FRAME::OnFilterMouseMoved( wxMouseEvent& aEvent ) void SIMULATOR_FRAME::OnFilterMouseMoved( wxMouseEvent& aEvent )
{ {
wxPoint pos = aEvent.GetPosition(); wxPoint pos = aEvent.GetPosition();
wxRect ctrlRect = m_filter->GetScreenRect(); wxRect ctrlRect = m_filter->GetScreenRect();
@ -1109,7 +1109,7 @@ wxString vectorNameFromSignalId( int aUserDefinedSignalId )
* For user-defined signals we display the user-oriented signal name such as "V(out)-V(in)", * For user-defined signals we display the user-oriented signal name such as "V(out)-V(in)",
* but the simulator vector we actually have to plot will be "user0" or some-such. * but the simulator vector we actually have to plot will be "user0" or some-such.
*/ */
wxString SIM_PLOT_FRAME::vectorNameFromSignalName( const wxString& aSignalName, int* aTraceType ) wxString SIMULATOR_FRAME::vectorNameFromSignalName( const wxString& aSignalName, int* aTraceType )
{ {
std::map<wxString, int> suffixes; std::map<wxString, int> suffixes;
suffixes[ _( " (gain)" ) ] = SPT_AC_MAG; suffixes[ _( " (gain)" ) ] = SPT_AC_MAG;
@ -1153,7 +1153,7 @@ wxString SIM_PLOT_FRAME::vectorNameFromSignalName( const wxString& aSignalName,
}; };
void SIM_PLOT_FRAME::onSignalsGridCellChanged( wxGridEvent& aEvent ) void SIMULATOR_FRAME::onSignalsGridCellChanged( wxGridEvent& aEvent )
{ {
if( m_SuppressGridEvents > 0 ) if( m_SuppressGridEvents > 0 )
return; return;
@ -1211,7 +1211,7 @@ void SIM_PLOT_FRAME::onSignalsGridCellChanged( wxGridEvent& aEvent )
} }
void SIM_PLOT_FRAME::onCursorsGridCellChanged( wxGridEvent& aEvent ) void SIMULATOR_FRAME::onCursorsGridCellChanged( wxGridEvent& aEvent )
{ {
if( m_SuppressGridEvents > 0 ) if( m_SuppressGridEvents > 0 )
return; return;
@ -1259,7 +1259,7 @@ void SIM_PLOT_FRAME::onCursorsGridCellChanged( wxGridEvent& aEvent )
} }
SPICE_VALUE_FORMAT SIM_PLOT_FRAME::GetMeasureFormat( int aRow ) const SPICE_VALUE_FORMAT SIMULATOR_FRAME::GetMeasureFormat( int aRow ) const
{ {
SPICE_VALUE_FORMAT result; SPICE_VALUE_FORMAT result;
result.FromString( m_measurementsGrid->GetCellValue( aRow, COL_MEASUREMENT_FORMAT ) ); result.FromString( m_measurementsGrid->GetCellValue( aRow, COL_MEASUREMENT_FORMAT ) );
@ -1267,14 +1267,14 @@ SPICE_VALUE_FORMAT SIM_PLOT_FRAME::GetMeasureFormat( int aRow ) const
} }
void SIM_PLOT_FRAME::SetMeasureFormat( int aRow, const SPICE_VALUE_FORMAT& aFormat ) void SIMULATOR_FRAME::SetMeasureFormat( int aRow, const SPICE_VALUE_FORMAT& aFormat )
{ {
m_measurementsGrid->SetCellValue( aRow, COL_MEASUREMENT_FORMAT, aFormat.ToString() ); m_measurementsGrid->SetCellValue( aRow, COL_MEASUREMENT_FORMAT, aFormat.ToString() );
OnModify(); OnModify();
} }
void SIM_PLOT_FRAME::DeleteMeasurement( int aRow ) void SIMULATOR_FRAME::DeleteMeasurement( int aRow )
{ {
if( aRow < ( m_measurementsGrid->GetNumberRows() - 1 ) ) if( aRow < ( m_measurementsGrid->GetNumberRows() - 1 ) )
{ {
@ -1284,7 +1284,7 @@ void SIM_PLOT_FRAME::DeleteMeasurement( int aRow )
} }
void SIM_PLOT_FRAME::onMeasurementsGridCellChanged( wxGridEvent& aEvent ) void SIMULATOR_FRAME::onMeasurementsGridCellChanged( wxGridEvent& aEvent )
{ {
SIM_PLOT_PANEL* plotPanel = GetCurrentPlot(); SIM_PLOT_PANEL* plotPanel = GetCurrentPlot();
@ -1344,7 +1344,7 @@ void SIM_PLOT_FRAME::onMeasurementsGridCellChanged( wxGridEvent& aEvent )
* we want to show: * we want to show:
* 15W * 15W
*/ */
void SIM_PLOT_FRAME::UpdateMeasurement( int aRow ) void SIMULATOR_FRAME::UpdateMeasurement( int aRow )
{ {
static wxRegEx measureParamsRegEx( wxT( "^" static wxRegEx measureParamsRegEx( wxT( "^"
" *" " *"
@ -1437,19 +1437,19 @@ void SIM_PLOT_FRAME::UpdateMeasurement( int aRow )
} }
void SIM_PLOT_FRAME::AddVoltagePlot( const wxString& aNetName ) void SIMULATOR_FRAME::AddVoltageTrace( const wxString& aNetName )
{ {
doAddPlot( aNetName, SPT_VOLTAGE ); doAddTrace( aNetName, SPT_VOLTAGE );
} }
void SIM_PLOT_FRAME::AddCurrentPlot( const wxString& aDeviceName ) void SIMULATOR_FRAME::AddCurrentTrace( const wxString& aDeviceName )
{ {
doAddPlot( aDeviceName, SPT_CURRENT ); doAddTrace( aDeviceName, SPT_CURRENT );
} }
void SIM_PLOT_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_PANEL_BASE* plotPanel = getCurrentPlotWindow();
@ -1486,7 +1486,7 @@ void SIM_PLOT_FRAME::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSy
} }
void SIM_PLOT_FRAME::UpdateTunerValue( const SCH_SHEET_PATH& aSheetPath, const KIID& aSymbol, void SIMULATOR_FRAME::UpdateTunerValue( const SCH_SHEET_PATH& aSheetPath, const KIID& aSymbol,
const wxString& aRef, const wxString& aValue ) const wxString& aRef, const wxString& aValue )
{ {
SCH_ITEM* item = aSheetPath.GetItem( aSymbol ); SCH_ITEM* item = aSheetPath.GetItem( aSymbol );
@ -1519,21 +1519,19 @@ void SIM_PLOT_FRAME::UpdateTunerValue( const SCH_SHEET_PATH& aSheetPath, const K
} }
void SIM_PLOT_FRAME::RemoveTuner( TUNER_SLIDER* aTuner, bool aErase ) void SIMULATOR_FRAME::RemoveTuner( TUNER_SLIDER* aTuner )
{ {
if( aErase ) m_tuners.remove( aTuner );
m_tuners.remove( aTuner );
aTuner->Destroy(); aTuner->Destroy();
m_panelTuners->Layout(); m_panelTuners->Layout();
OnModify(); OnModify();
} }
void SIM_PLOT_FRAME::AddMeasurement( const wxString& aCmd ) void SIMULATOR_FRAME::AddMeasurement( const wxString& aCmd )
{ {
// -1 because the last one is for user inpu // -1 because the last one is for user input
for ( int i = 0; i < m_measurementsGrid->GetNumberRows(); i++ ) for( int i = 0; i < m_measurementsGrid->GetNumberRows(); i++ )
{ {
if ( m_measurementsGrid->GetCellValue( i, COL_MEASUREMENT ) == aCmd ) if ( m_measurementsGrid->GetCellValue( i, COL_MEASUREMENT ) == aCmd )
return; // Don't create duplicates return; // Don't create duplicates
@ -1573,7 +1571,7 @@ void SIM_PLOT_FRAME::AddMeasurement( const wxString& aCmd )
} }
SIM_PLOT_PANEL* SIM_PLOT_FRAME::GetCurrentPlot() const SIM_PLOT_PANEL* SIMULATOR_FRAME::GetCurrentPlot() const
{ {
SIM_PANEL_BASE* curPage = getCurrentPlotWindow(); SIM_PANEL_BASE* curPage = getCurrentPlotWindow();
@ -1582,13 +1580,13 @@ SIM_PLOT_PANEL* SIM_PLOT_FRAME::GetCurrentPlot() const
} }
const NGSPICE_CIRCUIT_MODEL* SIM_PLOT_FRAME::GetExporter() const const NGSPICE_CIRCUIT_MODEL* SIMULATOR_FRAME::GetExporter() const
{ {
return m_circuitModel.get(); return m_circuitModel.get();
} }
void SIM_PLOT_FRAME::doAddPlot( const wxString& aName, SIM_TRACE_TYPE aType ) void SIMULATOR_FRAME::doAddTrace( const wxString& aName, SIM_TRACE_TYPE aType )
{ {
SIM_PLOT_PANEL* plotPanel = GetCurrentPlot(); SIM_PLOT_PANEL* plotPanel = GetCurrentPlot();
@ -1629,7 +1627,7 @@ void SIM_PLOT_FRAME::doAddPlot( const wxString& aName, SIM_TRACE_TYPE aType )
} }
void SIM_PLOT_FRAME::SetUserDefinedSignals( const std::map<int, wxString>& aNewSignals ) void SIMULATOR_FRAME::SetUserDefinedSignals( const std::map<int, wxString>& aNewSignals )
{ {
for( size_t ii = 0; ii < m_plotNotebook->GetPageCount(); ++ii ) for( size_t ii = 0; ii < m_plotNotebook->GetPageCount(); ++ii )
{ {
@ -1687,7 +1685,7 @@ void SIM_PLOT_FRAME::SetUserDefinedSignals( const std::map<int, wxString>& aNewS
} }
void SIM_PLOT_FRAME::updateTrace( const wxString& aVectorName, int aTraceType, void SIMULATOR_FRAME::updateTrace( const wxString& aVectorName, int aTraceType,
SIM_PLOT_PANEL* aPlotPanel ) SIM_PLOT_PANEL* aPlotPanel )
{ {
SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aPlotPanel->GetSimCommand() ); SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aPlotPanel->GetSimCommand() );
@ -1790,7 +1788,7 @@ void SIM_PLOT_FRAME::updateTrace( const wxString& aVectorName, int aTraceType,
} }
void SIM_PLOT_FRAME::updateSignalsGrid() void SIMULATOR_FRAME::updateSignalsGrid()
{ {
SIM_PLOT_PANEL* plot = GetCurrentPlot(); SIM_PLOT_PANEL* plot = GetCurrentPlot();
@ -1858,7 +1856,7 @@ void SIM_PLOT_FRAME::updateSignalsGrid()
} }
void SIM_PLOT_FRAME::applyUserDefinedSignals() void SIMULATOR_FRAME::applyUserDefinedSignals()
{ {
auto quoteNetNames = auto quoteNetNames =
[&]( wxString aExpression ) -> wxString [&]( wxString aExpression ) -> wxString
@ -1879,7 +1877,7 @@ void SIM_PLOT_FRAME::applyUserDefinedSignals()
} }
void SIM_PLOT_FRAME::applyTuners() void SIMULATOR_FRAME::applyTuners()
{ {
wxString errors; wxString errors;
WX_STRING_REPORTER reporter( &errors ); WX_STRING_REPORTER reporter( &errors );
@ -1916,7 +1914,7 @@ void SIM_PLOT_FRAME::applyTuners()
} }
void SIM_PLOT_FRAME::parseTraceParams( SIM_PLOT_PANEL* aPlotPanel, TRACE* aTrace, void SIMULATOR_FRAME::parseTraceParams( SIM_PLOT_PANEL* aPlotPanel, TRACE* aTrace,
const wxString& aSignalName, const wxString& aParams ) const wxString& aSignalName, const wxString& aParams )
{ {
auto addCursor = auto addCursor =
@ -1995,7 +1993,7 @@ void SIM_PLOT_FRAME::parseTraceParams( SIM_PLOT_PANEL* aPlotPanel, TRACE* aTrace
} }
bool SIM_PLOT_FRAME::LoadWorkbook( const wxString& aPath ) bool SIMULATOR_FRAME::LoadWorkbook( const wxString& aPath )
{ {
m_plotNotebook->DeleteAllPages(); m_plotNotebook->DeleteAllPages();
@ -2191,7 +2189,7 @@ bool SIM_PLOT_FRAME::LoadWorkbook( const wxString& aPath )
} }
bool SIM_PLOT_FRAME::SaveWorkbook( const wxString& aPath ) bool SIMULATOR_FRAME::SaveWorkbook( const wxString& aPath )
{ {
wxFileName filename = aPath; wxFileName filename = aPath;
filename.SetExt( WorkbookFileExtension ); filename.SetExt( WorkbookFileExtension );
@ -2350,7 +2348,7 @@ bool SIM_PLOT_FRAME::SaveWorkbook( const wxString& aPath )
} }
SIM_TRACE_TYPE SIM_PLOT_FRAME::getXAxisType( SIM_TYPE aType ) const SIM_TRACE_TYPE SIMULATOR_FRAME::getXAxisType( SIM_TYPE aType ) const
{ {
switch( aType ) switch( aType )
{ {
@ -2363,7 +2361,7 @@ SIM_TRACE_TYPE SIM_PLOT_FRAME::getXAxisType( SIM_TYPE aType ) const
} }
void SIM_PLOT_FRAME::ToggleDarkModePlots() void SIMULATOR_FRAME::ToggleDarkModePlots()
{ {
m_darkMode = !m_darkMode; m_darkMode = !m_darkMode;
@ -2385,12 +2383,12 @@ void SIM_PLOT_FRAME::ToggleDarkModePlots()
} }
void SIM_PLOT_FRAME::onPlotClose( wxAuiNotebookEvent& event ) void SIMULATOR_FRAME::onPlotClose( wxAuiNotebookEvent& event )
{ {
} }
void SIM_PLOT_FRAME::onPlotClosed( wxAuiNotebookEvent& event ) void SIMULATOR_FRAME::onPlotClosed( wxAuiNotebookEvent& event )
{ {
CallAfter( [this]() CallAfter( [this]()
{ {
@ -2410,7 +2408,7 @@ void SIM_PLOT_FRAME::onPlotClosed( wxAuiNotebookEvent& event )
} }
void SIM_PLOT_FRAME::onPlotChanged( wxAuiNotebookEvent& event ) void SIMULATOR_FRAME::onPlotChanged( wxAuiNotebookEvent& event )
{ {
rebuildSignalsList(); rebuildSignalsList();
rebuildSignalsGrid( m_filter->GetValue() ); rebuildSignalsGrid( m_filter->GetValue() );
@ -2418,19 +2416,19 @@ void SIM_PLOT_FRAME::onPlotChanged( wxAuiNotebookEvent& event )
} }
void SIM_PLOT_FRAME::onPlotDragged( wxAuiNotebookEvent& event ) void SIMULATOR_FRAME::onPlotDragged( wxAuiNotebookEvent& event )
{ {
} }
void SIM_PLOT_FRAME::onNotebookModified( wxCommandEvent& event ) void SIMULATOR_FRAME::onNotebookModified( wxCommandEvent& event )
{ {
OnModify(); OnModify();
updateTitle(); updateTitle();
} }
bool SIM_PLOT_FRAME::EditSimCommand() bool SIMULATOR_FRAME::EditSimCommand()
{ {
SIM_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow(); SIM_PANEL_BASE* plotPanelWindow = getCurrentPlotWindow();
DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() ); DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() );
@ -2501,7 +2499,7 @@ bool SIM_PLOT_FRAME::EditSimCommand()
} }
bool SIM_PLOT_FRAME::canCloseWindow( wxCloseEvent& aEvent ) bool SIMULATOR_FRAME::canCloseWindow( wxCloseEvent& aEvent )
{ {
if( m_workbookModified ) if( m_workbookModified )
{ {
@ -2526,7 +2524,7 @@ bool SIM_PLOT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
} }
void SIM_PLOT_FRAME::doCloseWindow() void SIMULATOR_FRAME::doCloseWindow()
{ {
if( m_simulator->IsRunning() ) if( m_simulator->IsRunning() )
m_simulator->Stop(); m_simulator->Stop();
@ -2545,7 +2543,7 @@ void SIM_PLOT_FRAME::doCloseWindow()
} }
void SIM_PLOT_FRAME::updateCursors() void SIMULATOR_FRAME::updateCursors()
{ {
SUPPRESS_GRID_CELL_EVENTS raii( this ); SUPPRESS_GRID_CELL_EVENTS raii( this );
@ -2680,14 +2678,14 @@ void SIM_PLOT_FRAME::updateCursors()
} }
void SIM_PLOT_FRAME::onCursorUpdate( wxCommandEvent& aEvent ) void SIMULATOR_FRAME::onCursorUpdate( wxCommandEvent& aEvent )
{ {
updateCursors(); updateCursors();
OnModify(); OnModify();
} }
void SIM_PLOT_FRAME::setupUIConditions() void SIMULATOR_FRAME::setupUIConditions()
{ {
EDA_BASE_FRAME::setupUIConditions(); EDA_BASE_FRAME::setupUIConditions();
@ -2766,13 +2764,13 @@ void SIM_PLOT_FRAME::setupUIConditions()
} }
void SIM_PLOT_FRAME::onSimStarted( wxCommandEvent& aEvent ) void SIMULATOR_FRAME::onSimStarted( wxCommandEvent& aEvent )
{ {
SetCursor( wxCURSOR_ARROWWAIT ); SetCursor( wxCURSOR_ARROWWAIT );
} }
void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent ) void SIMULATOR_FRAME::onSimFinished( wxCommandEvent& aEvent )
{ {
SetCursor( wxCURSOR_ARROW ); SetCursor( wxCURSOR_ARROW );
@ -2918,7 +2916,7 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
} }
void SIM_PLOT_FRAME::onSimUpdate( wxCommandEvent& aEvent ) void SIMULATOR_FRAME::onSimUpdate( wxCommandEvent& aEvent )
{ {
static bool updateInProgress = false; static bool updateInProgress = false;
@ -2960,20 +2958,20 @@ void SIM_PLOT_FRAME::onSimUpdate( wxCommandEvent& aEvent )
} }
void SIM_PLOT_FRAME::onSimReport( wxCommandEvent& aEvent ) void SIMULATOR_FRAME::onSimReport( wxCommandEvent& aEvent )
{ {
m_simConsole->AppendText( aEvent.GetString() + "\n" ); m_simConsole->AppendText( aEvent.GetString() + "\n" );
m_simConsole->SetInsertionPointEnd(); m_simConsole->SetInsertionPointEnd();
} }
void SIM_PLOT_FRAME::onExit( wxCommandEvent& event ) void SIMULATOR_FRAME::onExit( wxCommandEvent& event )
{ {
Kiway().OnKiCadExit(); Kiway().OnKiCadExit();
} }
void SIM_PLOT_FRAME::OnModify() void SIMULATOR_FRAME::OnModify()
{ {
KIWAY_PLAYER::OnModify(); KIWAY_PLAYER::OnModify();
m_workbookModified = true; m_workbookModified = true;

View File

@ -25,11 +25,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef __SIM_PLOT_FRAME__ #ifndef SIMULATOR_FRAME_H
#define __SIM_PLOT_FRAME__ #define SIMULATOR_FRAME_H
#include <sim/sim_plot_frame_base.h> #include <sim/simulator_frame_base.h>
#include <sim/sim_types.h> #include <sim/sim_types.h>
#include <kiway_player.h> #include <kiway_player.h>
@ -50,17 +50,36 @@ 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_panel_base.h>
#include <sim/sim_notebook.h> #include "widgets/sim_notebook.h"
class SIM_THREAD_REPORTER; class SIM_THREAD_REPORTER;
class TUNER_SLIDER; class TUNER_SLIDER;
class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE /**
*
* 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
* 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,
* the GUI supports only two cursors (and a differential cursor) for each plot.
*
* TRACEs are identified by a signal (V(OUT), I(R2), etc.) and a type (SPT_VOLTAGE, SPT_AC_PHASE,
* etc.).
*
* The simulator outputs simple signals in a vector of the same name. Complex signals (such as
* V(OUT) / V(IN)) are stored in vectors of the format "user%d".
*
*/
class SIMULATOR_FRAME : public SIMULATOR_FRAME_BASE
{ {
public: public:
SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ); SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent );
~SIM_PLOT_FRAME(); ~SIMULATOR_FRAME();
/** /**
* Check and load the current netlist into the simulator. * Check and load the current netlist into the simulator.
@ -71,7 +90,7 @@ public:
void StartSimulation(); void StartSimulation();
/** /**
* Create a new plot panel for a given simulation type and adds it to the main notebook. * Create a new plot tab for a given simulation type.
* *
* @param aSimCommand is requested simulation command. * @param aSimCommand is requested simulation command.
* @param aSimOptions netlisting options * @param aSimOptions netlisting options
@ -91,19 +110,19 @@ public:
void SetUserDefinedSignals( const std::map<int, wxString>& aSignals ); void SetUserDefinedSignals( const std::map<int, wxString>& aSignals );
/** /**
* Add a voltage plot for a given net name. * Add a voltage trace for a given net to the current plot.
* *
* @param aNetName is the net name for which a voltage plot should be created. * @param aNetName is the net name for which a voltage plot should be created.
*/ */
void AddVoltagePlot( const wxString& aNetName ); void AddVoltageTrace( const wxString& aNetName );
/** /**
* Add a current plot for a particular device. * Add a current trace for a given device to the current plot.
* *
* @param aDeviceName is the device name (e.g. R1, C1). * @param aDeviceName is the device name (e.g. R1, C1).
* @param aParam is the current type (e.g. I, Ic, Id). * @param aParam is the current type (e.g. I, Ic, Id).
*/ */
void AddCurrentPlot( const wxString& aDeviceName ); void AddCurrentTrace( const wxString& aDeviceName );
/** /**
* Get/Set the number of significant digits and the range for formatting a cursor value. * Get/Set the number of significant digits and the range for formatting a cursor value.
@ -129,12 +148,8 @@ public:
/** /**
* Remove an existing tuner. * Remove an existing tuner.
*
* @param aTuner is the tuner to be removed.
* @param aErase decides whether the tuner should be also removed from the tuners list.
* Otherwise it is removed only from the SIM_PLOT_FRAME pane.
*/ */
void RemoveTuner( TUNER_SLIDER* aTuner, bool aErase = true ); void RemoveTuner( TUNER_SLIDER* aTuner );
/** /**
* Safely update a field of the associated symbol without dereferencing * Safely update a field of the associated symbol without dereferencing
@ -169,7 +184,7 @@ public:
void UpdateMeasurement( int aRow ); void UpdateMeasurement( int aRow );
/** /**
* Return the currently opened plot panel (or NULL if there is none). * Return the current tab (or NULL if there is none).
*/ */
SIM_PLOT_PANEL* GetCurrentPlot() const; SIM_PLOT_PANEL* GetCurrentPlot() const;
@ -179,7 +194,7 @@ public:
const NGSPICE_CIRCUIT_MODEL* GetExporter() const; const NGSPICE_CIRCUIT_MODEL* GetExporter() const;
/** /**
* Toggle dark-mode of the plot. * Toggle dark-mode of the plot tabs.
*/ */
void ToggleDarkModePlots(); void ToggleDarkModePlots();
@ -188,18 +203,12 @@ public:
void ReCreateHToolbar(); void ReCreateHToolbar();
/** /**
* Load plot settings from a file. * Load plot, signal, cursor, measurement, etc. settings from a file.
*
* @param aPath is the file name.
* @return True if successful.
*/ */
bool LoadWorkbook( const wxString& aPath ); bool LoadWorkbook( const wxString& aPath );
/** /**
* Save plot settings to a file. * Save plot, signal, cursor, measurement, etc. settings to a file.
*
* @param aPath is the file name.
* @return True if successful.
*/ */
bool SaveWorkbook( const wxString& aPath ); bool SaveWorkbook( const wxString& aPath );
@ -231,7 +240,7 @@ public:
return m_circuitModel->GetSimOptions(); return m_circuitModel->GetSimOptions();
} }
// Simulator doesn't host a tool framework // Simulator doesn't host a canvas
wxWindow* GetToolCanvas() const override { return nullptr; } wxWindow* GetToolCanvas() const override { return nullptr; }
void OnModify() override; void OnModify() override;
@ -254,13 +263,12 @@ private:
void updateTitle(); void updateTitle();
/** /**
* Add a new plot to the current panel. * Add a new trace to the current plot.
* *
* @param aName is the device/net name. * @param aName is the device/net name.
* @param aType describes the type of plot. * @param aType describes the type of trace.
* @param aParam is the parameter for the device/net (e.g. I, Id, V).
*/ */
void doAddPlot( const wxString& aName, SIM_TRACE_TYPE aType ); void doAddTrace( const wxString& aName, SIM_TRACE_TYPE aType );
/** /**
* Get the simulator output vector name for a given signal name and type. * Get the simulator output vector name for a given signal name and type.
@ -400,4 +408,4 @@ wxDECLARE_EVENT( EVT_SIM_REPORT, wxCommandEvent );
wxDECLARE_EVENT( EVT_SIM_STARTED, wxCommandEvent ); wxDECLARE_EVENT( EVT_SIM_STARTED, wxCommandEvent );
wxDECLARE_EVENT( EVT_SIM_FINISHED, wxCommandEvent ); wxDECLARE_EVENT( EVT_SIM_FINISHED, wxCommandEvent );
#endif // __sim_plot_frame__ #endif // SIMULATOR_FRAME_H

View File

@ -8,11 +8,11 @@
#include "tool/action_toolbar.h" #include "tool/action_toolbar.h"
#include "widgets/wx_grid.h" #include "widgets/wx_grid.h"
#include "sim_plot_frame_base.h" #include "simulator_frame_base.h"
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : KIWAY_PLAYER( parent, id, title, pos, size, style, name ) SIMULATOR_FRAME_BASE::SIMULATOR_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : KIWAY_PLAYER( parent, id, title, pos, size, style, name )
{ {
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
@ -25,7 +25,7 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_splitterLeftRight = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE ); m_splitterLeftRight = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE );
m_splitterLeftRight->SetSashGravity( 0.7 ); m_splitterLeftRight->SetSashGravity( 0.7 );
m_splitterLeftRight->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterLeftRightOnIdle ), NULL, this ); m_splitterLeftRight->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterLeftRightOnIdle ), NULL, this );
m_splitterLeftRight->SetMinimumPaneSize( 50 ); m_splitterLeftRight->SetMinimumPaneSize( 50 );
m_panelLeft = new wxPanel( m_splitterLeftRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelLeft = new wxPanel( m_splitterLeftRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -35,7 +35,7 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_splitterPlotAndConsole = new wxSplitterWindow( m_panelLeft, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE ); m_splitterPlotAndConsole = new wxSplitterWindow( m_panelLeft, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE );
m_splitterPlotAndConsole->SetSashGravity( 0.8 ); m_splitterPlotAndConsole->SetSashGravity( 0.8 );
m_splitterPlotAndConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this ); m_splitterPlotAndConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
m_splitterPlotAndConsole->SetMinimumPaneSize( 50 ); m_splitterPlotAndConsole->SetMinimumPaneSize( 50 );
m_plotPanel = new wxPanel( m_splitterPlotAndConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_plotPanel = new wxPanel( m_splitterPlotAndConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -44,7 +44,7 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_sizerPlot = new wxBoxSizer( wxHORIZONTAL ); m_sizerPlot = new wxBoxSizer( wxHORIZONTAL );
m_plotNotebook = new SIM_NOTEBOOK( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_MIDDLE_CLICK_CLOSE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TOP ); m_plotNotebook = new SIM_NOTEBOOK( m_plotPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_MIDDLE_CLICK_CLOSE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TOP );
m_plotNotebook->SetMinSize( wxSize( 200,-1 ) ); m_plotNotebook->SetMinSize( wxSize( 200,200 ) );
m_sizerPlot->Add( m_plotNotebook, 1, wxEXPAND, 5 ); m_sizerPlot->Add( m_plotNotebook, 1, wxEXPAND, 5 );
@ -82,7 +82,7 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_splitterSignals = new wxSplitterWindow( m_sidePanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE ); m_splitterSignals = new wxSplitterWindow( m_sidePanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE );
m_splitterSignals->SetSashGravity( 0.5 ); m_splitterSignals->SetSashGravity( 0.5 );
m_splitterSignals->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterSignalsOnIdle ), NULL, this ); m_splitterSignals->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterSignalsOnIdle ), NULL, this );
m_splitterSignals->SetMinimumPaneSize( 20 ); m_splitterSignals->SetMinimumPaneSize( 20 );
m_panelSignals = new wxPanel( m_splitterSignals, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelSignals = new wxPanel( m_splitterSignals, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -146,7 +146,7 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_splitterCursors = new wxSplitterWindow( m_panelCMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE ); m_splitterCursors = new wxSplitterWindow( m_panelCMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE );
m_splitterCursors->SetSashGravity( 0.2 ); m_splitterCursors->SetSashGravity( 0.2 );
m_splitterCursors->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterCursorsOnIdle ), NULL, this ); m_splitterCursors->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterCursorsOnIdle ), NULL, this );
m_splitterCursors->SetMinimumPaneSize( 20 ); m_splitterCursors->SetMinimumPaneSize( 20 );
m_panelCursors = new wxPanel( m_splitterCursors, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelCursors = new wxPanel( m_splitterCursors, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -201,7 +201,7 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_splitterMeasurements = new wxSplitterWindow( m_panelMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE ); m_splitterMeasurements = new wxSplitterWindow( m_panelMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE );
m_splitterMeasurements->SetSashGravity( 0.2 ); m_splitterMeasurements->SetSashGravity( 0.2 );
m_splitterMeasurements->Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterMeasurementsOnIdle ), NULL, this ); m_splitterMeasurements->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterMeasurementsOnIdle ), NULL, this );
m_splitterMeasurements->SetMinimumPaneSize( 20 ); m_splitterMeasurements->SetMinimumPaneSize( 20 );
m_panelMeasurements = new wxPanel( m_splitterMeasurements, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelMeasurements = new wxPanel( m_splitterMeasurements, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -282,32 +282,33 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
this->SetSizer( m_sizerMain ); this->SetSizer( m_sizerMain );
this->Layout(); this->Layout();
m_sizerMain->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotDragged ), NULL, this ); m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotDragged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotChanged ), NULL, this ); m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotClose ), NULL, this ); m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotClose ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotClosed ), NULL, this ); m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotClosed ), NULL, this );
m_filter->Connect( wxEVT_MOTION, wxMouseEventHandler( SIM_PLOT_FRAME_BASE::OnFilterMouseMoved ), NULL, this ); m_filter->Connect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_FRAME_BASE::OnFilterMouseMoved ), NULL, this );
m_filter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::OnFilterText ), NULL, this ); m_filter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_FRAME_BASE::OnFilterText ), NULL, this );
m_signalsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIM_PLOT_FRAME_BASE::onSignalsGridCellChanged ), NULL, this ); m_signalsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onSignalsGridCellChanged ), NULL, this );
m_cursorsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIM_PLOT_FRAME_BASE::onCursorsGridCellChanged ), NULL, this ); m_cursorsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onCursorsGridCellChanged ), NULL, this );
m_measurementsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIM_PLOT_FRAME_BASE::onMeasurementsGridCellChanged ), NULL, this ); m_measurementsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onMeasurementsGridCellChanged ), NULL, this );
} }
SIM_PLOT_FRAME_BASE::~SIM_PLOT_FRAME_BASE() SIMULATOR_FRAME_BASE::~SIMULATOR_FRAME_BASE()
{ {
// Disconnect Events // Disconnect Events
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotDragged ), NULL, this ); m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotDragged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotChanged ), NULL, this ); m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotClose ), NULL, this ); m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotClose ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIM_PLOT_FRAME_BASE::onPlotClosed ), NULL, this ); m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_BASE::onPlotClosed ), NULL, this );
m_filter->Disconnect( wxEVT_MOTION, wxMouseEventHandler( SIM_PLOT_FRAME_BASE::OnFilterMouseMoved ), NULL, this ); m_filter->Disconnect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_FRAME_BASE::OnFilterMouseMoved ), NULL, this );
m_filter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::OnFilterText ), NULL, this ); m_filter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_FRAME_BASE::OnFilterText ), NULL, this );
m_signalsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIM_PLOT_FRAME_BASE::onSignalsGridCellChanged ), NULL, this ); m_signalsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onSignalsGridCellChanged ), NULL, this );
m_cursorsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIM_PLOT_FRAME_BASE::onCursorsGridCellChanged ), NULL, this ); m_cursorsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onCursorsGridCellChanged ), NULL, this );
m_measurementsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIM_PLOT_FRAME_BASE::onMeasurementsGridCellChanged ), NULL, this ); m_measurementsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_BASE::onMeasurementsGridCellChanged ), NULL, this );
} }

View File

@ -11,13 +11,13 @@
<property name="embedded_files_path">.</property> <property name="embedded_files_path">.</property>
<property name="encoding">UTF-8</property> <property name="encoding">UTF-8</property>
<property name="event_generation">connect</property> <property name="event_generation">connect</property>
<property name="file">sim_plot_frame_base</property> <property name="file">simulator_frame_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property> <property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">SpiceWindow</property> <property name="name">SIMULATOR_FRAME_BASE</property>
<property name="namespace"></property> <property name="namespace"></property>
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
@ -45,9 +45,9 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">SIM_PLOT_FRAME_BASE</property> <property name="name">SIMULATOR_FRAME_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">564,531</property> <property name="size">-1,-1</property>
<property name="style">wxDEFAULT_FRAME_STYLE</property> <property name="style">wxDEFAULT_FRAME_STYLE</property>
<property name="subclass">KIWAY_PLAYER; kiway_player.h</property> <property name="subclass">KIWAY_PLAYER; kiway_player.h</property>
<property name="title">Spice Simulator</property> <property name="title">Spice Simulator</property>
@ -400,7 +400,7 @@
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property> <property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">200,-1</property> <property name="minimum_size">200,200</property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_plotNotebook</property> <property name="name">m_plotNotebook</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>

View File

@ -35,9 +35,9 @@ class WX_GRID;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class SIM_PLOT_FRAME_BASE /// Class SIMULATOR_FRAME_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER class SIMULATOR_FRAME_BASE : public KIWAY_PLAYER
{ {
private: private:
@ -85,38 +85,38 @@ class SIM_PLOT_FRAME_BASE : public KIWAY_PLAYER
public: public:
SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Spice Simulator"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 564,531 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString& name = wxT("SIM_PLOT_FRAME") ); SIMULATOR_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Spice Simulator"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString& name = wxT("SIM_PLOT_FRAME") );
~SIM_PLOT_FRAME_BASE(); ~SIMULATOR_FRAME_BASE();
void m_splitterLeftRightOnIdle( wxIdleEvent& ) void m_splitterLeftRightOnIdle( wxIdleEvent& )
{ {
m_splitterLeftRight->SetSashPosition( 700 ); m_splitterLeftRight->SetSashPosition( 700 );
m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterLeftRightOnIdle ), NULL, this ); m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterLeftRightOnIdle ), NULL, this );
} }
void m_splitterPlotAndConsoleOnIdle( wxIdleEvent& ) void m_splitterPlotAndConsoleOnIdle( wxIdleEvent& )
{ {
m_splitterPlotAndConsole->SetSashPosition( 500 ); m_splitterPlotAndConsole->SetSashPosition( 500 );
m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this ); m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
} }
void m_splitterSignalsOnIdle( wxIdleEvent& ) void m_splitterSignalsOnIdle( wxIdleEvent& )
{ {
m_splitterSignals->SetSashPosition( 0 ); m_splitterSignals->SetSashPosition( 0 );
m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterSignalsOnIdle ), NULL, this ); m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterSignalsOnIdle ), NULL, this );
} }
void m_splitterCursorsOnIdle( wxIdleEvent& ) void m_splitterCursorsOnIdle( wxIdleEvent& )
{ {
m_splitterCursors->SetSashPosition( 0 ); m_splitterCursors->SetSashPosition( 0 );
m_splitterCursors->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterCursorsOnIdle ), NULL, this ); m_splitterCursors->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterCursorsOnIdle ), NULL, this );
} }
void m_splitterMeasurementsOnIdle( wxIdleEvent& ) void m_splitterMeasurementsOnIdle( wxIdleEvent& )
{ {
m_splitterMeasurements->SetSashPosition( 0 ); m_splitterMeasurements->SetSashPosition( 0 );
m_splitterMeasurements->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME_BASE::m_splitterMeasurementsOnIdle ), NULL, this ); m_splitterMeasurements->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_BASE::m_splitterMeasurementsOnIdle ), NULL, this );
} }
}; };

View File

@ -18,7 +18,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <sim/sim_plot_frame.h> #include <sim/simulator_frame.h>
#include <tool/action_menu.h> #include <tool/action_menu.h>
#include <tool/action_toolbar.h> #include <tool/action_toolbar.h>
#include <tool/common_control.h> #include <tool/common_control.h>
@ -28,7 +28,7 @@
#include "menus_helpers.h" #include "menus_helpers.h"
void SIM_PLOT_FRAME::ReCreateHToolbar() void SIMULATOR_FRAME::ReCreateHToolbar()
{ {
if( m_toolBar ) if( m_toolBar )
{ {
@ -72,7 +72,7 @@ void SIM_PLOT_FRAME::ReCreateHToolbar()
} }
void SIM_PLOT_FRAME::doReCreateMenuBar() void SIMULATOR_FRAME::doReCreateMenuBar()
{ {
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>(); COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
EDA_BASE_FRAME* base_frame = dynamic_cast<EDA_BASE_FRAME*>( this ); EDA_BASE_FRAME* base_frame = dynamic_cast<EDA_BASE_FRAME*>( this );

View File

@ -32,7 +32,7 @@
#include <tools/ee_inspection_tool.h> #include <tools/ee_inspection_tool.h>
#include <tools/ee_selection_tool.h> #include <tools/ee_selection_tool.h>
#include <tools/ee_selection.h> #include <tools/ee_selection.h>
#include <sim/sim_plot_frame.h> #include <sim/simulator_frame.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <symbol_edit_frame.h> #include <symbol_edit_frame.h>
#include <symbol_viewer_frame.h> #include <symbol_viewer_frame.h>
@ -238,7 +238,7 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
int EE_INSPECTION_TOOL::RunSimulation( const TOOL_EVENT& aEvent ) int EE_INSPECTION_TOOL::RunSimulation( const TOOL_EVENT& aEvent )
{ {
#ifdef KICAD_SPICE #ifdef KICAD_SPICE
SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, true ); SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, true );
if( !simFrame ) if( !simFrame )
return -1; return -1;

View File

@ -54,7 +54,7 @@
#include <sch_view.h> #include <sch_view.h>
#include <schematic.h> #include <schematic.h>
#include <advanced_config.h> #include <advanced_config.h>
#include <sim/sim_plot_frame.h> #include <sim/simulator_frame.h>
#include <sim/spice_generator.h> #include <sim/spice_generator.h>
#include <sim/sim_lib_mgr.h> #include <sim/sim_lib_mgr.h>
#include "symbol_library_manager.h" #include "symbol_library_manager.h"
@ -510,8 +510,8 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent ) int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
{ {
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>(); PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
SIM_PLOT_FRAME* simFrame = (SIM_PLOT_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, false ); SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, false );
if( !simFrame ) // Defensive coding; shouldn't happen. if( !simFrame ) // Defensive coding; shouldn't happen.
return 0; return 0;
@ -552,25 +552,26 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
THROW_IO_ERROR( msg ); THROW_IO_ERROR( msg );
SPICE_ITEM spiceItem; SPICE_ITEM spiceItem;
spiceItem.refName = std::string( symbol->GetRef( &sheet ).ToUTF8() ); spiceItem.refName = symbol->GetRef( &sheet ).ToStdString();
std::vector<std::string> currentNames = std::vector<std::string> currentNames =
model.SpiceGenerator().CurrentNames( spiceItem ); model.SpiceGenerator().CurrentNames( spiceItem );
if( currentNames.size() == 0 ) if( currentNames.size() == 0 )
{
return true; return true;
}
else if( currentNames.size() == 1 ) else if( currentNames.size() == 1 )
{ {
simFrame->AddCurrentPlot( currentNames.at( 0 ) ); simFrame->AddCurrentTrace( currentNames.at( 0 ) );
return true; return true;
} }
int modelPinIndex = int modelPinIndex = model.FindModelPinIndex( pin->GetNumber().ToStdString() );
model.FindModelPinIndex( std::string( pin->GetNumber().ToUTF8() ) );
if( modelPinIndex != SIM_MODEL::PIN::NOT_CONNECTED ) if( modelPinIndex != SIM_MODEL::PIN::NOT_CONNECTED )
{ {
wxString name = currentNames.at( modelPinIndex ); wxString name = currentNames.at( modelPinIndex );
simFrame->AddCurrentPlot( name ); simFrame->AddCurrentTrace( name );
} }
} }
catch( const IO_ERROR& e ) catch( const IO_ERROR& e )
@ -583,10 +584,10 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
{ {
if( SCH_CONNECTION* conn = static_cast<SCH_ITEM*>( item )->Connection() ) if( SCH_CONNECTION* conn = static_cast<SCH_ITEM*>( item )->Connection() )
{ {
std::string spiceNet = std::string( UnescapeString( conn->Name() ).ToUTF8() ); std::string spiceNet = UnescapeString( conn->Name() ).ToStdString();
NETLIST_EXPORTER_SPICE::ConvertToSpiceMarkup( spiceNet ); NETLIST_EXPORTER_SPICE::ConvertToSpiceMarkup( spiceNet );
simFrame->AddVoltagePlot( wxString::Format( "V(%s)", spiceNet ) ); simFrame->AddVoltageTrace( wxString::Format( "V(%s)", spiceNet ) );
} }
} }
@ -702,7 +703,7 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
if( wxWindow* blocking_win = simFrame->Kiway().GetBlockingDialog() ) if( wxWindow* blocking_win = simFrame->Kiway().GetBlockingDialog() )
blocking_win->Close( true ); blocking_win->Close( true );
static_cast<SIM_PLOT_FRAME*>( simFrame )->AddTuner( sheetPath, symbol ); static_cast<SIMULATOR_FRAME*>( simFrame )->AddTuner( sheetPath, symbol );
} }
// We do not really want to keep a symbol selected in schematic, // We do not really want to keep a symbol selected in schematic,

View File

@ -31,7 +31,7 @@
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <sim/sim_plot_frame.h> #include <sim/simulator_frame.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/ee_actions.h> #include <tools/ee_actions.h>
#include <tools/simulator_control.h> #include <tools/simulator_control.h>
@ -48,13 +48,13 @@ bool SIMULATOR_CONTROL::Init()
void SIMULATOR_CONTROL::Reset( RESET_REASON aReason ) void SIMULATOR_CONTROL::Reset( RESET_REASON aReason )
{ {
m_plotFrame = getEditFrame<SIM_PLOT_FRAME>(); m_simulatorFrame = getEditFrame<SIMULATOR_FRAME>();
if( m_plotFrame ) if( m_simulatorFrame )
{ {
m_schematicFrame = m_plotFrame->GetSchematicFrame(); m_schematicFrame = m_simulatorFrame->GetSchematicFrame();
m_circuitModel = m_plotFrame->GetCircuitModel(); m_circuitModel = m_simulatorFrame->GetCircuitModel();
m_simulator = m_plotFrame->GetSimulator(); m_simulator = m_simulatorFrame->GetSimulator();
} }
} }
@ -64,7 +64,10 @@ 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_PANEL_BASE::IsPlottable( type ) )
m_plotFrame->NewPlotPanel( m_circuitModel->GetSimCommand(), m_circuitModel->GetSimOptions() ); {
m_simulatorFrame->NewPlotPanel( m_circuitModel->GetSimCommand(),
m_circuitModel->GetSimOptions() );
}
return 0; return 0;
} }
@ -72,13 +75,13 @@ int SIMULATOR_CONTROL::NewPlot( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::OpenWorkbook( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::OpenWorkbook( const TOOL_EVENT& aEvent )
{ {
wxFileDialog openDlg( m_plotFrame, _( "Open simulation workbook" ), getDefaultPath(), "", wxFileDialog openDlg( m_simulatorFrame, _( "Open simulation workbook" ), getDefaultPath(), "",
WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( openDlg.ShowModal() == wxID_CANCEL ) if( openDlg.ShowModal() == wxID_CANCEL )
return -1; return -1;
m_plotFrame->LoadWorkbook( openDlg.GetPath() ); m_simulatorFrame->LoadWorkbook( openDlg.GetPath() );
return 0; return 0;
} }
@ -89,14 +92,14 @@ wxString SIMULATOR_CONTROL::getDefaultFilename()
if( filename.GetName().IsEmpty() ) if( filename.GetName().IsEmpty() )
{ {
if( m_plotFrame->Prj().GetProjectName().IsEmpty() ) if( m_simulatorFrame->Prj().GetProjectName().IsEmpty() )
{ {
filename.SetName( _( "noname" ) ); filename.SetName( _( "noname" ) );
filename.SetExt( WorkbookFileExtension ); filename.SetExt( WorkbookFileExtension );
} }
else else
{ {
filename.SetName( m_plotFrame->Prj().GetProjectName() ); filename.SetName( m_simulatorFrame->Prj().GetProjectName() );
filename.SetExt( WorkbookFileExtension ); filename.SetExt( WorkbookFileExtension );
} }
} }
@ -109,7 +112,8 @@ wxString SIMULATOR_CONTROL::getDefaultPath()
{ {
wxFileName path = m_simulator->Settings()->GetWorkbookFilename(); wxFileName path = m_simulator->Settings()->GetWorkbookFilename();
path.Normalize( FN_NORMALIZE_FLAGS|wxPATH_NORM_ENV_VARS, m_plotFrame->Prj().GetProjectPath() ); path.Normalize( FN_NORMALIZE_FLAGS|wxPATH_NORM_ENV_VARS,
m_simulatorFrame->Prj().GetProjectPath() );
return path.GetPath(); return path.GetPath();
} }
@ -123,8 +127,8 @@ int SIMULATOR_CONTROL::SaveWorkbook( const TOOL_EVENT& aEvent )
if( filename.IsEmpty() ) if( filename.IsEmpty() )
{ {
wxFileDialog saveAsDlg( m_plotFrame, _( "Save Simulation Workbook As" ), getDefaultPath(), wxFileDialog saveAsDlg( m_simulatorFrame, _( "Save Simulation Workbook As" ),
getDefaultFilename(), WorkbookFileWildcard(), getDefaultPath(), getDefaultFilename(), WorkbookFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( saveAsDlg.ShowModal() == wxID_CANCEL ) if( saveAsDlg.ShowModal() == wxID_CANCEL )
@ -133,24 +137,24 @@ int SIMULATOR_CONTROL::SaveWorkbook( const TOOL_EVENT& aEvent )
filename = saveAsDlg.GetPath(); filename = saveAsDlg.GetPath();
} }
m_plotFrame->SaveWorkbook( m_plotFrame->Prj().AbsolutePath( filename ) ); m_simulatorFrame->SaveWorkbook( m_simulatorFrame->Prj().AbsolutePath( filename ) );
return 0; return 0;
} }
int SIMULATOR_CONTROL::ExportPlotAsPNG( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::ExportPlotAsPNG( const TOOL_EVENT& aEvent )
{ {
if( !m_plotFrame->GetCurrentPlot() ) if( !m_simulatorFrame->GetCurrentPlot() )
return -1; return -1;
wxFileDialog saveDlg( m_plotFrame, _( "Save Plot as Image" ), "", "", PngFileWildcard(), wxFileDialog saveDlg( m_simulatorFrame, _( "Save Plot as Image" ), "", "", PngFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( saveDlg.ShowModal() == wxID_CANCEL ) if( saveDlg.ShowModal() == wxID_CANCEL )
return -1; return -1;
m_plotFrame->GetCurrentPlot()->GetPlotWin()->SaveScreenshot( saveDlg.GetPath(), m_simulatorFrame->GetCurrentPlot()->GetPlotWin()->SaveScreenshot( saveDlg.GetPath(),
wxBITMAP_TYPE_PNG ); wxBITMAP_TYPE_PNG );
return 0; return 0;
} }
@ -158,12 +162,12 @@ int SIMULATOR_CONTROL::ExportPlotAsPNG( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::ExportPlotAsCSV( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::ExportPlotAsCSV( const TOOL_EVENT& aEvent )
{ {
if( !m_plotFrame->GetCurrentPlot() ) if( !m_simulatorFrame->GetCurrentPlot() )
return -1; return -1;
const wxChar SEPARATOR = ';'; const wxChar SEPARATOR = ';';
wxFileDialog saveDlg( m_plotFrame, _( "Save Plot Data" ), "", "", CsvFileWildcard(), wxFileDialog saveDlg( m_simulatorFrame, _( "Save Plot Data" ), "", "", CsvFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( saveDlg.ShowModal() == wxID_CANCEL ) if( saveDlg.ShowModal() == wxID_CANCEL )
@ -171,7 +175,7 @@ int SIMULATOR_CONTROL::ExportPlotAsCSV( const TOOL_EVENT& aEvent )
wxFFile out( saveDlg.GetPath(), "wb" ); wxFFile out( saveDlg.GetPath(), "wb" );
std::map<wxString, TRACE*> traces = m_plotFrame->GetCurrentPlot()->GetTraces(); std::map<wxString, TRACE*> traces = m_simulatorFrame->GetCurrentPlot()->GetTraces();
if( traces.size() == 0 ) if( traces.size() == 0 )
return -1; return -1;
@ -211,21 +215,21 @@ int SIMULATOR_CONTROL::ExportPlotAsCSV( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::Close( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::Close( const TOOL_EVENT& aEvent )
{ {
m_plotFrame->Close(); m_simulatorFrame->Close();
return 0; return 0;
} }
int SIMULATOR_CONTROL::Zoom( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::Zoom( const TOOL_EVENT& aEvent )
{ {
if( m_plotFrame->GetCurrentPlot() ) if( m_simulatorFrame->GetCurrentPlot() )
{ {
if( aEvent.IsAction( &ACTIONS::zoomInCenter ) ) if( aEvent.IsAction( &ACTIONS::zoomInCenter ) )
m_plotFrame->GetCurrentPlot()->GetPlotWin()->ZoomIn(); m_simulatorFrame->GetCurrentPlot()->GetPlotWin()->ZoomIn();
else if( aEvent.IsAction( &ACTIONS::zoomOutCenter ) ) else if( aEvent.IsAction( &ACTIONS::zoomOutCenter ) )
m_plotFrame->GetCurrentPlot()->GetPlotWin()->ZoomOut(); m_simulatorFrame->GetCurrentPlot()->GetPlotWin()->ZoomOut();
else if( aEvent.IsAction( &ACTIONS::zoomFitScreen ) ) else if( aEvent.IsAction( &ACTIONS::zoomFitScreen ) )
m_plotFrame->GetCurrentPlot()->GetPlotWin()->Fit(); m_simulatorFrame->GetCurrentPlot()->GetPlotWin()->Fit();
} }
return 0; return 0;
@ -234,12 +238,12 @@ int SIMULATOR_CONTROL::Zoom( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::ToggleGrid( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::ToggleGrid( const TOOL_EVENT& aEvent )
{ {
SIM_PLOT_PANEL* plot = m_plotFrame->GetCurrentPlot(); SIM_PLOT_PANEL* plot = m_simulatorFrame->GetCurrentPlot();
if( plot ) if( plot )
{ {
plot->ShowGrid( !plot->IsGridShown() ); plot->ShowGrid( !plot->IsGridShown() );
m_plotFrame->OnModify(); m_simulatorFrame->OnModify();
} }
return 0; return 0;
@ -248,12 +252,12 @@ int SIMULATOR_CONTROL::ToggleGrid( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::ToggleLegend( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::ToggleLegend( const TOOL_EVENT& aEvent )
{ {
SIM_PLOT_PANEL* plot = m_plotFrame->GetCurrentPlot(); SIM_PLOT_PANEL* plot = m_simulatorFrame->GetCurrentPlot();
if( plot ) if( plot )
{ {
plot->ShowLegend( !plot->IsLegendShown() ); plot->ShowLegend( !plot->IsLegendShown() );
m_plotFrame->OnModify(); m_simulatorFrame->OnModify();
} }
return 0; return 0;
@ -262,12 +266,12 @@ int SIMULATOR_CONTROL::ToggleLegend( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::ToggleDottedSecondary( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::ToggleDottedSecondary( const TOOL_EVENT& aEvent )
{ {
SIM_PLOT_PANEL* plot = m_plotFrame->GetCurrentPlot(); SIM_PLOT_PANEL* plot = m_simulatorFrame->GetCurrentPlot();
if( plot ) if( plot )
{ {
plot->SetDottedSecondary( !plot->GetDottedSecondary() ); plot->SetDottedSecondary( !plot->GetDottedSecondary() );
m_plotFrame->OnModify(); m_simulatorFrame->OnModify();
} }
return 0; return 0;
@ -276,14 +280,14 @@ int SIMULATOR_CONTROL::ToggleDottedSecondary( const TOOL_EVENT& aEvent )
int SIMULATOR_CONTROL::ToggleDarkModePlots( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::ToggleDarkModePlots( const TOOL_EVENT& aEvent )
{ {
m_plotFrame->ToggleDarkModePlots(); m_simulatorFrame->ToggleDarkModePlots();
return 0; return 0;
} }
int SIMULATOR_CONTROL::EditSimCommand( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::EditSimCommand( const TOOL_EVENT& aEvent )
{ {
m_plotFrame->EditSimCommand(); m_simulatorFrame->EditSimCommand();
return 0; return 0;
} }
@ -293,7 +297,7 @@ int SIMULATOR_CONTROL::RunSimulation( const TOOL_EVENT& aEvent )
if( m_simulator->IsRunning() ) if( m_simulator->IsRunning() )
m_simulator->Stop(); m_simulator->Stop();
else else
m_plotFrame->StartSimulation(); m_simulatorFrame->StartSimulation();
return 0; return 0;
} }
@ -389,12 +393,12 @@ public:
int SIMULATOR_CONTROL::EditUserDefinedSignals( const TOOL_EVENT& aEvent ) int SIMULATOR_CONTROL::EditUserDefinedSignals( const TOOL_EVENT& aEvent )
{ {
std::map<int, wxString> userSignals = m_plotFrame->UserDefinedSignals(); std::map<int, wxString> userSignals = m_simulatorFrame->UserDefinedSignals();
DIALOG_USER_DEFINED_SIGNALS dlg( m_plotFrame, &userSignals ); DIALOG_USER_DEFINED_SIGNALS dlg( m_simulatorFrame, &userSignals );
if( dlg.ShowQuasiModal() == wxID_OK ) if( dlg.ShowQuasiModal() == wxID_OK )
m_plotFrame->SetUserDefinedSignals( userSignals ); m_simulatorFrame->SetUserDefinedSignals( userSignals );
return 0; return 0;
} }
@ -409,10 +413,10 @@ int SIMULATOR_CONTROL::ShowNetlist( const TOOL_EVENT& aEvent )
WX_STRING_REPORTER reporter( &errors ); WX_STRING_REPORTER reporter( &errors );
STRING_FORMATTER formatter; STRING_FORMATTER formatter;
m_circuitModel->SetSimOptions( m_plotFrame->GetCurrentOptions() ); m_circuitModel->SetSimOptions( m_simulatorFrame->GetCurrentOptions() );
m_circuitModel->GetNetlist( &formatter, reporter ); m_circuitModel->GetNetlist( &formatter, reporter );
NETLIST_VIEW_DIALOG dlg( m_plotFrame, errors.IsEmpty() ? wxString( formatter.GetString() ) : errors ); NETLIST_VIEW_DIALOG dlg( m_simulatorFrame, errors.IsEmpty() ? wxString( formatter.GetString() ) : errors );
dlg.ShowModal(); dlg.ShowModal();
return 0; return 0;

View File

@ -27,7 +27,7 @@
#include <tool/tool_interactive.h> #include <tool/tool_interactive.h>
class SIM_PLOT_FRAME; class SIMULATOR_FRAME;
class NGSPICE_CIRCUIT_MODEL; class NGSPICE_CIRCUIT_MODEL;
class SPICE_SIMULATOR; class SPICE_SIMULATOR;
@ -39,8 +39,7 @@ class SIMULATOR_CONTROL : public wxEvtHandler, public TOOL_INTERACTIVE
{ {
public: public:
SIMULATOR_CONTROL() : SIMULATOR_CONTROL() :
TOOL_INTERACTIVE( "eeschema.SimulatorControl" ), TOOL_INTERACTIVE( "eeschema.SimulatorControl" ), m_simulatorFrame( nullptr ),
m_plotFrame( nullptr ),
m_schematicFrame( nullptr ) m_schematicFrame( nullptr )
{ } { }
@ -88,7 +87,7 @@ private:
void setTransitions() override; void setTransitions() override;
private: private:
SIM_PLOT_FRAME* m_plotFrame; SIMULATOR_FRAME* m_simulatorFrame;
SCH_EDIT_FRAME* m_schematicFrame; SCH_EDIT_FRAME* m_schematicFrame;
std::shared_ptr<NGSPICE_CIRCUIT_MODEL> m_circuitModel; std::shared_ptr<NGSPICE_CIRCUIT_MODEL> m_circuitModel;
std::shared_ptr<SPICE_SIMULATOR> m_simulator; std::shared_ptr<SPICE_SIMULATOR> m_simulator;

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <sim/sim_notebook.h> #include "widgets/sim_notebook.h"
SIM_NOTEBOOK::SIM_NOTEBOOK() : SIM_NOTEBOOK::SIM_NOTEBOOK() :

View File

@ -25,9 +25,9 @@
#ifndef SIM_NOTEBOOK_H #ifndef SIM_NOTEBOOK_H
#define SIM_NOTEBOOK_H #define SIM_NOTEBOOK_H
#include <dialog_sim_command.h> #include "dialogs/dialog_sim_command.h"
#include <sim/sim_panel_base.h> #include "sim/sim_panel_base.h"
#include <sim/sim_plot_panel.h> #include "sim/sim_plot_panel.h"
class SIM_NOTEBOOK : public wxAuiNotebook class SIM_NOTEBOOK : public wxAuiNotebook

View File

@ -25,7 +25,7 @@
*/ */
#include <sim/sim_plot_frame.h> #include <sim/simulator_frame.h>
#include <sch_symbol.h> #include <sch_symbol.h>
#include <template_fieldnames.h> #include <template_fieldnames.h>
#include <widgets/bitmap_button.h> #include <widgets/bitmap_button.h>
@ -38,7 +38,7 @@
#include "tuner_slider.h" #include "tuner_slider.h"
#include "core/kicad_algo.h" #include "core/kicad_algo.h"
TUNER_SLIDER::TUNER_SLIDER( SIM_PLOT_FRAME* aFrame, wxWindow* aParent, TUNER_SLIDER::TUNER_SLIDER( SIMULATOR_FRAME* aFrame, wxWindow* aParent,
const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol ) : const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol ) :
TUNER_SLIDER_BASE( aParent ), TUNER_SLIDER_BASE( aParent ),
m_symbol( aSymbol->m_Uuid ), m_symbol( aSymbol->m_Uuid ),

View File

@ -34,7 +34,7 @@
#include <wx/timer.h> #include <wx/timer.h>
class SIM_PLOT_FRAME; class SIMULATOR_FRAME;
class SCH_SYMBOL; class SCH_SYMBOL;
/** /**
@ -43,7 +43,7 @@ class SCH_SYMBOL;
class TUNER_SLIDER : public TUNER_SLIDER_BASE class TUNER_SLIDER : public TUNER_SLIDER_BASE
{ {
public: public:
TUNER_SLIDER( SIM_PLOT_FRAME *aFrame, wxWindow* aParent, const SCH_SHEET_PATH& aSheetPath, TUNER_SLIDER( SIMULATOR_FRAME *aFrame, wxWindow* aParent, const SCH_SHEET_PATH& aSheetPath,
SCH_SYMBOL* aSymbol ); SCH_SYMBOL* aSymbol );
wxString GetSymbolRef() const wxString GetSymbolRef() const
@ -102,15 +102,15 @@ private:
void onMinTextEnter( wxCommandEvent& event ) override; void onMinTextEnter( wxCommandEvent& event ) override;
private: private:
KIID m_symbol; KIID m_symbol;
SCH_SHEET_PATH m_sheetPath; SCH_SHEET_PATH m_sheetPath;
wxString m_ref; wxString m_ref;
SPICE_VALUE m_min; SPICE_VALUE m_min;
SPICE_VALUE m_max; SPICE_VALUE m_max;
SPICE_VALUE m_value; SPICE_VALUE m_value;
SIM_PLOT_FRAME* m_frame; SIMULATOR_FRAME* m_frame;
}; };
#endif /* TUNER_SLIDER_H */ #endif /* TUNER_SLIDER_H */