Add Simulation->Save netlist menu #225

This commit is contained in:
Vadim Kuznetsov 2023-02-25 16:59:57 +03:00
parent efc1bbc107
commit 380e16bbe4
5 changed files with 29 additions and 5 deletions

View File

@ -23,7 +23,7 @@
#include "simsettingsdialog.h"
#include "main.h"
ExternSimDialog::ExternSimDialog(Schematic *sch,QWidget *parent) :
ExternSimDialog::ExternSimDialog(Schematic *sch, QWidget *parent, bool netlist_mode) :
QDialog(parent)
{
Sch = sch;
@ -85,7 +85,8 @@ ExternSimDialog::ExternSimDialog(Schematic *sch,QWidget *parent) :
this->setWindowTitle(tr("Simulate with external simulator"));
slotSetSimulator();
buttonSimulate->click(); // Start simulation
if (!netlist_mode)
buttonSimulate->click(); // Start simulation
}

View File

@ -47,7 +47,8 @@ private:
Xyce *xyce;
public:
explicit ExternSimDialog(Schematic *sch,QWidget *parent = 0);
explicit ExternSimDialog(Schematic *sch, QWidget *parent = 0,
bool netlist_mode = false);
~ExternSimDialog();
bool wasSimulated;
@ -61,6 +62,7 @@ signals:
void success();
public slots:
void slotSaveNetlist();
private slots:
void slotProcessOutput();
@ -70,7 +72,6 @@ private slots:
void slotStart();
void slotStop();
void slotSetSimulator();
void slotSaveNetlist();
};

View File

@ -3069,6 +3069,21 @@ void QucsApp::slotSimulateWithSpice()
}
}
void QucsApp::slotSaveNetlist()
{
if (QucsSettings.DefaultSimulator == spicecompat::simQucsator) {
QMessageBox::information(this,tr("Save netlist"),
tr("This action is supported only for SPICE simulators!"));
return;
}
if (!isTextDocument(DocumentTab->currentWidget())) {
Schematic *sch = (Schematic*)DocumentTab->currentWidget();
ExternSimDialog *SimDlg = new ExternSimDialog(sch,this,true);
SimDlg->slotSaveNetlist();
delete SimDlg;
}
}
void QucsApp::slotAfterSpiceSimulation()
{
Schematic *sch = (Schematic*)DocumentTab->currentWidget();

View File

@ -180,6 +180,7 @@ private slots:
void slotFileChanged(bool);
void slotSimSettings();
void slotSimulateWithSpice();
void slotSaveNetlist();
void slotAfterSpiceSimulation();
void slotBuildVAModule();
void slotBuildXSPICEIfs(int mode = 0);
@ -212,7 +213,7 @@ public:
*fileSaveAll, *fileClose, *fileExamples, *fileSettings, *filePrint, *fileQuit,
*projNew, *projOpen, *projDel, *projClose, *applSettings, *refreshSchPath,
*editCut, *editCopy, *magAll, *magOne, *magMinus, *filePrintFit,
*symEdit, *intoH, *popH, *simulate, *dpl_sch, *undo, *redo, *dcbias;
*symEdit, *intoH, *popH, *simulate, *save_netlist, *dpl_sch, *undo, *redo, *dcbias;
QAction *exportAsImage;

View File

@ -549,6 +549,11 @@ void QucsApp::initActions()
dcbias->setWhatsThis(tr("Calculate DC bias\n\nCalculates DC bias and shows it"));
connect(dcbias, SIGNAL(triggered()), SLOT(slotDCbias()));
save_netlist = new QAction(tr("Save netlist"), this);
save_netlist->setStatusTip(tr("Save netlist"));
save_netlist->setWhatsThis(tr("Save netlist to file"));
connect(save_netlist, SIGNAL(triggered()), SLOT(slotSaveNetlist()));
setMarker = new QAction(QIcon((":/bitmaps/marker.png")), tr("Set Marker on Graph"), this);
setMarker->setShortcut(Qt::CTRL+Qt::Key_B);
setMarker->setStatusTip(tr("Sets a marker on a diagram's graph"));
@ -759,6 +764,7 @@ void QucsApp::initMenuBar()
simMenu->addAction(dcbias);
simMenu->addAction(showMsg);
simMenu->addAction(showNet);
simMenu->addAction(save_netlist);
simMenu->addAction(simSettings);