From ff044cd0cf424965b13b1252f095788b4487d1ff Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 14 Jul 2023 10:21:58 +0100 Subject: [PATCH] Mostly a terminology update... ... but also makes DIALOG_SIM_COMMAND and SIMULATOR_REPORTER a bit more simulator-agnostic. --- eeschema/CMakeLists.txt | 6 +- eeschema/dialogs/dialog_sim_command.cpp | 54 +++--- eeschema/dialogs/dialog_sim_command.h | 25 +-- eeschema/dialogs/dialog_sim_command_base.cpp | 16 +- eeschema/dialogs/dialog_sim_command_base.fbp | 4 +- eeschema/dialogs/dialog_sim_command_base.h | 4 +- eeschema/eeschema_config.cpp | 2 +- .../netlist_exporter_spice.cpp | 2 +- eeschema/sch_plotter.cpp | 2 - eeschema/sch_plotter.h | 5 +- eeschema/schematic.cpp | 2 +- eeschema/schematic_settings.cpp | 9 +- eeschema/schematic_settings.h | 4 +- eeschema/sim/ngspice.cpp | 50 ++---- eeschema/sim/ngspice.h | 2 +- eeschema/sim/sim_tab.cpp | 4 +- eeschema/sim/sim_tab.h | 2 +- eeschema/sim/simulator_frame.cpp | 89 +++++----- eeschema/sim/simulator_frame.h | 22 +-- ...lator_panel.cpp => simulator_frame_ui.cpp} | 163 +++++++++--------- ...simulator_panel.h => simulator_frame_ui.h} | 24 +-- ...l_base.cpp => simulator_frame_ui_base.cpp} | 56 +++--- ...l_base.fbp => simulator_frame_ui_base.fbp} | 6 +- ...panel_base.h => simulator_frame_ui_base.h} | 18 +- ...{spice_reporter.h => simulator_reporter.h} | 15 +- ...cuit_model.cpp => spice_circuit_model.cpp} | 33 ++-- ..._circuit_model.h => spice_circuit_model.h} | 19 +- eeschema/sim/spice_settings.cpp | 34 ++-- eeschema/sim/spice_settings.h | 29 ++-- eeschema/sim/spice_simulator.h | 16 +- eeschema/tools/simulator_control.h | 10 +- eeschema/widgets/tuner_slider.cpp | 16 +- eeschema/widgets/tuner_slider.h | 18 +- .../eeschema/test_netlist_exporter_spice.cpp | 2 +- .../eeschema/test_netlist_exporter_spice.h | 2 +- .../spice/test_netlist_exporter_spice.cpp | 2 +- qa/tests/spice/test_netlist_exporter_spice.h | 6 +- qa/tests/spice/test_ngspice_helpers.cpp | 10 +- 38 files changed, 374 insertions(+), 409 deletions(-) rename eeschema/sim/{simulator_panel.cpp => simulator_frame_ui.cpp} (94%) rename eeschema/sim/{simulator_panel.h => simulator_frame_ui.h} (94%) rename eeschema/sim/{simulator_panel_base.cpp => simulator_frame_ui_base.cpp} (85%) rename eeschema/sim/{simulator_panel_base.fbp => simulator_frame_ui_base.fbp} (99%) rename eeschema/sim/{simulator_panel_base.h => simulator_frame_ui_base.h} (83%) rename eeschema/sim/{spice_reporter.h => simulator_reporter.h} (79%) rename eeschema/sim/{ngspice_circuit_model.cpp => spice_circuit_model.cpp} (82%) rename eeschema/sim/{ngspice_circuit_model.h => spice_circuit_model.h} (85%) diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 27ccfd167a..945d57d310 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -223,11 +223,11 @@ set( EESCHEMA_SIM_SRCS sim/kibis/ibis_parser.cpp sim/kibis/kibis.cpp - sim/ngspice_circuit_model.cpp + sim/spice_circuit_model.cpp sim/ngspice.cpp sim/simulator_frame.cpp - sim/simulator_panel.cpp - sim/simulator_panel_base.cpp + sim/simulator_frame_ui.cpp + sim/simulator_frame_ui_base.cpp sim/sim_plot_colors.cpp sim/sim_tab.cpp sim/sim_plot_tab.cpp diff --git a/eeschema/dialogs/dialog_sim_command.cpp b/eeschema/dialogs/dialog_sim_command.cpp index 7b7a2f166c..2cc723a4f6 100644 --- a/eeschema/dialogs/dialog_sim_command.cpp +++ b/eeschema/dialogs/dialog_sim_command.cpp @@ -24,7 +24,7 @@ */ #include "dialog_sim_command.h" -#include +#include #include #include @@ -58,8 +58,8 @@ static wxString getStringSelection( const wxChoice* aCtrl ) DIALOG_SIM_COMMAND::DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent, - std::shared_ptr aCircuitModel, - std::shared_ptr& aSettings ) : + std::shared_ptr aCircuitModel, + std::shared_ptr& aSettings ) : DIALOG_SIM_COMMAND_BASE( aParent ), m_simulatorFrame( aParent ), m_circuitModel( aCircuitModel ), @@ -121,8 +121,8 @@ DIALOG_SIM_COMMAND::DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent, m_noiseSrc->Append( item.refName ); } - if( !dynamic_cast( aSettings.get() ) ) - m_compatibilityMode->Show( false ); + if( !dynamic_cast( aSettings.get() ) ) + m_compatibilityModeSizer->Show( false ); SetupStandardButtons(); } @@ -135,23 +135,20 @@ bool DIALOG_SIM_COMMAND::TransferDataToWindow() m_fixIncludePaths->SetValue( m_settings->GetFixIncludePaths() ); - NGSPICE_SIMULATOR_SETTINGS* ngspiceSettings = - dynamic_cast( m_settings.get() ); + NGSPICE_SETTINGS* ngspiceSettings = dynamic_cast( m_settings.get() ); if( ngspiceSettings ) { - switch( ngspiceSettings->GetModelMode() ) + switch( ngspiceSettings->GetCompatibilityMode() ) { - case NGSPICE_MODEL_MODE::USER_CONFIG: m_compatibilityModeChoice->SetSelection( 0 ); break; - case NGSPICE_MODEL_MODE::NGSPICE: m_compatibilityModeChoice->SetSelection( 1 ); break; - case NGSPICE_MODEL_MODE::PSPICE: m_compatibilityModeChoice->SetSelection( 2 ); break; - case NGSPICE_MODEL_MODE::LTSPICE: m_compatibilityModeChoice->SetSelection( 3 ); break; - case NGSPICE_MODEL_MODE::LT_PSPICE: m_compatibilityModeChoice->SetSelection( 4 ); break; - case NGSPICE_MODEL_MODE::HSPICE: m_compatibilityModeChoice->SetSelection( 5 ); break; - default: - wxFAIL_MSG( wxString::Format( "Unknown NGSPICE_MODEL_MODE %d.", - ngspiceSettings->GetModelMode() ) ); - break; + case NGSPICE_COMPATIBILITY_MODE::USER_CONFIG: m_compatibilityMode->SetSelection( 0 ); break; + case NGSPICE_COMPATIBILITY_MODE::NGSPICE: m_compatibilityMode->SetSelection( 1 ); break; + case NGSPICE_COMPATIBILITY_MODE::PSPICE: m_compatibilityMode->SetSelection( 2 ); break; + case NGSPICE_COMPATIBILITY_MODE::LTSPICE: m_compatibilityMode->SetSelection( 3 ); break; + case NGSPICE_COMPATIBILITY_MODE::LT_PSPICE: m_compatibilityMode->SetSelection( 4 ); break; + case NGSPICE_COMPATIBILITY_MODE::HSPICE: m_compatibilityMode->SetSelection( 5 ); break; + default: wxFAIL_MSG( wxString::Format( "Unknown NGSPICE_COMPATIBILITY_MODE %d.", + ngspiceSettings->GetCompatibilityMode() ) ); break; } } @@ -207,19 +204,16 @@ bool DIALOG_SIM_COMMAND::TransferDataFromWindow() return false; // The simulator dependent settings always get transferred. - NGSPICE_SIMULATOR_SETTINGS* ngspiceSettings = - dynamic_cast( m_settings.get() ); - - if( ngspiceSettings ) + if( NGSPICE_SETTINGS* ngspiceSettings = dynamic_cast( m_settings.get() ) ) { - switch( m_compatibilityModeChoice->GetSelection() ) + switch( m_compatibilityMode->GetSelection() ) { - case 0: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::USER_CONFIG ); break; - case 1: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::NGSPICE ); break; - case 2: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::PSPICE ); break; - case 3: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::LTSPICE ); break; - case 4: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::LT_PSPICE ); break; - case 5: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::HSPICE ); break; + case 0: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::USER_CONFIG ); break; + case 1: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::NGSPICE ); break; + case 2: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::PSPICE ); break; + case 3: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::LTSPICE ); break; + case 4: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::LT_PSPICE ); break; + case 5: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::HSPICE ); break; } } @@ -490,7 +484,7 @@ void DIALOG_SIM_COMMAND::parseCommand( const wxString& aCommand ) return; } - SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aCommand ); + SIM_TYPE simType = SPICE_CIRCUIT_MODEL::CommandToSimType( aCommand ); SetTitle( SPICE_SIMULATOR::TypeToName( simType, true ) + wxT( " \u2014 " ) diff --git a/eeschema/dialogs/dialog_sim_command.h b/eeschema/dialogs/dialog_sim_command.h index d8dbc6341a..b065224522 100644 --- a/eeschema/dialogs/dialog_sim_command.h +++ b/eeschema/dialogs/dialog_sim_command.h @@ -33,16 +33,17 @@ #include -class NGSPICE_CIRCUIT_MODEL; -class SPICE_SIMULATOR_SETTINGS; +class SPICE_CIRCUIT_MODEL; +class SPICE_SETTINGS; class SIMULATOR_FRAME; class DIALOG_SIM_COMMAND : public DIALOG_SIM_COMMAND_BASE { public: - DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent, std::shared_ptr aCircuitModel, - std::shared_ptr& aSettings ); + DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent, + std::shared_ptr aCircuitModel, + std::shared_ptr& aSettings ); const wxString& GetSimCommand() const { @@ -175,14 +176,14 @@ private: void loadDirectives(); private: - SIMULATOR_FRAME* m_simulatorFrame; - wxString m_simCommand; - std::shared_ptr m_circuitModel; - std::shared_ptr m_settings; - SPICE_VALIDATOR m_spiceValidator; - SPICE_VALIDATOR m_spiceEmptyValidator; - wxIntegerValidator m_posIntValidator; - std::set m_fftInputSignals; + SIMULATOR_FRAME* m_simulatorFrame; + wxString m_simCommand; + std::shared_ptr m_circuitModel; + std::shared_ptr m_settings; + SPICE_VALIDATOR m_spiceValidator; + SPICE_VALIDATOR m_spiceEmptyValidator; + wxIntegerValidator m_posIntValidator; + std::set m_fftInputSignals; }; #endif /* DIALOG_SIM_COMMAND_H */ diff --git a/eeschema/dialogs/dialog_sim_command_base.cpp b/eeschema/dialogs/dialog_sim_command_base.cpp index c2f74c25e6..8a74743d5b 100644 --- a/eeschema/dialogs/dialog_sim_command_base.cpp +++ b/eeschema/dialogs/dialog_sim_command_base.cpp @@ -638,21 +638,21 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i m_saveAllDissipations = new wxCheckBox( this, wxID_ANY, _("Save all power dissipations"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer88->Add( m_saveAllDissipations, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_compatibilityMode = new wxBoxSizer( wxHORIZONTAL ); + m_compatibilityModeSizer = new wxBoxSizer( wxHORIZONTAL ); wxStaticText* compatibilityLabel; compatibilityLabel = new wxStaticText( this, wxID_ANY, _("Compatibility mode:"), wxDefaultPosition, wxDefaultSize, 0 ); compatibilityLabel->Wrap( -1 ); - m_compatibilityMode->Add( compatibilityLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 8 ); + m_compatibilityModeSizer->Add( compatibilityLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 8 ); - wxString m_compatibilityModeChoiceChoices[] = { _("User configuration"), _("Spice"), _("PSpice"), _("LTSpice"), _("PSpice and LTSpice"), _("HSpice") }; - int m_compatibilityModeChoiceNChoices = sizeof( m_compatibilityModeChoiceChoices ) / sizeof( wxString ); - m_compatibilityModeChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_compatibilityModeChoiceNChoices, m_compatibilityModeChoiceChoices, 0 ); - m_compatibilityModeChoice->SetSelection( 0 ); - m_compatibilityMode->Add( m_compatibilityModeChoice, 0, wxALIGN_CENTER_VERTICAL, 5 ); + wxString m_compatibilityModeChoices[] = { _("User configuration"), _("Spice"), _("PSpice"), _("LTSpice"), _("PSpice and LTSpice"), _("HSpice") }; + int m_compatibilityModeNChoices = sizeof( m_compatibilityModeChoices ) / sizeof( wxString ); + m_compatibilityMode = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_compatibilityModeNChoices, m_compatibilityModeChoices, 0 ); + m_compatibilityMode->SetSelection( 0 ); + m_compatibilityModeSizer->Add( m_compatibilityMode, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer88->Add( m_compatibilityMode, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + bSizer88->Add( m_compatibilityModeSizer, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); bSizer1->Add( bSizer88, 0, wxEXPAND|wxTOP|wxLEFT, 10 ); diff --git a/eeschema/dialogs/dialog_sim_command_base.fbp b/eeschema/dialogs/dialog_sim_command_base.fbp index e9749776ed..ba31fdfeaa 100644 --- a/eeschema/dialogs/dialog_sim_command_base.fbp +++ b/eeschema/dialogs/dialog_sim_command_base.fbp @@ -7346,7 +7346,7 @@ 1 - m_compatibilityMode + m_compatibilityModeSizer wxHORIZONTAL protected @@ -7450,7 +7450,7 @@ 0 1 - m_compatibilityModeChoice + m_compatibilityMode 1 diff --git a/eeschema/dialogs/dialog_sim_command_base.h b/eeschema/dialogs/dialog_sim_command_base.h index a7f164acb6..828e661871 100644 --- a/eeschema/dialogs/dialog_sim_command_base.h +++ b/eeschema/dialogs/dialog_sim_command_base.h @@ -156,8 +156,8 @@ class DIALOG_SIM_COMMAND_BASE : public DIALOG_SHIM wxCheckBox* m_saveAllVoltages; wxCheckBox* m_saveAllCurrents; wxCheckBox* m_saveAllDissipations; - wxBoxSizer* m_compatibilityMode; - wxChoice* m_compatibilityModeChoice; + wxBoxSizer* m_compatibilityModeSizer; + wxChoice* m_compatibilityMode; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; wxButton* m_sdbSizerCancel; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index d592c270a6..6e64548c1a 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -135,7 +135,7 @@ void SCH_EDIT_FRAME::saveProjectSettings() RecordERCExclusions(); if( Kiway().Player( FRAME_SIMULATOR, false ) ) - Prj().GetProjectFile().m_SchematicSettings->m_NgspiceSimulatorSettings->SaveToFile(); + Prj().GetProjectFile().m_SchematicSettings->m_NgspiceSettings->SaveToFile(); // Save the page layout file if doesn't exist yet (e.g. if we opened a non-kicad schematic) diff --git a/eeschema/netlist_exporters/netlist_exporter_spice.cpp b/eeschema/netlist_exporters/netlist_exporter_spice.cpp index e941fbc29c..45520d21be 100644 --- a/eeschema/netlist_exporters/netlist_exporter_spice.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_spice.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include diff --git a/eeschema/sch_plotter.cpp b/eeschema/sch_plotter.cpp index ddcb1aff79..4efd1e8c0c 100644 --- a/eeschema/sch_plotter.cpp +++ b/eeschema/sch_plotter.cpp @@ -71,7 +71,6 @@ static const wxChar* plot_sheet_list( HPGL_PAGE_SIZE aSize ) SCH_PLOTTER::SCH_PLOTTER( SCHEMATIC* aSchematic ) : - m_schFrame( nullptr ), m_schematic( aSchematic ) { m_colorSettings = nullptr; @@ -79,7 +78,6 @@ SCH_PLOTTER::SCH_PLOTTER( SCHEMATIC* aSchematic ) : SCH_PLOTTER::SCH_PLOTTER( SCH_EDIT_FRAME* aFrame ) : - m_schFrame( aFrame ), m_schematic( &aFrame->Schematic() ) { m_colorSettings = nullptr; diff --git a/eeschema/sch_plotter.h b/eeschema/sch_plotter.h index edf7600c99..c0bdf93962 100644 --- a/eeschema/sch_plotter.h +++ b/eeschema/sch_plotter.h @@ -211,12 +211,9 @@ protected: REPORTER* aReporter = nullptr ); private: - SCH_EDIT_FRAME* m_schFrame; SCHEMATIC* m_schematic; - COLOR_SETTINGS* m_colorSettings; - - wxString m_lastOutputFilePath; + wxString m_lastOutputFilePath; }; #endif \ No newline at end of file diff --git a/eeschema/schematic.cpp b/eeschema/schematic.cpp index 1f0df4003f..66be397105 100644 --- a/eeschema/schematic.cpp +++ b/eeschema/schematic.cpp @@ -100,7 +100,7 @@ void SCHEMATIC::SetProject( PROJECT* aPrj ) project.m_SchematicSettings = new SCHEMATIC_SETTINGS( &project, "schematic" ); project.m_SchematicSettings->LoadFromFile(); - project.m_SchematicSettings->m_NgspiceSimulatorSettings->LoadFromFile(); + project.m_SchematicSettings->m_NgspiceSettings->LoadFromFile(); project.m_ErcSettings->LoadFromFile(); } } diff --git a/eeschema/schematic_settings.cpp b/eeschema/schematic_settings.cpp index 188e7ee55f..1d327c6ce0 100644 --- a/eeschema/schematic_settings.cpp +++ b/eeschema/schematic_settings.cpp @@ -62,7 +62,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin m_SpiceSaveAllCurrents( false ), m_SpiceSaveAllDissipations( false ), m_SpiceModelCurSheetAsRoot( true ), - m_NgspiceSimulatorSettings( nullptr ) + m_NgspiceSettings( nullptr ) { EESCHEMA_SETTINGS* appSettings = Pgm().GetSettingsManager().GetAppSettings(); @@ -235,8 +235,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin m_params.emplace_back( new PARAM( "annotate_start_num", &m_AnnotateStartNum, 0 ) ); - m_NgspiceSimulatorSettings = - std::make_shared( this, "ngspice" ); + m_NgspiceSettings = std::make_shared( this, "ngspice" ); registerMigration( 0, 1, [&]() -> bool @@ -253,8 +252,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin SCHEMATIC_SETTINGS::~SCHEMATIC_SETTINGS() { - ReleaseNestedSettings( m_NgspiceSimulatorSettings.get() ); - m_NgspiceSimulatorSettings.reset(); + ReleaseNestedSettings( m_NgspiceSettings.get() ); + m_NgspiceSettings.reset(); if( m_parent ) { diff --git a/eeschema/schematic_settings.h b/eeschema/schematic_settings.h index e8185da36c..26f346f7c5 100644 --- a/eeschema/schematic_settings.h +++ b/eeschema/schematic_settings.h @@ -25,7 +25,7 @@ #include #include -class NGSPICE_SIMULATOR_SETTINGS; +class NGSPICE_SETTINGS; /** * These settings were stored in SCH_BASE_FRAME previously. @@ -96,7 +96,7 @@ public: /** * Ngspice simulator settings. */ - std::shared_ptr m_NgspiceSimulatorSettings; + std::shared_ptr m_NgspiceSettings; }; #endif diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index 56857e1145..180a7f2222 100644 --- a/eeschema/sim/ngspice.cpp +++ b/eeschema/sim/ngspice.cpp @@ -31,9 +31,9 @@ #include #include -#include "ngspice_circuit_model.h" +#include "spice_circuit_model.h" #include "ngspice.h" -#include "spice_reporter.h" +#include "simulator_reporter.h" #include "spice_settings.h" #include @@ -72,7 +72,7 @@ NGSPICE::NGSPICE() : NGSPICE::~NGSPICE() = default; -void NGSPICE::Init( const SPICE_SIMULATOR_SETTINGS* aSettings ) +void NGSPICE::Init( const SPICE_SETTINGS* aSettings ) { Command( "reset" ); @@ -254,8 +254,8 @@ std::vector NGSPICE::GetPhaseVector( const std::string& aName, int aMaxL bool NGSPICE::Attach( const std::shared_ptr& aModel, const wxString& aSimCommand, unsigned aSimOptions, REPORTER& aReporter ) { - NGSPICE_CIRCUIT_MODEL* model = dynamic_cast( aModel.get() ); - STRING_FORMATTER formatter; + SPICE_CIRCUIT_MODEL* model = dynamic_cast( aModel.get() ); + STRING_FORMATTER formatter; if( model && model->GetNetlist( aSimCommand, aSimOptions, &formatter, aReporter ) ) { @@ -359,42 +359,22 @@ wxString NGSPICE::GetXAxis( SIM_TYPE aType ) const std::vector NGSPICE::GetSettingCommands() const { - const NGSPICE_SIMULATOR_SETTINGS* settings = - dynamic_cast( Settings().get() ); + const NGSPICE_SETTINGS* settings = dynamic_cast( Settings().get() ); std::vector commands; wxCHECK( settings, commands ); - switch( settings->GetModelMode() ) + switch( settings->GetCompatibilityMode() ) { - case NGSPICE_MODEL_MODE::USER_CONFIG: - break; - - case NGSPICE_MODEL_MODE::NGSPICE: - commands.emplace_back( "unset ngbehavior" ); - break; - - case NGSPICE_MODEL_MODE::PSPICE: - commands.emplace_back( "set ngbehavior=psa" ); - break; - - case NGSPICE_MODEL_MODE::LTSPICE: - commands.emplace_back( "set ngbehavior=lta" ); - break; - - case NGSPICE_MODEL_MODE::LT_PSPICE: - commands.emplace_back( "set ngbehavior=ltpsa" ); - break; - - case NGSPICE_MODEL_MODE::HSPICE: - commands.emplace_back( "set ngbehavior=hsa" ); - break; - - default: - wxFAIL_MSG( wxString::Format( "Undefined NGSPICE_MODEL_MODE %d.", - settings->GetModelMode() ) ); - break; + case NGSPICE_COMPATIBILITY_MODE::USER_CONFIG: break; + case NGSPICE_COMPATIBILITY_MODE::NGSPICE: commands.emplace_back( "unset ngbehavior" ); break; + case NGSPICE_COMPATIBILITY_MODE::PSPICE: commands.emplace_back( "set ngbehavior=psa" ); break; + case NGSPICE_COMPATIBILITY_MODE::LTSPICE: commands.emplace_back( "set ngbehavior=lta" ); break; + case NGSPICE_COMPATIBILITY_MODE::LT_PSPICE: commands.emplace_back( "set ngbehavior=ltpsa" ); break; + case NGSPICE_COMPATIBILITY_MODE::HSPICE: commands.emplace_back( "set ngbehavior=hsa" ); break; + default: wxFAIL_MSG( wxString::Format( "Undefined NGSPICE_COMPATIBILITY_MODE %d.", + settings->GetCompatibilityMode() ) ); break; } return commands; diff --git a/eeschema/sim/ngspice.h b/eeschema/sim/ngspice.h index 73b66da5c1..17b513cf1d 100644 --- a/eeschema/sim/ngspice.h +++ b/eeschema/sim/ngspice.h @@ -56,7 +56,7 @@ public: virtual ~NGSPICE(); ///< @copydoc SPICE_SIMULATOR::Init() - void Init( const SPICE_SIMULATOR_SETTINGS* aSettings = nullptr ) override final; + void Init( const SPICE_SETTINGS* aSettings = nullptr ) override final; ///< @copydoc SPICE_SIMULATOR::Attach() bool Attach( const std::shared_ptr& aModel, const wxString& aSimCommand, diff --git a/eeschema/sim/sim_tab.cpp b/eeschema/sim/sim_tab.cpp index c63693641c..dba09673b4 100644 --- a/eeschema/sim/sim_tab.cpp +++ b/eeschema/sim/sim_tab.cpp @@ -27,7 +27,7 @@ #include "sim_tab.h" #include "simulator_frame.h" -#include "ngspice_circuit_model.h" +#include "spice_circuit_model.h" SIM_TAB::SIM_TAB() : @@ -70,7 +70,7 @@ bool SIM_TAB::IsPlottable( SIM_TYPE aSimType ) SIM_TYPE SIM_TAB::GetSimType() const { - return NGSPICE_CIRCUIT_MODEL::CommandToSimType( m_simCommand ); + return SPICE_CIRCUIT_MODEL::CommandToSimType( m_simCommand ); } diff --git a/eeschema/sim/sim_tab.h b/eeschema/sim/sim_tab.h index 38776def56..c2008fa835 100644 --- a/eeschema/sim/sim_tab.h +++ b/eeschema/sim/sim_tab.h @@ -27,7 +27,7 @@ #define __SIM_PLOT_PANEL_BASE_H #include -#include +#include #include #include #include diff --git a/eeschema/sim/simulator_frame.cpp b/eeschema/sim/simulator_frame.cpp index 62727dd34c..6983440cb8 100644 --- a/eeschema/sim/simulator_frame.cpp +++ b/eeschema/sim/simulator_frame.cpp @@ -51,17 +51,17 @@ #include #include "ngspice.h" #include -#include +#include #include #include -#include +#include #include #include #include -class SIM_THREAD_REPORTER : public SPICE_REPORTER +class SIM_THREAD_REPORTER : public SIMULATOR_REPORTER { public: SIM_THREAD_REPORTER( SIMULATOR_FRAME* aParent ) : @@ -82,7 +82,7 @@ public: return false; // Technically "indeterminate" rather than false. } - void OnSimStateChange( SPICE_SIMULATOR* aObject, SIM_STATE aNewState ) override + void OnSimStateChange( SIMULATOR* aObject, SIM_STATE aNewState ) override { wxCommandEvent* event = nullptr; @@ -112,7 +112,7 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : wxDefaultSize, wxDEFAULT_FRAME_STYLE, wxT( "simulator" ), unityScale ), m_schematicFrame( nullptr ), m_toolBar( nullptr ), - m_panel( nullptr ), + m_ui( nullptr ), m_simFinished( false ), m_workbookModified( false ) { @@ -135,28 +135,27 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_toolBar->Realize(); mainSizer->Add( m_toolBar, 0, wxEXPAND, 5 ); - m_panel = new SIMULATOR_PANEL( this, m_schematicFrame ); - mainSizer->Add( m_panel, 1, wxEXPAND, 5 ); + m_ui = new SIMULATOR_FRAME_UI( this, m_schematicFrame ); + mainSizer->Add( m_ui, 1, wxEXPAND, 5 ); m_simulator = SIMULATOR::CreateInstance( "ngspice" ); wxASSERT( m_simulator ); LoadSettings( config() ); - NGSPICE_SIMULATOR_SETTINGS* settings = - dynamic_cast( m_simulator->Settings().get() ); + NGSPICE_SETTINGS* settings = dynamic_cast( m_simulator->Settings().get() ); wxCHECK2( settings, /* do nothing in release builds*/ ); if( settings && settings->GetWorkbookFilename().IsEmpty() ) - settings->SetModelMode( NGSPICE_MODEL_MODE::LT_PSPICE ); + settings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::LT_PSPICE ); m_simulator->Init(); m_reporter = new SIM_THREAD_REPORTER( this ); m_simulator->SetReporter( m_reporter ); - m_circuitModel = std::make_shared( &m_schematicFrame->Schematic(), this ); + m_circuitModel = std::make_shared( &m_schematicFrame->Schematic(), this ); setupTools(); setupUIConditions(); @@ -181,12 +180,12 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : // Otherwise, the changes made by setSubWindowsSashSize are overwritten by one these // events wxSafeYield(); - m_panel->SetSubWindowsSashSize(); + m_ui->SetSubWindowsSashSize(); // Ensure the window is on top Raise(); - m_panel->InitWorkbook(); + m_ui->InitWorkbook(); UpdateTitle(); } @@ -226,7 +225,7 @@ void SIMULATOR_FRAME::ShowChangedLanguage() UpdateTitle(); - m_panel->ShowChangedLanguage(); + m_ui->ShowChangedLanguage(); } @@ -238,7 +237,7 @@ void SIMULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) if( cfg ) { EDA_BASE_FRAME::LoadSettings( cfg ); - m_panel->LoadSettings( cfg ); + m_ui->LoadSettings( cfg ); } PROJECT_FILE& project = Prj().GetProjectFile(); @@ -246,7 +245,7 @@ void SIMULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) NGSPICE* currentSim = dynamic_cast( m_simulator.get() ); if( currentSim ) - m_simulator->Settings() = project.m_SchematicSettings->m_NgspiceSimulatorSettings; + m_simulator->Settings() = project.m_SchematicSettings->m_NgspiceSettings; } @@ -258,14 +257,14 @@ void SIMULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) if( cfg ) { EDA_BASE_FRAME::SaveSettings( cfg ); - m_panel->SaveSettings( cfg ); + m_ui->SaveSettings( cfg ); } PROJECT_FILE& project = Prj().GetProjectFile(); if( project.m_SchematicSettings ) { - bool modified = project.m_SchematicSettings->m_NgspiceSimulatorSettings->SaveToFile(); + bool modified = project.m_SchematicSettings->m_NgspiceSettings->SaveToFile(); if( m_schematicFrame && modified ) m_schematicFrame->OnModify(); @@ -284,8 +283,8 @@ WINDOW_SETTINGS* SIMULATOR_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg ) wxString SIMULATOR_FRAME::GetCurrentSimCommand() const { - if( m_panel->GetCurrentSimTab() ) - return m_panel->GetCurrentSimTab()->GetSimCommand(); + if( m_ui->GetCurrentSimTab() ) + return m_ui->GetCurrentSimTab()->GetSimCommand(); else return m_circuitModel->GetSchTextSimCommand(); } @@ -293,13 +292,13 @@ wxString SIMULATOR_FRAME::GetCurrentSimCommand() const SIM_TYPE SIMULATOR_FRAME::GetCurrentSimType() const { - return NGSPICE_CIRCUIT_MODEL::CommandToSimType( GetCurrentSimCommand() ); + return SPICE_CIRCUIT_MODEL::CommandToSimType( GetCurrentSimCommand() ); } int SIMULATOR_FRAME::GetCurrentOptions() const { - if( SIM_TAB* simTab = m_panel->GetCurrentSimTab() ) + if( SIM_TAB* simTab = m_ui->GetCurrentSimTab() ) return simTab->GetSimOptions(); else return NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS; @@ -361,7 +360,7 @@ bool SIMULATOR_FRAME::LoadSimulator( const wxString& aSimCommand, unsigned aSimO void SIMULATOR_FRAME::StartSimulation() { - SIM_TAB* simTab = m_panel->GetCurrentSimTab(); + SIM_TAB* simTab = m_ui->GetCurrentSimTab(); if( !simTab ) return; @@ -370,7 +369,7 @@ void SIMULATOR_FRAME::StartSimulation() { wxString tranSpicePlot; - if( SIM_TAB* tranPlotTab = m_panel->GetSimTab( ST_TRAN ) ) + if( SIM_TAB* tranPlotTab = m_ui->GetSimTab( ST_TRAN ) ) tranSpicePlot = tranPlotTab->GetSpicePlotName(); if( tranSpicePlot.IsEmpty() ) @@ -391,7 +390,7 @@ void SIMULATOR_FRAME::StartSimulation() } simTab->SetSpicePlotName( m_simulator->CurrentPlotName() ); - m_panel->OnSimRefresh( true ); + m_ui->OnSimRefresh( true ); #if 0 m_simulator->Command( "setplot" ); // Print available plots to console @@ -403,7 +402,7 @@ void SIMULATOR_FRAME::StartSimulation() } else { - if( m_panel->GetSimTabIndex( simTab ) == 0 + if( m_ui->GetSimTabIndex( simTab ) == 0 && m_circuitModel->GetSchTextSimCommand() != simTab->GetLastSchTextSimCommand() ) { if( simTab->GetLastSchTextSimCommand().IsEmpty() @@ -424,7 +423,7 @@ void SIMULATOR_FRAME::StartSimulation() if( simulatorLock.owns_lock() ) { - m_panel->OnSimUpdate(); + m_ui->OnSimUpdate(); m_simulator->Run(); } else @@ -436,61 +435,61 @@ void SIMULATOR_FRAME::StartSimulation() void SIMULATOR_FRAME::NewPlotPanel( const wxString& aSimCommand, unsigned aOptions ) { - m_panel->NewSimTab( aSimCommand, aOptions ); + m_ui->NewSimTab( aSimCommand, aOptions ); } const std::vector SIMULATOR_FRAME::SimPlotVectors() { - return m_panel->SimPlotVectors(); + return m_ui->SimPlotVectors(); } const std::vector SIMULATOR_FRAME::Signals() { - return m_panel->Signals(); + return m_ui->Signals(); } const std::map& SIMULATOR_FRAME::UserDefinedSignals() { - return m_panel->UserDefinedSignals(); + return m_ui->UserDefinedSignals(); } void SIMULATOR_FRAME::SetUserDefinedSignals( const std::map& aSignals ) { - m_panel->SetUserDefinedSignals( aSignals ); + m_ui->SetUserDefinedSignals( aSignals ); } void SIMULATOR_FRAME::AddVoltageTrace( const wxString& aNetName ) { - m_panel->AddTrace( aNetName, SPT_VOLTAGE ); + m_ui->AddTrace( aNetName, SPT_VOLTAGE ); } void SIMULATOR_FRAME::AddCurrentTrace( const wxString& aDeviceName ) { - m_panel->AddTrace( aDeviceName, SPT_CURRENT ); + m_ui->AddTrace( aDeviceName, SPT_CURRENT ); } void SIMULATOR_FRAME::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol ) { - m_panel->AddTuner( aSheetPath, aSymbol ); + m_ui->AddTuner( aSheetPath, aSymbol ); } SIM_TAB* SIMULATOR_FRAME::GetCurrentSimTab() const { - return m_panel->GetCurrentSimTab(); + return m_ui->GetCurrentSimTab(); } bool SIMULATOR_FRAME::LoadWorkbook( const wxString& aPath ) { - if( m_panel->LoadWorkbook( aPath ) ) + if( m_ui->LoadWorkbook( aPath ) ) { UpdateTitle(); @@ -510,7 +509,7 @@ bool SIMULATOR_FRAME::LoadWorkbook( const wxString& aPath ) bool SIMULATOR_FRAME::SaveWorkbook( const wxString& aPath ) { - if( m_panel->SaveWorkbook( aPath ) ) + if( m_ui->SaveWorkbook( aPath ) ) { UpdateTitle(); m_workbookModified = false; @@ -524,13 +523,13 @@ bool SIMULATOR_FRAME::SaveWorkbook( const wxString& aPath ) void SIMULATOR_FRAME::ToggleDarkModePlots() { - m_panel->ToggleDarkModePlots(); + m_ui->ToggleDarkModePlots(); } bool SIMULATOR_FRAME::EditSimCommand() { - SIM_TAB* simTab = m_panel->GetCurrentSimTab(); + SIM_TAB* simTab = m_ui->GetCurrentSimTab(); DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() ); wxString errors; WX_STRING_REPORTER reporter( &errors ); @@ -552,7 +551,7 @@ bool SIMULATOR_FRAME::EditSimCommand() { simTab->SetSimCommand( dlg.GetSimCommand() ); simTab->SetSimOptions( dlg.GetSimOptions() ); - m_panel->OnPlotSettingsChanged(); + m_ui->OnPlotSettingsChanged(); OnModify(); return true; } @@ -636,7 +635,7 @@ void SIMULATOR_FRAME::setupUIConditions() auto darkModePlotCondition = [this]( const SELECTION& aSel ) { - return m_panel->DarkModePlots(); + return m_ui->DarkModePlots(); }; auto simRunning = @@ -727,7 +726,7 @@ void SIMULATOR_FRAME::onSimFinished( wxCommandEvent& aEvent ) m_simFinished = true; - m_panel->OnSimRefresh( true ); + m_ui->OnSimRefresh( true ); m_schematicFrame->RefreshOperatingPointDisplay(); m_schematicFrame->GetCanvas()->Refresh(); @@ -751,7 +750,7 @@ void SIMULATOR_FRAME::onUpdateSim( wxCommandEvent& aEvent ) if( simulatorLock.owns_lock() ) { - m_panel->OnSimUpdate(); + m_ui->OnSimUpdate(); m_simulator->Run(); } else @@ -765,7 +764,7 @@ void SIMULATOR_FRAME::onUpdateSim( wxCommandEvent& aEvent ) void SIMULATOR_FRAME::onSimReport( wxCommandEvent& aEvent ) { - m_panel->OnSimReport( aEvent.GetString() ); + m_ui->OnSimReport( aEvent.GetString() ); } diff --git a/eeschema/sim/simulator_frame.h b/eeschema/sim/simulator_frame.h index 0b8fbb9c47..2a820cec73 100644 --- a/eeschema/sim/simulator_frame.h +++ b/eeschema/sim/simulator_frame.h @@ -29,7 +29,7 @@ #define SIMULATOR_FRAME_H -#include +#include #include #include @@ -43,7 +43,7 @@ class SCH_EDIT_FRAME; class SCH_SYMBOL; -class SIMULATOR_PANEL; +class SIMULATOR_FRAME_UI; class SIM_THREAD_REPORTER; class ACTION_TOOLBAR; @@ -161,7 +161,7 @@ public: SCH_EDIT_FRAME* GetSchematicFrame() const { return m_schematicFrame; } - std::shared_ptr GetCircuitModel() const { return m_circuitModel; } + std::shared_ptr GetCircuitModel() const { return m_circuitModel; } std::shared_ptr GetSimulator() const { return m_simulator; } @@ -200,16 +200,16 @@ private: void onExit( wxCommandEvent& event ); private: - SCH_EDIT_FRAME* m_schematicFrame; - ACTION_TOOLBAR* m_toolBar; - SIMULATOR_PANEL* m_panel; + SCH_EDIT_FRAME* m_schematicFrame; + ACTION_TOOLBAR* m_toolBar; + SIMULATOR_FRAME_UI* m_ui; - std::shared_ptr m_simulator; - SIM_THREAD_REPORTER* m_reporter; - std::shared_ptr m_circuitModel; + std::shared_ptr m_simulator; + SIM_THREAD_REPORTER* m_reporter; + std::shared_ptr m_circuitModel; - bool m_simFinished; - bool m_workbookModified; + bool m_simFinished; + bool m_workbookModified; }; // Commands diff --git a/eeschema/sim/simulator_panel.cpp b/eeschema/sim/simulator_frame_ui.cpp similarity index 94% rename from eeschema/sim/simulator_panel.cpp rename to eeschema/sim/simulator_frame_ui.cpp index f6cd2535d0..52668ffc40 100644 --- a/eeschema/sim/simulator_panel.cpp +++ b/eeschema/sim/simulator_frame_ui.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -104,7 +104,7 @@ enum class SIGNALS_GRID_TRICKS : public GRID_TRICKS { public: - SIGNALS_GRID_TRICKS( SIMULATOR_PANEL* aParent, WX_GRID* aGrid ) : + SIGNALS_GRID_TRICKS( SIMULATOR_FRAME_UI* aParent, WX_GRID* aGrid ) : GRID_TRICKS( aGrid ), m_parent( aParent ), m_menuRow( 0 ), @@ -116,9 +116,9 @@ protected: void doPopupSelection( wxCommandEvent& event ) override; protected: - SIMULATOR_PANEL* m_parent; - int m_menuRow; - int m_menuCol; + SIMULATOR_FRAME_UI* m_parent; + int m_menuRow; + int m_menuCol; }; @@ -263,7 +263,7 @@ void SIGNALS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event ) class CURSORS_GRID_TRICKS : public GRID_TRICKS { public: - CURSORS_GRID_TRICKS( SIMULATOR_PANEL* aParent, WX_GRID* aGrid ) : + CURSORS_GRID_TRICKS( SIMULATOR_FRAME_UI* aParent, WX_GRID* aGrid ) : GRID_TRICKS( aGrid ), m_parent( aParent ), m_menuRow( 0 ), @@ -275,9 +275,9 @@ protected: void doPopupSelection( wxCommandEvent& event ) override; protected: - SIMULATOR_PANEL* m_parent; - int m_menuRow; - int m_menuCol; + SIMULATOR_FRAME_UI* m_parent; + int m_menuRow; + int m_menuCol; }; @@ -320,7 +320,7 @@ void CURSORS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event ) class MEASUREMENTS_GRID_TRICKS : public GRID_TRICKS { public: - MEASUREMENTS_GRID_TRICKS( SIMULATOR_PANEL* aParent, WX_GRID* aGrid ) : + MEASUREMENTS_GRID_TRICKS( SIMULATOR_FRAME_UI* aParent, WX_GRID* aGrid ) : GRID_TRICKS( aGrid ), m_parent( aParent ), m_menuRow( 0 ), @@ -332,9 +332,9 @@ protected: void doPopupSelection( wxCommandEvent& event ) override; protected: - SIMULATOR_PANEL* m_parent; - int m_menuRow; - int m_menuCol; + SIMULATOR_FRAME_UI* m_parent; + int m_menuRow; + int m_menuCol; }; @@ -421,7 +421,7 @@ void MEASUREMENTS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event ) class SUPPRESS_GRID_CELL_EVENTS { public: - SUPPRESS_GRID_CELL_EVENTS( SIMULATOR_PANEL* aFrame ) : + SUPPRESS_GRID_CELL_EVENTS( SIMULATOR_FRAME_UI* aFrame ) : m_frame( aFrame ) { m_frame->m_SuppressGridEvents++; @@ -433,7 +433,7 @@ public: } private: - SIMULATOR_PANEL* m_frame; + SIMULATOR_FRAME_UI* m_frame; }; @@ -441,9 +441,9 @@ private: #define REFRESH_INTERVAL 50 // 20 frames/second. -SIMULATOR_PANEL::SIMULATOR_PANEL( SIMULATOR_FRAME* aSimulatorFrame, - SCH_EDIT_FRAME* aSchematicFrame ) : - SIMULATOR_PANEL_BASE( aSimulatorFrame ), +SIMULATOR_FRAME_UI::SIMULATOR_FRAME_UI( SIMULATOR_FRAME* aSimulatorFrame, + SCH_EDIT_FRAME* aSchematicFrame ) : + SIMULATOR_FRAME_UI_BASE( aSimulatorFrame ), m_SuppressGridEvents( 0 ), m_simulatorFrame( aSimulatorFrame ), m_schematicFrame( aSchematicFrame ), @@ -493,8 +493,8 @@ SIMULATOR_PANEL::SIMULATOR_PANEL( SIMULATOR_FRAME* aSimulatorFrame, // Prepare the color list to plot traces SIM_PLOT_COLORS::FillDefaultColorList( m_darkMode ); - Bind( EVT_SIM_CURSOR_UPDATE, &SIMULATOR_PANEL::onPlotCursorUpdate, this ); - Bind( EVT_WORKBOOK_MODIFIED, &SIMULATOR_PANEL::onNotebookModified, this ); + Bind( EVT_SIM_CURSOR_UPDATE, &SIMULATOR_FRAME_UI::onPlotCursorUpdate, this ); + Bind( EVT_WORKBOOK_MODIFIED, &SIMULATOR_FRAME_UI::onNotebookModified, this ); Bind( wxEVT_TIMER, [&]( wxTimerEvent& aEvent ) @@ -513,7 +513,7 @@ SIMULATOR_PANEL::SIMULATOR_PANEL( SIMULATOR_FRAME* aSimulatorFrame, } -SIMULATOR_PANEL::~SIMULATOR_PANEL() +SIMULATOR_FRAME_UI::~SIMULATOR_FRAME_UI() { // Delete the GRID_TRICKS. m_signalsGrid->PopEventHandler( true ); @@ -522,7 +522,7 @@ SIMULATOR_PANEL::~SIMULATOR_PANEL() } -void SIMULATOR_PANEL::ShowChangedLanguage() +void SIMULATOR_FRAME_UI::ShowChangedLanguage() { for( int ii = 0; ii < (int) m_plotNotebook->GetPageCount(); ++ii ) { @@ -557,7 +557,7 @@ void SIMULATOR_PANEL::ShowChangedLanguage() } -void SIMULATOR_PANEL::LoadSettings( EESCHEMA_SETTINGS* aCfg ) +void SIMULATOR_FRAME_UI::LoadSettings( EESCHEMA_SETTINGS* aCfg ) { // Read subwindows sizes (should be > 0 ) m_splitterLeftRightSashPosition = aCfg->m_Simulator.plot_panel_width; @@ -569,7 +569,7 @@ void SIMULATOR_PANEL::LoadSettings( EESCHEMA_SETTINGS* aCfg ) } -void SIMULATOR_PANEL::SaveSettings( EESCHEMA_SETTINGS* aCfg ) +void SIMULATOR_FRAME_UI::SaveSettings( EESCHEMA_SETTINGS* aCfg ) { aCfg->m_Simulator.plot_panel_width = m_splitterLeftRight->GetSashPosition(); aCfg->m_Simulator.plot_panel_height = m_splitterPlotAndConsole->GetSashPosition(); @@ -580,7 +580,7 @@ void SIMULATOR_PANEL::SaveSettings( EESCHEMA_SETTINGS* aCfg ) } -void SIMULATOR_PANEL::InitWorkbook() +void SIMULATOR_FRAME_UI::InitWorkbook() { if( !simulator()->Settings()->GetWorkbookFilename().IsEmpty() ) { @@ -603,7 +603,7 @@ void SIMULATOR_PANEL::InitWorkbook() } -void SIMULATOR_PANEL::SetSubWindowsSashSize() +void SIMULATOR_FRAME_UI::SetSubWindowsSashSize() { if( m_splitterLeftRightSashPosition > 0 ) m_splitterLeftRight->SetSashPosition( m_splitterLeftRightSashPosition ); @@ -622,7 +622,7 @@ void SIMULATOR_PANEL::SetSubWindowsSashSize() } -void SIMULATOR_PANEL::rebuildSignalsGrid( wxString aFilter ) +void SIMULATOR_FRAME_UI::rebuildSignalsGrid( wxString aFilter ) { SUPPRESS_GRID_CELL_EVENTS raii( this ); @@ -730,7 +730,7 @@ void SIMULATOR_PANEL::rebuildSignalsGrid( wxString aFilter ) } -void SIMULATOR_PANEL::rebuildSignalsList() +void SIMULATOR_FRAME_UI::rebuildSignalsList() { m_signals.clear(); @@ -870,10 +870,10 @@ void SIMULATOR_PANEL::rebuildSignalsList() } -SIM_TAB* SIMULATOR_PANEL::NewSimTab( const wxString& aSimCommand, unsigned aSimOptions ) +SIM_TAB* SIMULATOR_FRAME_UI::NewSimTab( const wxString& aSimCommand, unsigned aSimOptions ) { SIM_TAB* simTab = nullptr; - SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand ); + SIM_TYPE simType = SPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand ); if( SIM_TAB::IsPlottable( simType ) ) { @@ -898,13 +898,13 @@ SIM_TAB* SIMULATOR_PANEL::NewSimTab( const wxString& aSimCommand, unsigned aSimO } -void SIMULATOR_PANEL::OnFilterText( wxCommandEvent& aEvent ) +void SIMULATOR_FRAME_UI::OnFilterText( wxCommandEvent& aEvent ) { rebuildSignalsGrid( m_filter->GetValue() ); } -void SIMULATOR_PANEL::OnFilterMouseMoved( wxMouseEvent& aEvent ) +void SIMULATOR_FRAME_UI::OnFilterMouseMoved( wxMouseEvent& aEvent ) { wxPoint pos = aEvent.GetPosition(); wxRect ctrlRect = m_filter->GetScreenRect(); @@ -929,8 +929,9 @@ wxString vectorNameFromSignalId( int aUserDefinedSignalId ) * 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. */ -wxString SIMULATOR_PANEL::vectorNameFromSignalName( SIM_PLOT_TAB* aPlotTab, - const wxString& aSignalName, int* aTraceType ) +wxString SIMULATOR_FRAME_UI::vectorNameFromSignalName( SIM_PLOT_TAB* aPlotTab, + const wxString& aSignalName, + int* aTraceType ) { std::map suffixes; suffixes[ _( " (amplitude)" ) ] = SPT_SP_AMP; @@ -985,7 +986,7 @@ wxString SIMULATOR_PANEL::vectorNameFromSignalName( SIM_PLOT_TAB* aPlotTab, }; -void SIMULATOR_PANEL::onSignalsGridCellChanged( wxGridEvent& aEvent ) +void SIMULATOR_FRAME_UI::onSignalsGridCellChanged( wxGridEvent& aEvent ) { if( m_SuppressGridEvents > 0 ) return; @@ -1043,7 +1044,7 @@ void SIMULATOR_PANEL::onSignalsGridCellChanged( wxGridEvent& aEvent ) } -void SIMULATOR_PANEL::onCursorsGridCellChanged( wxGridEvent& aEvent ) +void SIMULATOR_FRAME_UI::onCursorsGridCellChanged( wxGridEvent& aEvent ) { if( m_SuppressGridEvents > 0 ) return; @@ -1091,7 +1092,7 @@ void SIMULATOR_PANEL::onCursorsGridCellChanged( wxGridEvent& aEvent ) } -SPICE_VALUE_FORMAT SIMULATOR_PANEL::GetMeasureFormat( int aRow ) const +SPICE_VALUE_FORMAT SIMULATOR_FRAME_UI::GetMeasureFormat( int aRow ) const { SPICE_VALUE_FORMAT result; result.FromString( m_measurementsGrid->GetCellValue( aRow, COL_MEASUREMENT_FORMAT ) ); @@ -1099,14 +1100,14 @@ SPICE_VALUE_FORMAT SIMULATOR_PANEL::GetMeasureFormat( int aRow ) const } -void SIMULATOR_PANEL::SetMeasureFormat( int aRow, const SPICE_VALUE_FORMAT& aFormat ) +void SIMULATOR_FRAME_UI::SetMeasureFormat( int aRow, const SPICE_VALUE_FORMAT& aFormat ) { m_measurementsGrid->SetCellValue( aRow, COL_MEASUREMENT_FORMAT, aFormat.ToString() ); m_simulatorFrame->OnModify(); } -void SIMULATOR_PANEL::DeleteMeasurement( int aRow ) +void SIMULATOR_FRAME_UI::DeleteMeasurement( int aRow ) { if( aRow < ( m_measurementsGrid->GetNumberRows() - 1 ) ) { @@ -1116,7 +1117,7 @@ void SIMULATOR_PANEL::DeleteMeasurement( int aRow ) } -void SIMULATOR_PANEL::onMeasurementsGridCellChanged( wxGridEvent& aEvent ) +void SIMULATOR_FRAME_UI::onMeasurementsGridCellChanged( wxGridEvent& aEvent ) { SIM_PLOT_TAB* plotTab = dynamic_cast( GetCurrentSimTab() ); @@ -1176,7 +1177,7 @@ void SIMULATOR_PANEL::onMeasurementsGridCellChanged( wxGridEvent& aEvent ) * we want to show: * 15W */ -void SIMULATOR_PANEL::UpdateMeasurement( int aRow ) +void SIMULATOR_FRAME_UI::UpdateMeasurement( int aRow ) { static wxRegEx measureParamsRegEx( wxT( "^" " *" @@ -1271,7 +1272,7 @@ void SIMULATOR_PANEL::UpdateMeasurement( int aRow ) } -void SIMULATOR_PANEL::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol ) +void SIMULATOR_FRAME_UI::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol ) { SIM_PLOT_TAB* plotTab = dynamic_cast( GetCurrentSimTab() ); @@ -1308,8 +1309,8 @@ void SIMULATOR_PANEL::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aS } -void SIMULATOR_PANEL::UpdateTunerValue( const SCH_SHEET_PATH& aSheetPath, const KIID& aSymbol, - const wxString& aRef, const wxString& aValue ) +void SIMULATOR_FRAME_UI::UpdateTunerValue( const SCH_SHEET_PATH& aSheetPath, const KIID& aSymbol, + const wxString& aRef, const wxString& aValue ) { SCH_ITEM* item = aSheetPath.GetItem( aSymbol ); SCH_SYMBOL* symbol = dynamic_cast( item ); @@ -1341,7 +1342,7 @@ void SIMULATOR_PANEL::UpdateTunerValue( const SCH_SHEET_PATH& aSheetPath, const } -void SIMULATOR_PANEL::RemoveTuner( TUNER_SLIDER* aTuner ) +void SIMULATOR_FRAME_UI::RemoveTuner( TUNER_SLIDER* aTuner ) { m_tuners.remove( aTuner ); aTuner->Destroy(); @@ -1350,7 +1351,7 @@ void SIMULATOR_PANEL::RemoveTuner( TUNER_SLIDER* aTuner ) } -void SIMULATOR_PANEL::AddMeasurement( const wxString& aCmd ) +void SIMULATOR_FRAME_UI::AddMeasurement( const wxString& aCmd ) { // -1 because the last one is for user input for( int i = 0; i < m_measurementsGrid->GetNumberRows(); i++ ) @@ -1393,7 +1394,7 @@ void SIMULATOR_PANEL::AddMeasurement( const wxString& aCmd ) } -void SIMULATOR_PANEL::DoFourier( const wxString& aSignal, const wxString& aFundamental ) +void SIMULATOR_FRAME_UI::DoFourier( const wxString& aSignal, const wxString& aFundamental ) { wxString cmd = wxString::Format( wxS( "fourier %s %s" ), SPICE_VALUE( aFundamental ).ToSpiceString(), @@ -1403,13 +1404,13 @@ void SIMULATOR_PANEL::DoFourier( const wxString& aSignal, const wxString& aFunda } -const NGSPICE_CIRCUIT_MODEL* SIMULATOR_PANEL::GetExporter() const +const SPICE_CIRCUIT_MODEL* SIMULATOR_FRAME_UI::GetExporter() const { return circuitModel().get(); } -void SIMULATOR_PANEL::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType ) +void SIMULATOR_FRAME_UI::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType ) { if( !GetCurrentSimTab() ) { @@ -1418,7 +1419,7 @@ void SIMULATOR_PANEL::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType ) return; } - SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( GetCurrentSimTab()->GetSimCommand() ); + SIM_TYPE simType = SPICE_CIRCUIT_MODEL::CommandToSimType( GetCurrentSimTab()->GetSimCommand() ); if( simType == ST_UNKNOWN ) { @@ -1456,7 +1457,7 @@ void SIMULATOR_PANEL::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType ) } -void SIMULATOR_PANEL::SetUserDefinedSignals( const std::map& aNewSignals ) +void SIMULATOR_FRAME_UI::SetUserDefinedSignals( const std::map& aNewSignals ) { for( size_t ii = 0; ii < m_plotNotebook->GetPageCount(); ++ii ) { @@ -1527,10 +1528,10 @@ void SIMULATOR_PANEL::SetUserDefinedSignals( const std::map& aNew } -void SIMULATOR_PANEL::updateTrace( const wxString& aVectorName, int aTraceType, - SIM_PLOT_TAB* aPlotTab ) +void SIMULATOR_FRAME_UI::updateTrace( const wxString& aVectorName, int aTraceType, + SIM_PLOT_TAB* aPlotTab ) { - SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aPlotTab->GetSimCommand() ); + SIM_TYPE simType = SPICE_CIRCUIT_MODEL::CommandToSimType( aPlotTab->GetSimCommand() ); aTraceType &= aTraceType & SPT_Y_AXIS_MASK; aTraceType |= getXAxisType( simType ); @@ -1637,7 +1638,7 @@ void SIMULATOR_PANEL::updateTrace( const wxString& aVectorName, int aTraceType, } -void SIMULATOR_PANEL::updateSignalsGrid() +void SIMULATOR_FRAME_UI::updateSignalsGrid() { SIM_PLOT_TAB* plotTab = dynamic_cast( GetCurrentSimTab() ); @@ -1705,7 +1706,7 @@ void SIMULATOR_PANEL::updateSignalsGrid() } -void SIMULATOR_PANEL::applyUserDefinedSignals() +void SIMULATOR_FRAME_UI::applyUserDefinedSignals() { auto quoteNetNames = [&]( wxString aExpression ) -> wxString @@ -1726,7 +1727,7 @@ void SIMULATOR_PANEL::applyUserDefinedSignals() } -void SIMULATOR_PANEL::applyTuners() +void SIMULATOR_FRAME_UI::applyTuners() { wxString errors; WX_STRING_REPORTER reporter( &errors ); @@ -1763,8 +1764,8 @@ void SIMULATOR_PANEL::applyTuners() } -void SIMULATOR_PANEL::parseTraceParams( SIM_PLOT_TAB* aPlotTab, TRACE* aTrace, - const wxString& aSignalName, const wxString& aParams ) +void SIMULATOR_FRAME_UI::parseTraceParams( SIM_PLOT_TAB* aPlotTab, TRACE* aTrace, + const wxString& aSignalName, const wxString& aParams ) { auto addCursor = [&]( int aCursorId, double x ) @@ -1838,7 +1839,7 @@ void SIMULATOR_PANEL::parseTraceParams( SIM_PLOT_TAB* aPlotTab, TRACE* aTrace, } -bool SIMULATOR_PANEL::LoadWorkbook( const wxString& aPath ) +bool SIMULATOR_FRAME_UI::LoadWorkbook( const wxString& aPath ) { m_plotNotebook->DeleteAllPages(); @@ -2092,7 +2093,7 @@ bool SIMULATOR_PANEL::LoadWorkbook( const wxString& aPath ) } -bool SIMULATOR_PANEL::SaveWorkbook( const wxString& aPath ) +bool SIMULATOR_FRAME_UI::SaveWorkbook( const wxString& aPath ) { wxFileName filename = aPath; filename.SetExt( WorkbookFileExtension ); @@ -2259,7 +2260,7 @@ bool SIMULATOR_PANEL::SaveWorkbook( const wxString& aPath ) } -SIM_TRACE_TYPE SIMULATOR_PANEL::getXAxisType( SIM_TYPE aType ) const +SIM_TRACE_TYPE SIMULATOR_FRAME_UI::getXAxisType( SIM_TYPE aType ) const { switch( aType ) { @@ -2275,7 +2276,7 @@ SIM_TRACE_TYPE SIMULATOR_PANEL::getXAxisType( SIM_TYPE aType ) const } -wxString SIMULATOR_PANEL::getNoiseSource() const +wxString SIMULATOR_FRAME_UI::getNoiseSource() const { wxString output; wxString ref; @@ -2296,7 +2297,7 @@ wxString SIMULATOR_PANEL::getNoiseSource() const } -void SIMULATOR_PANEL::ToggleDarkModePlots() +void SIMULATOR_FRAME_UI::ToggleDarkModePlots() { m_darkMode = !m_darkMode; @@ -2318,12 +2319,12 @@ void SIMULATOR_PANEL::ToggleDarkModePlots() } -void SIMULATOR_PANEL::onPlotClose( wxAuiNotebookEvent& event ) +void SIMULATOR_FRAME_UI::onPlotClose( wxAuiNotebookEvent& event ) { } -void SIMULATOR_PANEL::onPlotClosed( wxAuiNotebookEvent& event ) +void SIMULATOR_FRAME_UI::onPlotClosed( wxAuiNotebookEvent& event ) { CallAfter( [this]() { @@ -2344,7 +2345,7 @@ void SIMULATOR_PANEL::onPlotClosed( wxAuiNotebookEvent& event ) } -void SIMULATOR_PANEL::onPlotChanging( wxAuiNotebookEvent& event ) +void SIMULATOR_FRAME_UI::onPlotChanging( wxAuiNotebookEvent& event ) { if( SIM_PLOT_TAB* plotTab = dynamic_cast( GetCurrentSimTab() ) ) { @@ -2366,7 +2367,7 @@ void SIMULATOR_PANEL::onPlotChanging( wxAuiNotebookEvent& event ) } -void SIMULATOR_PANEL::OnPlotSettingsChanged() +void SIMULATOR_FRAME_UI::OnPlotSettingsChanged() { rebuildSignalsList(); rebuildSignalsGrid( m_filter->GetValue() ); @@ -2379,7 +2380,7 @@ void SIMULATOR_PANEL::OnPlotSettingsChanged() } -void SIMULATOR_PANEL::onPlotChanged( wxAuiNotebookEvent& event ) +void SIMULATOR_FRAME_UI::onPlotChanged( wxAuiNotebookEvent& event ) { if( SIM_TAB* simTab = GetCurrentSimTab() ) simulator()->Command( "setplot " + simTab->GetSpicePlotName().ToStdString() ); @@ -2390,7 +2391,7 @@ void SIMULATOR_PANEL::onPlotChanged( wxAuiNotebookEvent& event ) } -void SIMULATOR_PANEL::rebuildMeasurementsGrid() +void SIMULATOR_FRAME_UI::rebuildMeasurementsGrid() { m_measurementsGrid->ClearRows(); @@ -2413,31 +2414,31 @@ void SIMULATOR_PANEL::rebuildMeasurementsGrid() } -void SIMULATOR_PANEL::onPlotDragged( wxAuiNotebookEvent& event ) +void SIMULATOR_FRAME_UI::onPlotDragged( wxAuiNotebookEvent& event ) { } -void SIMULATOR_PANEL::onNotebookModified( wxCommandEvent& event ) +void SIMULATOR_FRAME_UI::onNotebookModified( wxCommandEvent& event ) { m_simulatorFrame->OnModify(); m_simulatorFrame->UpdateTitle(); } -std::shared_ptr SIMULATOR_PANEL::simulator() const +std::shared_ptr SIMULATOR_FRAME_UI::simulator() const { return m_simulatorFrame->GetSimulator(); } -std::shared_ptr SIMULATOR_PANEL::circuitModel() const +std::shared_ptr SIMULATOR_FRAME_UI::circuitModel() const { return m_simulatorFrame->GetCircuitModel(); } -void SIMULATOR_PANEL::updatePlotCursors() +void SIMULATOR_FRAME_UI::updatePlotCursors() { SUPPRESS_GRID_CELL_EVENTS raii( this ); @@ -2572,14 +2573,14 @@ void SIMULATOR_PANEL::updatePlotCursors() } -void SIMULATOR_PANEL::onPlotCursorUpdate( wxCommandEvent& aEvent ) +void SIMULATOR_FRAME_UI::onPlotCursorUpdate( wxCommandEvent& aEvent ) { updatePlotCursors(); m_simulatorFrame->OnModify(); } -void SIMULATOR_PANEL::OnSimUpdate() +void SIMULATOR_FRAME_UI::OnSimUpdate() { if( SIM_PLOT_TAB* plotTab = dynamic_cast( GetCurrentSimTab() ) ) plotTab->ResetScales( true ); @@ -2593,14 +2594,14 @@ void SIMULATOR_PANEL::OnSimUpdate() } -void SIMULATOR_PANEL::OnSimReport( const wxString& aMsg ) +void SIMULATOR_FRAME_UI::OnSimReport( const wxString& aMsg ) { m_simConsole->AppendText( aMsg + "\n" ); m_simConsole->SetInsertionPointEnd(); } -std::vector SIMULATOR_PANEL::SimPlotVectors() const +std::vector SIMULATOR_FRAME_UI::SimPlotVectors() const { std::vector signals; @@ -2611,7 +2612,7 @@ std::vector SIMULATOR_PANEL::SimPlotVectors() const } -std::vector SIMULATOR_PANEL::Signals() const +std::vector SIMULATOR_FRAME_UI::Signals() const { std::vector signals; @@ -2625,7 +2626,7 @@ std::vector SIMULATOR_PANEL::Signals() const } -void SIMULATOR_PANEL::OnSimRefresh( bool aFinal ) +void SIMULATOR_FRAME_UI::OnSimRefresh( bool aFinal ) { SIM_TAB* simTab = GetCurrentSimTab(); diff --git a/eeschema/sim/simulator_panel.h b/eeschema/sim/simulator_frame_ui.h similarity index 94% rename from eeschema/sim/simulator_panel.h rename to eeschema/sim/simulator_frame_ui.h index d465660b39..9d420eecd9 100644 --- a/eeschema/sim/simulator_panel.h +++ b/eeschema/sim/simulator_frame_ui.h @@ -25,11 +25,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef SIMULATOR_PANEL_H -#define SIMULATOR_PANEL_H +#ifndef SIMULATOR_FRAME_UI_H +#define SIMULATOR_FRAME_UI_H -#include +#include #include #include @@ -39,9 +39,9 @@ class SCH_EDIT_FRAME; class SCH_SYMBOL; class SPICE_SIMULATOR; -class SPICE_SIMULATOR_SETTINGS; +class SPICE_SETTINGS; class EESCHEMA_SETTINGS; -class NGSPICE_CIRCUIT_MODEL; +class SPICE_CIRCUIT_MODEL; class SIM_THREAD_REPORTER; class TUNER_SLIDER; @@ -49,7 +49,7 @@ class TUNER_SLIDER; /** * - * The SIMULATOR_PANEL holds the main user-interface for running simulations. + * The SIMULATOR_FRAME_UI holds the main user-interface for running simulations. * * It contains a workbook with multiple tabs, each tab holding a SIM_PLOT_TAB, a specific * simulation command (.TRAN, .AC, etc.), and simulation settings (save all currents, etc.). @@ -66,11 +66,11 @@ class TUNER_SLIDER; */ -class SIMULATOR_PANEL : public SIMULATOR_PANEL_BASE +class SIMULATOR_FRAME_UI : public SIMULATOR_FRAME_UI_BASE { public: - SIMULATOR_PANEL( SIMULATOR_FRAME* aSimulatorFrame, SCH_EDIT_FRAME* aSchematicFrame ); - ~SIMULATOR_PANEL(); + SIMULATOR_FRAME_UI( SIMULATOR_FRAME* aSimulatorFrame, SCH_EDIT_FRAME* aSchematicFrame ); + ~SIMULATOR_FRAME_UI(); /** * Create a new simulation tab for a given simulation type. @@ -160,7 +160,7 @@ public: /** * Return the netlist exporter object used for simulations. */ - const NGSPICE_CIRCUIT_MODEL* GetExporter() const; + const SPICE_CIRCUIT_MODEL* GetExporter() const; bool DarkModePlots() const { return m_darkMode; } void ToggleDarkModePlots(); @@ -290,7 +290,7 @@ private: const wxString& aParams ); std::shared_ptr simulator() const; - std::shared_ptr circuitModel() const; + std::shared_ptr circuitModel() const; // Event handlers void onPlotClose( wxAuiNotebookEvent& event ) override; @@ -338,4 +338,4 @@ private: wxTimer m_refreshTimer; }; -#endif // SIMULATOR_PANEL_H +#endif // SIMULATOR_FRAME_UI_H diff --git a/eeschema/sim/simulator_panel_base.cpp b/eeschema/sim/simulator_frame_ui_base.cpp similarity index 85% rename from eeschema/sim/simulator_panel_base.cpp rename to eeschema/sim/simulator_frame_ui_base.cpp index cd6ad26b30..7a3b5c7643 100644 --- a/eeschema/sim/simulator_panel_base.cpp +++ b/eeschema/sim/simulator_frame_ui_base.cpp @@ -7,18 +7,18 @@ #include "widgets/wx_grid.h" -#include "simulator_panel_base.h" +#include "simulator_frame_ui_base.h" /////////////////////////////////////////////////////////////////////////// -SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +SIMULATOR_FRAME_UI_BASE::SIMULATOR_FRAME_UI_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) { wxBoxSizer* sizerMain; sizerMain = new wxBoxSizer( wxVERTICAL ); m_splitterLeftRight = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE ); m_splitterLeftRight->SetSashGravity( 0.7 ); - m_splitterLeftRight->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterLeftRightOnIdle ), NULL, this ); + m_splitterLeftRight->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterLeftRightOnIdle ), NULL, this ); m_splitterLeftRight->SetMinimumPaneSize( 50 ); m_panelLeft = new wxPanel( m_splitterLeftRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); @@ -28,7 +28,7 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con m_splitterPlotAndConsole = new wxSplitterWindow( m_panelLeft, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE ); m_splitterPlotAndConsole->SetSashGravity( 0.8 ); - m_splitterPlotAndConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this ); + m_splitterPlotAndConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this ); m_splitterPlotAndConsole->SetMinimumPaneSize( 50 ); m_plotPanel = new wxPanel( m_splitterPlotAndConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); @@ -75,7 +75,7 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con m_splitterSignals = new wxSplitterWindow( m_sidePanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE ); m_splitterSignals->SetSashGravity( 0.5 ); - m_splitterSignals->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterSignalsOnIdle ), NULL, this ); + m_splitterSignals->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterSignalsOnIdle ), NULL, this ); m_splitterSignals->SetMinimumPaneSize( 20 ); m_panelSignals = new wxPanel( m_splitterSignals, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); @@ -139,7 +139,7 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con m_splitterCursors = new wxSplitterWindow( m_panelCMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE ); m_splitterCursors->SetSashGravity( 0.2 ); - m_splitterCursors->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterCursorsOnIdle ), NULL, this ); + m_splitterCursors->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterCursorsOnIdle ), NULL, this ); m_splitterCursors->SetMinimumPaneSize( 20 ); m_panelCursors = new wxPanel( m_splitterCursors, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); @@ -194,7 +194,7 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con m_splitterMeasurements = new wxSplitterWindow( m_panelMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE ); m_splitterMeasurements->SetSashGravity( 0.2 ); - m_splitterMeasurements->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterMeasurementsOnIdle ), NULL, this ); + m_splitterMeasurements->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterMeasurementsOnIdle ), NULL, this ); m_splitterMeasurements->SetMinimumPaneSize( 20 ); m_panelMeasurements = new wxPanel( m_splitterMeasurements, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); @@ -278,30 +278,30 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con sizerMain->Fit( this ); // Connect Events - m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotDragged ), NULL, this ); - m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotChanged ), NULL, this ); - m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotChanging ), NULL, this ); - m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotClose ), NULL, this ); - m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotClosed ), NULL, this ); - m_filter->Connect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_PANEL_BASE::OnFilterMouseMoved ), NULL, this ); - m_filter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_PANEL_BASE::OnFilterText ), NULL, this ); - m_signalsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onSignalsGridCellChanged ), NULL, this ); - m_cursorsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onCursorsGridCellChanged ), NULL, this ); - m_measurementsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onMeasurementsGridCellChanged ), NULL, this ); + m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotDragged ), NULL, this ); + m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotChanged ), NULL, this ); + m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotChanging ), NULL, this ); + m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotClose ), NULL, this ); + m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotClosed ), NULL, this ); + m_filter->Connect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_FRAME_UI_BASE::OnFilterMouseMoved ), NULL, this ); + m_filter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_FRAME_UI_BASE::OnFilterText ), NULL, this ); + m_signalsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onSignalsGridCellChanged ), NULL, this ); + m_cursorsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onCursorsGridCellChanged ), NULL, this ); + m_measurementsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onMeasurementsGridCellChanged ), NULL, this ); } -SIMULATOR_PANEL_BASE::~SIMULATOR_PANEL_BASE() +SIMULATOR_FRAME_UI_BASE::~SIMULATOR_FRAME_UI_BASE() { // Disconnect Events - m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotDragged ), NULL, this ); - m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotChanged ), NULL, this ); - m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotChanging ), NULL, this ); - m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotClose ), NULL, this ); - m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotClosed ), NULL, this ); - m_filter->Disconnect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_PANEL_BASE::OnFilterMouseMoved ), NULL, this ); - m_filter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_PANEL_BASE::OnFilterText ), NULL, this ); - m_signalsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onSignalsGridCellChanged ), NULL, this ); - m_cursorsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onCursorsGridCellChanged ), NULL, this ); - m_measurementsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onMeasurementsGridCellChanged ), NULL, this ); + m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotDragged ), NULL, this ); + m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotChanged ), NULL, this ); + m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotChanging ), NULL, this ); + m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotClose ), NULL, this ); + m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotClosed ), NULL, this ); + m_filter->Disconnect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_FRAME_UI_BASE::OnFilterMouseMoved ), NULL, this ); + m_filter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_FRAME_UI_BASE::OnFilterText ), NULL, this ); + m_signalsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onSignalsGridCellChanged ), NULL, this ); + m_cursorsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onCursorsGridCellChanged ), NULL, this ); + m_measurementsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onMeasurementsGridCellChanged ), NULL, this ); } diff --git a/eeschema/sim/simulator_panel_base.fbp b/eeschema/sim/simulator_frame_ui_base.fbp similarity index 99% rename from eeschema/sim/simulator_panel_base.fbp rename to eeschema/sim/simulator_frame_ui_base.fbp index 1f954d0883..1cee77b8a3 100644 --- a/eeschema/sim/simulator_panel_base.fbp +++ b/eeschema/sim/simulator_frame_ui_base.fbp @@ -11,13 +11,13 @@ . UTF-8 connect - simulator_panel_base + simulator_frame_ui_base 1000 none 1 - SIMULATOR_PANEL_BASE + SIMULATOR_FRAME_UI_BASE . @@ -43,7 +43,7 @@ wxID_ANY - SIMULATOR_PANEL_BASE + SIMULATOR_FRAME_UI_BASE -1,-1 ; ; forward_declare diff --git a/eeschema/sim/simulator_panel_base.h b/eeschema/sim/simulator_frame_ui_base.h similarity index 83% rename from eeschema/sim/simulator_panel_base.h rename to eeschema/sim/simulator_frame_ui_base.h index f0ddc5e6a1..80578f6bab 100644 --- a/eeschema/sim/simulator_panel_base.h +++ b/eeschema/sim/simulator_frame_ui_base.h @@ -30,9 +30,9 @@ class WX_GRID; /////////////////////////////////////////////////////////////////////////////// -/// Class SIMULATOR_PANEL_BASE +/// Class SIMULATOR_FRAME_UI_BASE /////////////////////////////////////////////////////////////////////////////// -class SIMULATOR_PANEL_BASE : public wxPanel +class SIMULATOR_FRAME_UI_BASE : public wxPanel { private: @@ -79,38 +79,38 @@ class SIMULATOR_PANEL_BASE : public wxPanel public: - SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + SIMULATOR_FRAME_UI_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); - ~SIMULATOR_PANEL_BASE(); + ~SIMULATOR_FRAME_UI_BASE(); void m_splitterLeftRightOnIdle( wxIdleEvent& ) { m_splitterLeftRight->SetSashPosition( 700 ); - m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterLeftRightOnIdle ), NULL, this ); + m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterLeftRightOnIdle ), NULL, this ); } void m_splitterPlotAndConsoleOnIdle( wxIdleEvent& ) { m_splitterPlotAndConsole->SetSashPosition( 500 ); - m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this ); + m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this ); } void m_splitterSignalsOnIdle( wxIdleEvent& ) { m_splitterSignals->SetSashPosition( 0 ); - m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterSignalsOnIdle ), NULL, this ); + m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterSignalsOnIdle ), NULL, this ); } void m_splitterCursorsOnIdle( wxIdleEvent& ) { m_splitterCursors->SetSashPosition( 0 ); - m_splitterCursors->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterCursorsOnIdle ), NULL, this ); + m_splitterCursors->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterCursorsOnIdle ), NULL, this ); } void m_splitterMeasurementsOnIdle( wxIdleEvent& ) { m_splitterMeasurements->SetSashPosition( 0 ); - m_splitterMeasurements->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterMeasurementsOnIdle ), NULL, this ); + m_splitterMeasurements->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterMeasurementsOnIdle ), NULL, this ); } }; diff --git a/eeschema/sim/spice_reporter.h b/eeschema/sim/simulator_reporter.h similarity index 79% rename from eeschema/sim/spice_reporter.h rename to eeschema/sim/simulator_reporter.h index a983d09bc4..8c4baa2b4c 100644 --- a/eeschema/sim/spice_reporter.h +++ b/eeschema/sim/simulator_reporter.h @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN +* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -22,12 +23,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef SPICE_REPORTER_H -#define SPICE_REPORTER_H +#ifndef SIM_REPORTER_H +#define SIM_REPORTER_H #include -class SPICE_SIMULATOR; +class SIMULATOR; enum SIM_STATE { @@ -38,14 +39,14 @@ enum SIM_STATE /** * @brief Interface to receive simulation updates from SPICE_SIMULATOR class. */ -class SPICE_REPORTER : public REPORTER +class SIMULATOR_REPORTER : public REPORTER { public: - virtual ~SPICE_REPORTER() + virtual ~SIMULATOR_REPORTER() { } - virtual void OnSimStateChange( SPICE_SIMULATOR* aObject, SIM_STATE aNewState ) = 0; + virtual void OnSimStateChange( SIMULATOR* aObject, SIM_STATE aNewState ) = 0; }; -#endif /* SPICE_REPORTER_H */ +#endif /* SIM_REPORTER_H */ diff --git a/eeschema/sim/ngspice_circuit_model.cpp b/eeschema/sim/spice_circuit_model.cpp similarity index 82% rename from eeschema/sim/ngspice_circuit_model.cpp rename to eeschema/sim/spice_circuit_model.cpp index b2db460f30..7b9bbded67 100644 --- a/eeschema/sim/ngspice_circuit_model.cpp +++ b/eeschema/sim/spice_circuit_model.cpp @@ -23,15 +23,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "ngspice_circuit_model.h" +#include "spice_circuit_model.h" #include // for TO_UTF8 def #include #include #include -SIM_TRACE_TYPE NGSPICE_CIRCUIT_MODEL::VectorToSignal( const std::string& aVector, - wxString& aSignal ) const +SIM_TRACE_TYPE SPICE_CIRCUIT_MODEL::VectorToSignal( const std::string& aVector, + wxString& aSignal ) const { static wxString BRANCH( wxS( "#branch" ) ); // See ngspice manual chapt. 31.1 "Accessing internal device parameters" @@ -72,7 +72,7 @@ SIM_TRACE_TYPE NGSPICE_CIRCUIT_MODEL::VectorToSignal( const std::string& aVector } -wxString NGSPICE_CIRCUIT_MODEL::GetSchTextSimCommand() +wxString SPICE_CIRCUIT_MODEL::GetSchTextSimCommand() { wxString simCmd; @@ -88,7 +88,7 @@ wxString NGSPICE_CIRCUIT_MODEL::GetSchTextSimCommand() } -SIM_TYPE NGSPICE_CIRCUIT_MODEL::CommandToSimType( const wxString& aCmd ) +SIM_TYPE SPICE_CIRCUIT_MODEL::CommandToSimType( const wxString& aCmd ) { wxString cmd = aCmd.Lower().Trim(); @@ -107,8 +107,8 @@ SIM_TYPE NGSPICE_CIRCUIT_MODEL::CommandToSimType( const wxString& aCmd ) } -bool NGSPICE_CIRCUIT_MODEL::ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAMS* aSource1, - SPICE_DC_PARAMS* aSource2 ) +bool SPICE_CIRCUIT_MODEL::ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAMS* aSource1, + SPICE_DC_PARAMS* aSource2 ) { if( !aCmd.Lower().StartsWith( ".dc" ) ) return false; @@ -130,10 +130,9 @@ bool NGSPICE_CIRCUIT_MODEL::ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAM } -bool NGSPICE_CIRCUIT_MODEL::ParsePZCommand( const wxString& aCmd, wxString* transferFunction, - wxString* input, wxString* inputRef, - wxString* output, wxString* outputRef, - SPICE_PZ_ANALYSES* analyses ) +bool SPICE_CIRCUIT_MODEL::ParsePZCommand( const wxString& aCmd, wxString* transferFunction, + wxString* input, wxString* inputRef, wxString* output, + wxString* outputRef, SPICE_PZ_ANALYSES* analyses ) { if( !aCmd.Lower().StartsWith( wxS( ".pz" ) ) ) return false; @@ -172,10 +171,10 @@ bool NGSPICE_CIRCUIT_MODEL::ParsePZCommand( const wxString& aCmd, wxString* tran return true; } -bool NGSPICE_CIRCUIT_MODEL::ParseNoiseCommand( const wxString& aCmd, wxString* aOutput, - wxString* aRef, wxString* aSource, wxString* aScale, - SPICE_VALUE* aPts, SPICE_VALUE* aFStart, - SPICE_VALUE* aFStop, bool* aSaveAll ) +bool SPICE_CIRCUIT_MODEL::ParseNoiseCommand( const wxString& aCmd, wxString* aOutput, + wxString* aRef, wxString* aSource, wxString* aScale, + SPICE_VALUE* aPts, SPICE_VALUE* aFStart, + SPICE_VALUE* aFStop, bool* aSaveAll ) { if( !aCmd.Lower().StartsWith( wxS( ".noise" ) ) ) return false; @@ -237,8 +236,8 @@ bool NGSPICE_CIRCUIT_MODEL::ParseNoiseCommand( const wxString& aCmd, wxString* a } -void NGSPICE_CIRCUIT_MODEL::WriteDirectives( const wxString& aSimCommand, unsigned aSimOptions, - OUTPUTFORMATTER& aFormatter ) const +void SPICE_CIRCUIT_MODEL::WriteDirectives( const wxString& aSimCommand, unsigned aSimOptions, + OUTPUTFORMATTER& aFormatter ) const { if( aSimCommand.IsEmpty() ) aSimOptions |= OPTION_SIM_COMMAND; diff --git a/eeschema/sim/ngspice_circuit_model.h b/eeschema/sim/spice_circuit_model.h similarity index 85% rename from eeschema/sim/ngspice_circuit_model.h rename to eeschema/sim/spice_circuit_model.h index b7cf4ef47f..ea7df4d343 100644 --- a/eeschema/sim/ngspice_circuit_model.h +++ b/eeschema/sim/spice_circuit_model.h @@ -24,8 +24,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef NGSPICE_CIRCUIT_MODEL_H -#define NGSPICE_CIRCUIT_MODEL_H +#ifndef SPICE_CIRCUIT_MODEL_H +#define SPICE_CIRCUIT_MODEL_H #include #include @@ -51,14 +51,14 @@ struct SPICE_PZ_ANALYSES }; /// Special netlist exporter flavor that allows one to override simulation commands -class NGSPICE_CIRCUIT_MODEL : public NETLIST_EXPORTER_SPICE, public SIMULATION_MODEL +class SPICE_CIRCUIT_MODEL : public NETLIST_EXPORTER_SPICE, public SIMULATION_MODEL { public: - NGSPICE_CIRCUIT_MODEL( SCHEMATIC_IFACE* aSchematic, wxWindow* aDialogParent = nullptr ) : + SPICE_CIRCUIT_MODEL( SCHEMATIC_IFACE* aSchematic, wxWindow* aDialogParent = nullptr ) : NETLIST_EXPORTER_SPICE( aSchematic, aDialogParent ) {} - virtual ~NGSPICE_CIRCUIT_MODEL() {} + virtual ~SPICE_CIRCUIT_MODEL() {} /** * Return name of Spice dataset for a specific trace. @@ -70,11 +70,10 @@ public: */ SIM_TRACE_TYPE VectorToSignal( const std::string& aVector, wxString& aSignal ) const; - bool GetNetlist( const wxString& aSimCommand, unsigned aSimOptions, - OUTPUTFORMATTER* aFormatter, REPORTER& aReporter ) + bool GetNetlist( const wxString& aCommand, unsigned aOptions, OUTPUTFORMATTER* aFormatter, + REPORTER& aReporter ) { - return NGSPICE_CIRCUIT_MODEL::DoWriteNetlist( aSimCommand, aSimOptions, *aFormatter, - aReporter ); + return SPICE_CIRCUIT_MODEL::DoWriteNetlist( aCommand, aOptions, *aFormatter, aReporter ); } /** @@ -117,4 +116,4 @@ protected: OUTPUTFORMATTER& aFormatter ) const override; }; -#endif /* NGSPICE_CIRCUIT_MODEL_H */ +#endif /* SPICE_CIRCUIT_MODEL_H */ diff --git a/eeschema/sim/spice_settings.cpp b/eeschema/sim/spice_settings.cpp index 1e1b29716f..71a65e1e5f 100644 --- a/eeschema/sim/spice_settings.cpp +++ b/eeschema/sim/spice_settings.cpp @@ -31,42 +31,38 @@ const int spiceSettingsSchemaVersion = 0; -SPICE_SIMULATOR_SETTINGS::SPICE_SIMULATOR_SETTINGS( JSON_SETTINGS* aParent, - const std::string& aPath ) : - NESTED_SETTINGS( "simulator", spiceSettingsSchemaVersion, aParent, aPath ), - m_fixIncludePaths( true ) +SPICE_SETTINGS::SPICE_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) : + NESTED_SETTINGS( "simulator", spiceSettingsSchemaVersion, aParent, aPath ), + m_fixIncludePaths( true ) { m_params.emplace_back( new PARAM( "workbook_filename", &m_workbookFilename, "" ) ); m_params.emplace_back( new PARAM( "fix_include_paths", &m_fixIncludePaths, true ) ); } -bool SPICE_SIMULATOR_SETTINGS::operator==( const SPICE_SIMULATOR_SETTINGS &aRhs ) const +bool SPICE_SETTINGS::operator==( const SPICE_SETTINGS&aRhs ) const { return m_workbookFilename == aRhs.m_workbookFilename - && m_fixIncludePaths == aRhs.m_fixIncludePaths; + && m_fixIncludePaths == aRhs.m_fixIncludePaths; } -NGSPICE_SIMULATOR_SETTINGS::NGSPICE_SIMULATOR_SETTINGS( JSON_SETTINGS* aParent, - const std::string& aPath ) : - SPICE_SIMULATOR_SETTINGS( aParent, aPath ), - m_modelMode( NGSPICE_MODEL_MODE::LT_PSPICE ) +NGSPICE_SETTINGS::NGSPICE_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) : + SPICE_SETTINGS( aParent, aPath ), + m_compatibilityMode( NGSPICE_COMPATIBILITY_MODE::LT_PSPICE ) { - m_params.emplace_back( new PARAM_ENUM( "model_mode", &m_modelMode, - NGSPICE_MODEL_MODE::LT_PSPICE, - NGSPICE_MODEL_MODE::USER_CONFIG, - NGSPICE_MODEL_MODE::HSPICE ) ); + m_params.emplace_back( new PARAM_ENUM( "model_mode", + &m_compatibilityMode, NGSPICE_COMPATIBILITY_MODE::LT_PSPICE, + NGSPICE_COMPATIBILITY_MODE::USER_CONFIG, NGSPICE_COMPATIBILITY_MODE::HSPICE ) ); } -bool NGSPICE_SIMULATOR_SETTINGS::operator==( const SPICE_SIMULATOR_SETTINGS& aRhs ) const +bool NGSPICE_SETTINGS::operator==( const SPICE_SETTINGS& aRhs ) const { - const NGSPICE_SIMULATOR_SETTINGS* settings = - dynamic_cast( &aRhs ); + const NGSPICE_SETTINGS* settings = dynamic_cast( &aRhs ); wxCHECK( settings, false ); - return ( *static_cast( this ) ) == aRhs - && m_modelMode == settings->m_modelMode; + return SPICE_SETTINGS::operator==( aRhs ) + && m_compatibilityMode == settings->m_compatibilityMode; } diff --git a/eeschema/sim/spice_settings.h b/eeschema/sim/spice_settings.h index 91e961efe2..3cd768f765 100644 --- a/eeschema/sim/spice_settings.h +++ b/eeschema/sim/spice_settings.h @@ -33,16 +33,16 @@ /** * Storage for simulator specific settings. */ -class SPICE_SIMULATOR_SETTINGS : public NESTED_SETTINGS +class SPICE_SETTINGS : public NESTED_SETTINGS { public: - SPICE_SIMULATOR_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ); + SPICE_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ); - virtual ~SPICE_SIMULATOR_SETTINGS() {} + virtual ~SPICE_SETTINGS() {} - virtual bool operator==( const SPICE_SIMULATOR_SETTINGS& aRhs ) const = 0; + virtual bool operator==( const SPICE_SETTINGS& aRhs ) const = 0; - bool operator!=( const SPICE_SIMULATOR_SETTINGS& aRhs ) const { return !( *this == aRhs ); } + bool operator!=( const SPICE_SETTINGS& aRhs ) const { return !( *this == aRhs ); } wxString GetWorkbookFilename() const { return m_workbookFilename; } void SetWorkbookFilename( const wxString& aFilename ) { m_workbookFilename = aFilename; } @@ -59,11 +59,12 @@ private: }; /** - * Ngspice simulator model compatibility modes. + * Ngspice simulator compatibility modes. * * @note The ngspice model modes are mutually exclusive. */ -enum class NGSPICE_MODEL_MODE { +enum class NGSPICE_COMPATIBILITY_MODE +{ USER_CONFIG, NGSPICE, PSPICE, @@ -76,19 +77,19 @@ enum class NGSPICE_MODEL_MODE { /** * Container for Ngspice simulator settings. */ -class NGSPICE_SIMULATOR_SETTINGS : public SPICE_SIMULATOR_SETTINGS +class NGSPICE_SETTINGS : public SPICE_SETTINGS { public: - NGSPICE_SIMULATOR_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ); - virtual ~NGSPICE_SIMULATOR_SETTINGS() {} + NGSPICE_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ); + virtual ~NGSPICE_SETTINGS() {} - bool operator==( const SPICE_SIMULATOR_SETTINGS& aRhs ) const override; + bool operator==( const SPICE_SETTINGS& aRhs ) const override; - NGSPICE_MODEL_MODE GetModelMode() const { return m_modelMode; } - void SetModelMode( NGSPICE_MODEL_MODE aMode ) { m_modelMode = aMode; } + NGSPICE_COMPATIBILITY_MODE GetCompatibilityMode() const { return m_compatibilityMode; } + void SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE aMode ) { m_compatibilityMode = aMode; } private: - NGSPICE_MODEL_MODE m_modelMode; + NGSPICE_COMPATIBILITY_MODE m_compatibilityMode; }; diff --git a/eeschema/sim/spice_simulator.h b/eeschema/sim/spice_simulator.h index 82944f460e..bd926216b1 100644 --- a/eeschema/sim/spice_simulator.h +++ b/eeschema/sim/spice_simulator.h @@ -39,7 +39,7 @@ #include -class SPICE_REPORTER; +class SIMULATOR_REPORTER; typedef std::complex COMPLEX; @@ -61,7 +61,7 @@ public: * @param aSettings [in] are the simulator specific settings. Can be null if no settings need * to be initialized. */ - virtual void Init( const SPICE_SIMULATOR_SETTINGS* aSettings = nullptr ) = 0; + virtual void Init( const SPICE_SETTINGS* aSettings = nullptr ) = 0; /** * Load a netlist for the simulation. @@ -80,8 +80,8 @@ public: ///< Return X axis name for a given simulation type virtual wxString GetXAxis( SIM_TYPE aType ) const = 0; - ///< Set a #SPICE_REPORTER object to receive the simulation log. - virtual void SetReporter( SPICE_REPORTER* aReporter ) + ///< Set a #SIMULATOR_REPORTER object to receive the simulation log. + virtual void SetReporter( SIMULATOR_REPORTER* aReporter ) { m_reporter = aReporter; } @@ -166,9 +166,9 @@ public: * * @return the simulator specific settings. */ - std::shared_ptr& Settings() { return m_settings; } + std::shared_ptr& Settings() { return m_settings; } - const std::shared_ptr& Settings() const { return m_settings; } + const std::shared_ptr& Settings() const { return m_settings; } /** * Return a string with simulation name based on enum. @@ -182,10 +182,10 @@ public: protected: ///< Reporter object to receive simulation log. - SPICE_REPORTER* m_reporter; + SIMULATOR_REPORTER* m_reporter; ///< We don't own this. We are just borrowing it from the #SCHEMATIC_SETTINGS. - std::shared_ptr m_settings; + std::shared_ptr m_settings; }; #endif /* SPICE_SIMULATOR_H */ diff --git a/eeschema/tools/simulator_control.h b/eeschema/tools/simulator_control.h index 83868d13ed..18e3f57290 100644 --- a/eeschema/tools/simulator_control.h +++ b/eeschema/tools/simulator_control.h @@ -28,7 +28,7 @@ #include class SIMULATOR_FRAME; -class NGSPICE_CIRCUIT_MODEL; +class SPICE_CIRCUIT_MODEL; class SPICE_SIMULATOR; class SIM_TAB; @@ -91,10 +91,10 @@ private: void setTransitions() override; private: - SIMULATOR_FRAME* m_simulatorFrame; - SCH_EDIT_FRAME* m_schematicFrame; - std::shared_ptr m_circuitModel; - std::shared_ptr m_simulator; + SIMULATOR_FRAME* m_simulatorFrame; + SCH_EDIT_FRAME* m_schematicFrame; + std::shared_ptr m_circuitModel; + std::shared_ptr m_simulator; }; diff --git a/eeschema/widgets/tuner_slider.cpp b/eeschema/widgets/tuner_slider.cpp index 2941a53e14..97b3566fee 100644 --- a/eeschema/widgets/tuner_slider.cpp +++ b/eeschema/widgets/tuner_slider.cpp @@ -25,7 +25,7 @@ */ -#include +#include #include #include #include @@ -39,18 +39,18 @@ #include "tuner_slider.h" #include "core/kicad_algo.h" -TUNER_SLIDER::TUNER_SLIDER( SIMULATOR_PANEL* aPanel, wxWindow* aParent, +TUNER_SLIDER::TUNER_SLIDER( SIMULATOR_FRAME_UI* aFrame, wxWindow* aParent, const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol ) : - TUNER_SLIDER_BASE( aParent ), + TUNER_SLIDER_BASE( aFrame ), m_symbol( aSymbol->m_Uuid ), m_sheetPath( aSheetPath ), m_ref( aSymbol->GetRef( &aSheetPath ) ), m_min( 0.0 ), m_max( 0.0 ), m_value( 0.0 ), - m_panel( aPanel ) + m_frame( aFrame ) { - const SPICE_ITEM* item = m_panel->GetExporter()->FindItem( std::string( m_ref.ToUTF8() ) ); + const SPICE_ITEM* item = m_frame->GetExporter()->FindItem( std::string( m_ref.ToUTF8() ) ); if( !item ) throw KI_PARAM_ERROR( wxString::Format( _( "%s not found" ), m_ref ) ); @@ -191,7 +191,7 @@ bool TUNER_SLIDER::SetMax( const SPICE_VALUE& aVal ) void TUNER_SLIDER::updateComponentValue() { - wxQueueEvent( m_panel, new wxCommandEvent( EVT_SIM_UPDATE ) ); + wxQueueEvent( m_frame, new wxCommandEvent( EVT_SIM_UPDATE ) ); } @@ -334,13 +334,13 @@ void TUNER_SLIDER::updateMin() void TUNER_SLIDER::onClose( wxCommandEvent& event ) { - m_panel->RemoveTuner( this ); + m_frame->RemoveTuner( this ); } void TUNER_SLIDER::onSave( wxCommandEvent& event ) { - m_panel->UpdateTunerValue( m_sheetPath, m_symbol, GetSymbolRef(), m_value.ToOrigString() ); + m_frame->UpdateTunerValue( m_sheetPath, m_symbol, GetSymbolRef(), m_value.ToOrigString() ); } diff --git a/eeschema/widgets/tuner_slider.h b/eeschema/widgets/tuner_slider.h index 6139fbb555..8f17ba8e74 100644 --- a/eeschema/widgets/tuner_slider.h +++ b/eeschema/widgets/tuner_slider.h @@ -34,7 +34,7 @@ #include -class SIMULATOR_PANEL; +class SIMULATOR_FRAME_UI; class SCH_SYMBOL; /** @@ -43,7 +43,7 @@ class SCH_SYMBOL; class TUNER_SLIDER : public TUNER_SLIDER_BASE { public: - TUNER_SLIDER( SIMULATOR_PANEL *aPanel, wxWindow* aParent, const SCH_SHEET_PATH& aSheetPath, + TUNER_SLIDER( SIMULATOR_FRAME_UI* aPanel, wxWindow* aParent, const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol ); wxString GetSymbolRef() const @@ -102,15 +102,15 @@ private: void onMinTextEnter( wxCommandEvent& event ) override; private: - KIID m_symbol; - SCH_SHEET_PATH m_sheetPath; - wxString m_ref; + KIID m_symbol; + SCH_SHEET_PATH m_sheetPath; + wxString m_ref; - SPICE_VALUE m_min; - SPICE_VALUE m_max; - SPICE_VALUE m_value; + SPICE_VALUE m_min; + SPICE_VALUE m_max; + SPICE_VALUE m_value; - SIMULATOR_PANEL* m_panel; + SIMULATOR_FRAME_UI* m_frame; }; #endif /* TUNER_SLIDER_H */ diff --git a/qa/tests/eeschema/test_netlist_exporter_spice.cpp b/qa/tests/eeschema/test_netlist_exporter_spice.cpp index 8eab375bed..df508f24df 100644 --- a/qa/tests/eeschema/test_netlist_exporter_spice.cpp +++ b/qa/tests/eeschema/test_netlist_exporter_spice.cpp @@ -24,7 +24,7 @@ #include #include // To check if the current test failed (to be moved?). #include -#include +#include #include #include diff --git a/qa/tests/eeschema/test_netlist_exporter_spice.h b/qa/tests/eeschema/test_netlist_exporter_spice.h index 1524df2cee..40c79e3667 100644 --- a/qa/tests/eeschema/test_netlist_exporter_spice.h +++ b/qa/tests/eeschema/test_netlist_exporter_spice.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/qa/tests/spice/test_netlist_exporter_spice.cpp b/qa/tests/spice/test_netlist_exporter_spice.cpp index 553bf9a198..c11d1a73b1 100644 --- a/qa/tests/spice/test_netlist_exporter_spice.cpp +++ b/qa/tests/spice/test_netlist_exporter_spice.cpp @@ -24,7 +24,7 @@ #include #include // To check if the current test failed (to be moved?). #include -#include +#include #include #include diff --git a/qa/tests/spice/test_netlist_exporter_spice.h b/qa/tests/spice/test_netlist_exporter_spice.h index 9d3bbffa01..b58c84b34e 100644 --- a/qa/tests/spice/test_netlist_exporter_spice.h +++ b/qa/tests/spice/test_netlist_exporter_spice.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -38,7 +38,7 @@ class TEST_NETLIST_EXPORTER_SPICE_FIXTURE : public TEST_NETLIST_EXPORTER_FIXTURE { public: - class SPICE_TEST_REPORTER : public SPICE_REPORTER + class SPICE_TEST_REPORTER : public SIMULATOR_REPORTER { public: SPICE_TEST_REPORTER( std::shared_ptr aLog ) : @@ -56,7 +56,7 @@ public: bool HasMessage() const override { return false; } - void OnSimStateChange( SPICE_SIMULATOR* aObject, SIM_STATE aNewState ) override { } + void OnSimStateChange( SIMULATOR* aObject, SIM_STATE aNewState ) override { } private: std::shared_ptr m_log; diff --git a/qa/tests/spice/test_ngspice_helpers.cpp b/qa/tests/spice/test_ngspice_helpers.cpp index db24489cd5..354908392b 100644 --- a/qa/tests/spice/test_ngspice_helpers.cpp +++ b/qa/tests/spice/test_ngspice_helpers.cpp @@ -24,7 +24,7 @@ /** * @file - * Test suite for NGSPICE_CIRCUIT_MODEL + * Test suite for SPICE_CIRCUIT_MODEL */ #include @@ -36,7 +36,7 @@ #include #include #include -#include +#include class TEST_NGSPICE_HELPERS { @@ -59,7 +59,7 @@ public: SCHEMATIC m_schematic; - NGSPICE_CIRCUIT_MODEL m_exporter; + SPICE_CIRCUIT_MODEL m_exporter; }; @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE( CommandToSimType ) for( auto& step : testData ) { - SIM_TYPE result = NGSPICE_CIRCUIT_MODEL::CommandToSimType( step.command ); + SIM_TYPE result = SPICE_CIRCUIT_MODEL::CommandToSimType( step.command ); BOOST_CHECK_EQUAL( result, step.type ); } @@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE( CommandToSimType ) for( auto& step : testData ) { step.command.Append( "\n" ); - SIM_TYPE result = NGSPICE_CIRCUIT_MODEL::CommandToSimType( step.command ); + SIM_TYPE result = SPICE_CIRCUIT_MODEL::CommandToSimType( step.command ); BOOST_CHECK_EQUAL( result, step.type ); }