New Feature: CDL netlist export

Introduced very basic c++ coding style for the class Schematic and it's
parent-class QucsDoc based on https://google.github.io/styleguide/cppguide.html:
-Prefix class attributes with a_ (much more better readability!)
-Class member initialization via constructor member initialization list
-No public class attributes (where possible with small effort)

Signed-off-by: ThomasZecha <zecha@ihp-microelectronics.com>
This commit is contained in:
ThomasZecha 2024-11-08 12:46:57 +01:00
parent 9d55075db8
commit 62cf2d4bdc
34 changed files with 1698 additions and 1596 deletions

View File

@ -1465,7 +1465,7 @@ void Component::copyComponent(Component *pc) {
// ***********************************************************************
void MultiViewComponent::recreate(Schematic *Doc) {
if (Doc) {
Doc->Components->setAutoDelete(false);
Doc->a_Components->setAutoDelete(false);
Doc->deleteComp(this);
}
@ -1493,7 +1493,7 @@ void MultiViewComponent::recreate(Schematic *Doc) {
if (Doc) {
Doc->insertRawComponent(this);
Doc->Components->setAutoDelete(true);
Doc->a_Components->setAutoDelete(true);
}
}

View File

@ -40,7 +40,7 @@
#include <QDebug>
ComponentDialog::ComponentDialog(Component *c, Schematic *d)
: QDialog(d)
: QDialog(d)
{
// qDebug() << "Restore: " << _settings::Get().value("ComponentDialog/geometry").toByteArray();
// qDebug() << "Settings: " << _settings::Get().organizationName() << " " << _settings::Get().applicationName();
@ -78,7 +78,7 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
comboType = nullptr; checkParam = nullptr;
editStart = nullptr; editStop = nullptr;
editNumber = nullptr;
// last property shown elsewhere outside the properties table, not to put in TableView
auto pp = Comp->Props.begin();
@ -141,12 +141,12 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
comboType = new QComboBox(Tab1);
QStringList sweeptypes;
sweeptypes << tr("linear")
<< tr("logarithmic")
<< tr("list")
<< tr("constant");
sweeptypes << tr("linear")
<< tr("logarithmic")
<< tr("list")
<< tr("constant");
comboType->insertItems(0, sweeptypes);
gp->addWidget(comboType, row,1);
connect(comboType, SIGNAL(activated(int)), SLOT(slotSimTypeChange(int)));
checkType = new QCheckBox(tr("display in schematic"), Tab1);
@ -198,8 +198,8 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
if(Comp->Model == ".SW") { // parameter sweep
Component *pc;
for(pc=Doc->Components->first(); pc!=0; pc=Doc->Components->next()) {
// insert all schematic available simulations in the Simulation combo box
for(pc=Doc->a_Components->first(); pc!=0; pc=Doc->a_Components->next()) {
// insert all schematic available simulations in the Simulation combo box
if(pc != Comp)
if(pc->Model[0] == '.')
comboSim->insertItem(comboSim->count(), pc->Name);
@ -208,7 +208,7 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
// set selected simulations in combo box to the currently used one
int i = comboSim->findText((*pp)->Value);
if (i != -1) // current simulation is in the available simulations list (normal case)
comboSim->setCurrentIndex(i);
comboSim->setCurrentIndex(i);
else // current simulation not in the available simulations list
comboSim->setEditText((*pp)->Value);
@ -237,8 +237,8 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
int tNum = 0;
if(s[0] == 'l') {
if(s[1] == 'i') {
if(s[2] != 'n')
tNum = 2;
if(s[2] != 'n')
tNum = 2;
}
else tNum = 1;
}
@ -248,7 +248,7 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
slotSimTypeChange(tNum); // not automatically ?!?
if(tNum > 1) {
editValues->setText(
editNumber->text().mid(1, editNumber->text().length()-2));
editNumber->text().mid(1, editNumber->text().length()-2));
checkValues->setChecked((*pp)->display);
editNumber->setText("2");
}
@ -256,15 +256,15 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
++pp;
/* connect(editValues, SIGNAL(textChanged(const QString&)),
SLOT(slotTextChanged(const QString&)));*/
SLOT(slotTextChanged(const QString&)));*/
connect(editStart, SIGNAL(textChanged(const QString&)),
SLOT(slotNumberChanged(const QString&)));
SLOT(slotNumberChanged(const QString&)));
connect(editStop, SIGNAL(textChanged(const QString&)),
SLOT(slotNumberChanged(const QString&)));
SLOT(slotNumberChanged(const QString&)));
connect(editStep, SIGNAL(textChanged(const QString&)),
SLOT(slotStepChanged(const QString&)));
SLOT(slotStepChanged(const QString&)));
connect(editNumber, SIGNAL(textChanged(const QString&)),
SLOT(slotNumberChanged(const QString&)));
SLOT(slotNumberChanged(const QString&)));
/* if(checkSim)
connect(checkSim, SIGNAL(stateChanged(int)), SLOT(slotSetChanged(int)));
@ -329,7 +329,7 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
prop->setSelectionMode(QAbstractItemView::SingleSelection);
prop->setMinimumSize(200, 150);
prop->horizontalHeader()->setStretchLastSection(true);
// set automatic resize so all content will be visible,
// set automatic resize so all content will be visible,
// horizontal scrollbar will appear if table becomes too large
prop->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
prop->horizontalHeader()->setSectionsClickable(false); // no action when clicking on the header
@ -497,7 +497,7 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
prop->setCurrentItem(prop->item(0,0));
slotSelectProperty(prop->item(0,0));
}
/// \todo add key up/down browse and select prop
connect(prop, SIGNAL(itemClicked(QTableWidgetItem*)),
@ -699,7 +699,7 @@ void ComponentDialog::slotSelectProperty(QTableWidgetItem *item)
QFontMetrics metrics(QucsSettings.font, 0); // get size of text
qDebug() << "desc = " << desc << metrics.boundingRect(desc).width();
while(metrics.boundingRect(desc).width() > 270) { // if description too long, cut it nicely
// so 270 above will be the maximum size of the name label and associated edit line widget
// so 270 above will be the maximum size of the name label and associated edit line widget
if (desc.lastIndexOf(' ') != -1)
desc = desc.left(desc.lastIndexOf(' ')) + "....";
else
@ -719,7 +719,7 @@ void ComponentDialog::slotSelectProperty(QTableWidgetItem *item)
for(int i=ComboEdit->count()-1; i>=0; i--)
if(value == ComboEdit->itemText(i)) {
ComboEdit->setCurrentIndex(i);
break;
break;
}
edit->setVisible(false);
ComboEdit->setVisible(true);
@ -741,9 +741,9 @@ void ComponentDialog::slotApplyChange(int idx)
QList<QTableWidgetItem *> items = prop->selectedItems();
Q_ASSERT(!items.isEmpty());
QTableWidgetItem *item = items.first();
int row = item->row();
auto Text = ComboEdit->itemText(idx);
edit->setText(Text);
// apply edit line
@ -767,16 +767,16 @@ void ComponentDialog::slotApplyProperty()
{
// pick selected row
QTableWidgetItem *item = prop->currentItem();
if(!item)
return;
int row = item->row();
QString name = prop->item(row, 0)->text();
QString value = prop->item(row, 1)->text();
if (!ComboEdit->isHidden()) // take text from ComboBox ?
edit->setText(ComboEdit->currentText());
@ -1061,7 +1061,7 @@ void ComponentDialog::slotBrowseFile()
if (!schematicFileName.isEmpty()) // if schematic has a filename
currDir = schematicFileInfo.absolutePath();
else // use the WorkDir path
currDir = lastDir.isEmpty() ? QucsSettings.QucsWorkDir.absolutePath() : lastDir;
currDir = lastDir.isEmpty() ? QucsSettings.QucsWorkDir.absolutePath() : lastDir;
} else { // current file name is absolute
currDir = currFileInfo.exists() ? currFileInfo.absolutePath() : QucsSettings.QucsWorkDir.absolutePath();
}
@ -1069,10 +1069,10 @@ void ComponentDialog::slotBrowseFile()
if (!schematicFileName.isEmpty()) { // if schematic has a filename
currDir = schematicFileInfo.absolutePath();
} else { // use the WorkDir path
currDir = lastDir.isEmpty() ? QucsSettings.QucsWorkDir.absolutePath() : lastDir;
currDir = lastDir.isEmpty() ? QucsSettings.QucsWorkDir.absolutePath() : lastDir;
}
}
QString s = QFileDialog::getOpenFileName (
this,
tr("Select a file"),
@ -1112,7 +1112,7 @@ void ComponentDialog::slotBrowseFile()
// -------------------------------------------------------------------------
void ComponentDialog::slotEditFile()
{
Doc->App->editFile(misc::properAbsFileName(edit->text(), Doc));
Doc->getApp()->editFile(misc::properAbsFileName(edit->text(), Doc));
}
/*!
@ -1280,9 +1280,9 @@ void ComponentDialog::slotSimTypeChange(int Type)
if(!editNumber->isEnabled()) { // was the other mode before ?
// this text change, did not emit the textChange signal !??!
editStart->setText(
editValues->text().section(';', 0, 0).trimmed());
editValues->text().section(';', 0, 0).trimmed());
editStop->setText(
editValues->text().section(';', -1, -1).trimmed());
editValues->text().section(';', -1, -1).trimmed());
editNumber->setText("2");
slotNumberChanged(0);
@ -1490,8 +1490,8 @@ QStringList ComponentDialog::getSimulationList()
return sim_lst;
}
sim_lst.append("ALL");
for (size_t i = 0; i < sch->DocComps.count(); i++) {
Component *c = sch->DocComps.at(i);
for (size_t i = 0; i < sch->a_DocComps.count(); i++) {
Component *c = sch->a_DocComps.at(i);
if (!c->isSimulation) continue;
if (c->Model == ".FOUR") continue;
if (c->Model == ".PZ") continue;

View File

@ -47,7 +47,7 @@
OptimizeDialog::OptimizeDialog(Optimize_Sim *c_, Schematic *d_)
: QDialog(d_)
: QDialog(d_)
{
Comp = c_;
Doc = d_;
@ -92,15 +92,15 @@ OptimizeDialog::OptimizeDialog(Optimize_Sim *c_, Schematic *d_)
MethodCombo = new QComboBox();
MethodCombo->insertItems(-1, QStringLiteral("DE/best/1/exp;"
"DE/rand/1/exp;"
"DE/rand-to-best/1/exp;"
"DE/best/2/exp;"
"DE/rand/1/exp;"
"DE/best/1/bin;"
"DE/rand/1/bin;"
"DE/rand-to-best/1/bin;"
"DE/best/2/bin;"
"DE/rand/2/bin").split(";"));
"DE/rand/1/exp;"
"DE/rand-to-best/1/exp;"
"DE/best/2/exp;"
"DE/rand/1/exp;"
"DE/best/1/bin;"
"DE/rand/1/bin;"
"DE/rand-to-best/1/bin;"
"DE/best/2/bin;"
"DE/rand/2/bin").split(";"));
gp2->addWidget(new QLabel(tr("Method:")), 0,0);
gp2->addWidget(MethodCombo,0,1);
@ -257,7 +257,7 @@ OptimizeDialog::OptimizeDialog(Optimize_Sim *c_, Schematic *d_)
// add horizontal line
QFrame *line = new QFrame(this);
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
line->setFrameShadow(QFrame::Sunken);
gp3->addWidget(line, 5, 0, 1, -1); // fill the entire width
QPushButton *CreateEqn_Butt = new QPushButton(tr("Copy current values to equation"));
connect(CreateEqn_Butt, SIGNAL(clicked()), SLOT(slotCreateEqn()));
@ -347,7 +347,7 @@ OptimizeDialog::OptimizeDialog(Optimize_Sim *c_, Schematic *d_)
// ...........................................................
Component *pc;
for(pc=Doc->Components->first(); pc!=0; pc=Doc->Components->next())
for(pc=Doc->a_Components->first(); pc!=0; pc=Doc->a_Components->next())
if(pc != Comp)
if(pc->Model[0] == '.' && pc->Model != ".Opt")
SimEdit->insertItem(SimEdit->count(), pc->Name);
@ -519,7 +519,7 @@ void OptimizeDialog::slotAddVariable()
int row;
for (row = 0; row < VarTable->rowCount(); ++row) {
if (VarNameEdit->text() == VarTable->item(row, 0)->text()) {
QMessageBox::critical(this, tr("Error"),
QMessageBox::critical(this, tr("Error"),
tr("Variable \"%1\" aleardy in list!").arg(VarNameEdit->text()));
return;
}
@ -728,7 +728,7 @@ void OptimizeDialog::slotApply()
NameEdit->setText(Comp->Name);
else
if(NameEdit->text() != Comp->Name) {
for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next())
for(pc = Doc->a_Components->first(); pc!=0; pc = Doc->a_Components->next())
if(pc->Name == NameEdit->text())
break; // found component with the same name ?
if(pc)
@ -790,7 +790,7 @@ void OptimizeDialog::slotApply()
propList << "E48";
} else if (typeStr == tr("E96 series")) {
propList << "E96";
} else if (typeStr == tr("E192 series")) {
} else if (typeStr == tr("E192 series")) {
propList << "E192";
} else {
propList << "LOG_INT";
@ -889,12 +889,12 @@ void OptimizeDialog::slotCreateEqn()
s += QStringLiteral("\"yes\" 0>\n" // Export yes, no display
"</Components>\n"
"<Wires>\n"
"</Wires>\n"
"<Diagrams>\n"
"</Diagrams>\n"
"<Paintings>\n"
"</Paintings>\n");
"<Wires>\n"
"</Wires>\n"
"<Diagrams>\n"
"</Diagrams>\n"
"<Paintings>\n"
"</Paintings>\n");
QApplication::clipboard()->setText(s, QClipboard::Clipboard);
// uncomment to have the dialog close and the Equation pasted...
@ -926,9 +926,9 @@ void OptimizeDialog::slotSetPrecision(const QPoint& pos)
for(int i = 2; i< Comp->Props.size(); i++) {
if(Comp->Props.at(i)->Name == "Var") {
QStringList ValueSplit = Comp->Props.at(i)->Value.split("|");
// 'initial' column
item = VarTable->item(row++, 2);
item->setText(QString::number(ValueSplit.at(2).toDouble(), 'g', numPrec));
// 'initial' column
item = VarTable->item(row++, 2);
item->setText(QString::number(ValueSplit.at(2).toDouble(), 'g', numPrec));
}
}
}

View File

@ -31,26 +31,26 @@ SP_Sim::SP_Sim()
// The index of the first 4 properties must not changed. Used in recreate().
Props.append(new Property("Type", "lin", true,
QObject::tr("sweep type")+" [lin, log, list, const]"));
QObject::tr("sweep type")+" [lin, log, list, const]"));
Props.append(new Property("Start", "1 MHz", true,
QObject::tr("start frequency in Hertz")));
QObject::tr("start frequency in Hertz")));
Props.append(new Property("Stop", "100 MHz", true,
QObject::tr("stop frequency in Hertz")));
QObject::tr("stop frequency in Hertz")));
Props.append(new Property("Points", "200", true,
QObject::tr("number of simulation steps")));
QObject::tr("number of simulation steps")));
Props.append(new Property("Noise", "no", false,
QObject::tr("calculate noise parameters")+
" [yes, no]"));
QObject::tr("calculate noise parameters")+
" [yes, no]"));
Props.append(new Property("NoiseIP", "1", false,
QObject::tr("input port for noise figure")));
QObject::tr("input port for noise figure")));
Props.append(new Property("NoiseOP", "2", false,
QObject::tr("output port for noise figure")));
QObject::tr("output port for noise figure")));
Props.append(new Property("saveCVs", "no", false,
QObject::tr("put characteristic values into dataset")+
" [yes, no]"));
QObject::tr("put characteristic values into dataset")+
" [yes, no]"));
Props.append(new Property("saveAll", "no", false,
QObject::tr("save subcircuit characteristic values into dataset")+
" [yes, no]"));
QObject::tr("save subcircuit characteristic values into dataset")+
" [yes, no]"));
}
SP_Sim::~SP_Sim()
@ -92,7 +92,7 @@ int SP_Sim::getSPortsNumber()
{
int p_num = 0;
if (containingSchematic != NULL) {
auto comps = containingSchematic->DocComps;
auto comps = containingSchematic->a_DocComps;
for(Component *pc = comps.first(); pc != 0; pc = comps.next()) {
if (pc->Model == "Pac") p_num++;
}

View File

@ -70,7 +70,7 @@ SpiceDialog::SpiceDialog(QucsApp* App_, SpiceFile *c, Schematic *d)
topGrid->addWidget(new QLabel(tr("Name:")), 0, 0);
topGrid->addWidget(CompNameEdit, 0, 1);
FileEdit = new QLineEdit;
FileEdit->setValidator(ValRestrict);
connect(FileEdit, SIGNAL(returnPressed()), SLOT(slotButtOK()));
@ -212,7 +212,7 @@ void SpiceDialog::slotButtApply()
if(CompNameEdit->text().isEmpty()) CompNameEdit->setText(Comp->Name);
else if(CompNameEdit->text() != Comp->Name)
{
for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next())
for(pc = Doc->a_Components->first(); pc!=0; pc = Doc->a_Components->next())
if(pc->Name == CompNameEdit->text()) {
break; // found component with the same name ?
}
@ -293,7 +293,7 @@ void SpiceDialog::slotButtBrowse()
if (!schematicFileName.isEmpty()) // if schematic has a filename
currDir = schematicFileInfo.absolutePath();
else // use the WorkDir path
currDir = lastDir.isEmpty() ? QucsSettings.QucsWorkDir.absolutePath() : lastDir;
currDir = lastDir.isEmpty() ? QucsSettings.QucsWorkDir.absolutePath() : lastDir;
} else { // current file name is absolute
currDir = currFileInfo.exists() ? currFileInfo.absolutePath() : QucsSettings.QucsWorkDir.absolutePath();
}
@ -301,7 +301,7 @@ void SpiceDialog::slotButtBrowse()
if (!schematicFileName.isEmpty()) { // if schematic has a filename
currDir = schematicFileInfo.absolutePath();
} else { // use the WorkDir path
currDir = lastDir.isEmpty() ? QucsSettings.QucsWorkDir.absolutePath() : lastDir;
currDir = lastDir.isEmpty() ? QucsSettings.QucsWorkDir.absolutePath() : lastDir;
}
}
@ -644,7 +644,7 @@ void SpiceDialog::slotGetNetlist()
// -------------------------------------------------------------------------
void SpiceDialog::slotButtEdit()
{
Doc->App->editFile(misc::properAbsFileName(FileEdit->text(), Doc));
Doc->getApp()->editFile(misc::properAbsFileName(FileEdit->text(), Doc));
}
// -------------------------------------------------------------------------

View File

@ -82,16 +82,16 @@ private:
Painter.setPen(QPen(Qt::red,2));
Painter.drawLine(CROSS3D_SIZE, CROSS3D_SIZE,
int(CROSS3D_SIZE * (1.0+cxx)),
int(CROSS3D_SIZE * (1.0-cyx)));
int(CROSS3D_SIZE * (1.0+cxx)),
int(CROSS3D_SIZE * (1.0-cyx)));
Painter.setPen(QPen(Qt::green,2));
Painter.drawLine(CROSS3D_SIZE, CROSS3D_SIZE,
int(CROSS3D_SIZE * (1.0-cxy)),
int(CROSS3D_SIZE * (1.0-cyy)));
int(CROSS3D_SIZE * (1.0-cxy)),
int(CROSS3D_SIZE * (1.0-cyy)));
Painter.setPen(QPen(Qt::blue,2));
Painter.drawLine(CROSS3D_SIZE, CROSS3D_SIZE,
int(CROSS3D_SIZE * (1.0+cxz)),
int(CROSS3D_SIZE * (1.0+cyz)));
int(CROSS3D_SIZE * (1.0+cxz)),
int(CROSS3D_SIZE * (1.0+cyz)));
};
};
@ -112,12 +112,12 @@ DiagramDialog::DiagramDialog(Diagram *d, QWidget *parent, Graph *currentGraph)
Diag = d;
copyDiagramGraphs(); // make a copy of all graphs
if(parent){
const Schematic* s = dynamic_cast<const Schematic*>(parent);
assert(s);
QFileInfo Info(s->DocName);
defaultDataSet = Info.absolutePath() + QDir::separator() + s->DataSet;
const Schematic* s = dynamic_cast<const Schematic*>(parent);
assert(s);
QFileInfo Info(s->getDocName());
defaultDataSet = Info.absolutePath() + QDir::separator() + s->getDataSet();
}else{
defaultDataSet = "unknown";
defaultDataSet = "unknown";
}
setWindowTitle(tr("Edit Diagram Properties"));
changed = false;
@ -154,7 +154,7 @@ DiagramDialog::DiagramDialog(Diagram *d, QWidget *parent, Graph *currentGraph)
NameZ = tr("z-Axis");
}
all = new QVBoxLayout(this); // to provide necessary size
QTabWidget *t = new QTabWidget();
all->addWidget(t);
@ -240,7 +240,7 @@ DiagramDialog::DiagramDialog(Diagram *d, QWidget *parent, Graph *currentGraph)
PropertyBox->addItem(tr("arrows"));
}
connect(PropertyBox, SIGNAL(activated(int)),
SLOT(slotSetGraphStyle(int)));
SLOT(slotSetGraphStyle(int)));
Box2Layout->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder
Label2 = new QLabel(tr("Thickness:"));
@ -266,7 +266,7 @@ DiagramDialog::DiagramDialog(Diagram *d, QWidget *parent, Graph *currentGraph)
}
if(Property2) {
connect(Property2, SIGNAL(textChanged(const QString&)),
SLOT(slotSetProp2(const QString&)));
SLOT(slotSetProp2(const QString&)));
Label1->setEnabled(false);
PropertyBox->setEnabled(false);
@ -388,7 +388,7 @@ DiagramDialog::DiagramDialog(Diagram *d, QWidget *parent, Graph *currentGraph)
GridColorButt = new QPushButton(" ",Tab2);
connect(GridColorButt, SIGNAL(clicked()), SLOT(slotSetGridColor()));
gp->addWidget(GridColorButt, Row,1);
Row++;
Row++;
misc::setPickerColor(GridColorButt, Diag->GridPen.color());
GridLabel2 = new QLabel(tr("Grid Style: "), Tab2);
@ -488,7 +488,7 @@ DiagramDialog::DiagramDialog(Diagram *d, QWidget *parent, Graph *currentGraph)
rotationX->setMaximumWidth(40);
gp->addWidget(rotationX, Row,2);
connect(rotationX, SIGNAL(textChanged(const QString&)),
SLOT(slotEditRotX(const QString&)));
SLOT(slotEditRotX(const QString&)));
Row++;
QLabel *LabelRotY = new QLabel(tr("Rotation around y-Axis:"), Tab2);
@ -510,7 +510,7 @@ DiagramDialog::DiagramDialog(Diagram *d, QWidget *parent, Graph *currentGraph)
rotationY->setMaximumWidth(40);
gp->addWidget(rotationY, Row,2);
connect(rotationY, SIGNAL(textChanged(const QString&)),
SLOT(slotEditRotY(const QString&)));
SLOT(slotEditRotY(const QString&)));
Row++;
QLabel *LabelRotZ = new QLabel(tr("Rotation around z-Axis:"), Tab2);
@ -532,13 +532,13 @@ DiagramDialog::DiagramDialog(Diagram *d, QWidget *parent, Graph *currentGraph)
rotationZ->setMaximumWidth(40);
gp->addWidget(rotationZ, Row,2);
connect(rotationZ, SIGNAL(textChanged(const QString&)),
SLOT(slotEditRotZ(const QString&)));
SLOT(slotEditRotZ(const QString&)));
Row++;
gp->addWidget(new QLabel(tr("2D-projection:"), Tab2), Row,0);
DiagCross = new Cross3D(((Rect3DDiagram*)Diag)->rotX,
((Rect3DDiagram*)Diag)->rotY,
((Rect3DDiagram*)Diag)->rotZ, Tab2);
((Rect3DDiagram*)Diag)->rotY,
((Rect3DDiagram*)Diag)->rotZ, Tab2);
gp->addWidget(DiagCross, Row,1);
// transfer the diagram properties to the dialog
@ -1219,7 +1219,7 @@ void DiagramDialog::slotApply()
changed = true;
}
}
if(GridOn) if(Diag->xAxis.GridOn != GridOn->isChecked()) {
Diag->xAxis.GridOn = GridOn->isChecked();
Diag->yAxis.GridOn = GridOn->isChecked();
@ -1261,7 +1261,7 @@ void DiagramDialog::slotApply()
}
if((Diag->Name == "Smith") || (Diag->Name == "ySmith") ||
(Diag->Name == "PS"))
(Diag->Name == "PS"))
if(stopY->text().toDouble() < 1.0)
stopY->setText("1");

View File

@ -36,7 +36,7 @@
ChangeDialog::ChangeDialog(Schematic *Doc_)
: QDialog(Doc_)
: QDialog(Doc_)
{
Doc = Doc_;
setWindowTitle(tr("Change Component Properties"));
@ -137,7 +137,7 @@ void ChangeDialog::slotButtReplace()
#endif
if(!Expr.isValid()) {
QMessageBox::critical(this, tr("Error"),
tr("Regular expression for component name is invalid."));
tr("Regular expression for component name is invalid."));
return;
}
@ -147,17 +147,17 @@ void ChangeDialog::slotButtReplace()
QVBoxLayout *Dia_All = new QVBoxLayout(Dia);
Dia_All->setSpacing(3);
Dia_All->setContentsMargins(5, 5, 5, 5);
QScrollArea *Dia_Scroll = new QScrollArea(Dia);
//Dia_Scroll->setMargin(5);
Dia_All->addWidget(Dia_Scroll);
QVBoxLayout *Dia_Box = new QVBoxLayout(Dia_Scroll->viewport());
Dia_Box->setParent(Dia_Scroll);
QLabel *Dia_Label = new QLabel(tr("Change properties of\n")
+ tr("these components ?"), Dia);
Dia_All->addWidget(Dia_Label);
QHBoxLayout *Dia_h = new QHBoxLayout(Dia);
Dia_h->setSpacing(5);
QPushButton *YesButton = new QPushButton(tr("Yes"));
@ -166,7 +166,7 @@ void ChangeDialog::slotButtReplace()
Dia_h->addWidget(CancelButton);
connect(YesButton, SIGNAL(clicked()), Dia, SLOT(accept()));
connect(CancelButton, SIGNAL(clicked()), Dia, SLOT(reject()));
Dia_All->addLayout(Dia_h);
QList<QCheckBox *> pList;
@ -176,14 +176,14 @@ void ChangeDialog::slotButtReplace()
QString str;
int i1, i2;
// search through all components
for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next()) {
for(pc = Doc->a_Components->first(); pc!=0; pc = Doc->a_Components->next()) {
if(matches(pc->Model)) {
QRegularExpressionMatch match = Expr.match(pc->Name);
if(match.hasMatch())
for(const auto& pp : pc->Props)
if(pp->Name == PropNameEdit->currentText()) {
pb = new QCheckBox(pc->Name);
Dia_Box->addWidget(pb);
Dia_Box->addWidget(pb);
pList.append(pb);
pb->setChecked(true);
i1 = pp->Description.indexOf('[');
@ -223,13 +223,13 @@ void ChangeDialog::slotButtReplace()
bool changed = false;
// change property values
QListIterator<QCheckBox *> i(pList);
while(i.hasNext()){
pb = i.next();
if(!pb->isChecked()) continue;
for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next()) {
for(pc = Doc->a_Components->first(); pc!=0; pc = Doc->a_Components->next()) {
if(pb->text() != pc->Name) continue;
for(auto pp : pc->Props) {

View File

@ -33,7 +33,7 @@
DigiSettingsDialog::DigiSettingsDialog(TextDoc *Doc_)
: QDialog(Doc_)
: QDialog(Doc_)
{
Doc = Doc_;
setWindowTitle(tr("Document Settings"));
@ -46,10 +46,10 @@ DigiSettingsDialog::DigiSettingsDialog(TextDoc *Doc_)
QGroupBox *setGroup = new QGroupBox(tr("Digital Simulation Settings"));
all->addWidget(setGroup);
QVBoxLayout *group = new QVBoxLayout();
setGroup->setLayout(group);
QButtonGroup *toggleGroup = new QButtonGroup();
simRadio = new QRadioButton(tr("Simulation"));
group->addWidget(simRadio);
@ -82,7 +82,7 @@ DigiSettingsDialog::DigiSettingsDialog(TextDoc *Doc_)
group->addLayout(hb3);
group->addSpacing(15);
QHBoxLayout *hb2 = new QHBoxLayout();
hb2->setSpacing(5);
LibLabel = new QLabel(tr("Libraries:"));
@ -104,7 +104,7 @@ DigiSettingsDialog::DigiSettingsDialog(TextDoc *Doc_)
all->addLayout(Buttons);
simRadio->setChecked(Doc->simulation);
Doc->SimOpenDpl = Doc->simulation ? true : false;
Doc->setSimOpenDpl(Doc->simulation ? true : false);
comRadio->setChecked(!Doc->simulation);
slotChangeMode(!Doc->simulation);
@ -131,12 +131,12 @@ void DigiSettingsDialog::slotOk()
if(simRadio->isChecked()) {
QString s = TimeEdit->text();
if(!misc::VHDL_Time(s, tr("Document Settings"))) {
QMessageBox::critical(this, tr("Error"), s.mid(1));
reject();
return;
QMessageBox::critical(this, tr("Error"), s.mid(1));
reject();
return;
} else {
Doc->SimTime = s;
changed = true;
Doc->setSimTime(s);
changed = true;
}
}
}
@ -147,7 +147,7 @@ void DigiSettingsDialog::slotOk()
}
if(Doc->simulation != simRadio->isChecked()) {
Doc->simulation = simRadio->isChecked();
Doc->SimOpenDpl = Doc->simulation ? true : false;
Doc->setSimOpenDpl(Doc->simulation ? true : false);
changed = true;
}
if(Doc->Library != NameEdit->text()) {

View File

@ -53,7 +53,7 @@
extern SubMap FileList;
LibraryDialog::LibraryDialog(QWidget *parent)
: QDialog(parent)
: QDialog(parent)
{
setWindowTitle(tr("Create Library"));
@ -300,7 +300,7 @@ void LibraryDialog::slotCreateNext()
// ---------------------------------------------------------------
void LibraryDialog::intoStream(QTextStream &Stream, QString &tmp,
const char *sec)
const char *sec)
{
int i = tmp.indexOf("TOP LEVEL MARK");
if(i >= 0) {
@ -319,7 +319,7 @@ int LibraryDialog::intoFile(QString &ifn, QString &ofn, QStringList &IFiles)
QFile ifile(ifn);
if(!ifile.open(QIODevice::ReadOnly)) {
ErrText->insertPlainText(QObject::tr("ERROR: Cannot open file \"%1\".\n").
arg(ifn));
arg(ifn));
error++;
}
else {
@ -330,9 +330,9 @@ int LibraryDialog::intoFile(QString &ifn, QString &ofn, QStringList &IFiles)
QDir LibDirSub(LibDir);
if(!LibDirSub.cd(NameEdit->text())) {
if(!LibDirSub.mkdir(NameEdit->text())) {
ErrText->insertPlainText(
QObject::tr("ERROR: Cannot create user library subdirectory !\n"));
error++;
ErrText->insertPlainText(
QObject::tr("ERROR: Cannot create user library subdirectory !\n"));
error++;
}
LibDirSub.cd(NameEdit->text());
}
@ -421,7 +421,7 @@ void LibraryDialog::slotSave()
QTextStream Stream;
Stream.setDevice(&LibFile);
Stream << "<Qucs Library " PACKAGE_VERSION " \""
<< NameEdit->text() << "\">\n\n";
<< NameEdit->text() << "\">\n\n";
bool Success = true, ret;
@ -445,15 +445,15 @@ void LibraryDialog::slotSave()
if(!Doc->loadDocument()) { // load document if possible
delete Doc;
ErrText->appendPlainText(tr("Error: Cannot load subcircuit \"%1\".").
arg(SelectedNames[i]));
arg(SelectedNames[i]));
break;
}
Doc->DocName = NameEdit->text() + "_" + SelectedNames[i];
Doc->setDocName(NameEdit->text() + "_" + SelectedNames[i]);
Success = false;
// save analog model
tmp.truncate(0);
Doc->isAnalog = true;
Doc->setIsAnalog(true);
ErrText->insertPlainText("\n");
ErrText->insertPlainText(tr("Creating Qucs netlist.\n"));
@ -504,7 +504,7 @@ void LibraryDialog::slotSave()
if (!kern->checkSchematic(err_lst)) {
ErrText->insertPlainText(QStringLiteral("Component %1 contains SPICE-incompatible components.\n"
"Check these components: %2 \n")
.arg(Doc->DocName).arg(err_lst.join("; ")));
.arg(Doc->getDocName()).arg(err_lst.join("; ")));
}
kern->createSubNetlsit(ts,true);
intoStream(Stream, tmp, "Spice");
@ -514,8 +514,8 @@ void LibraryDialog::slotSave()
// save verilog model
tmp.truncate(0);
Doc->isVerilog = true;
Doc->isAnalog = false;
Doc->setIsVerilog(true);
Doc->setIsAnalog(false);
ErrText->insertPlainText("\n");
ErrText->insertPlainText(tr("Creating Verilog netlist.\n"));
@ -552,8 +552,8 @@ void LibraryDialog::slotSave()
// save vhdl model
tmp.truncate(0);
Doc->isVerilog = false;
Doc->isAnalog = false;
Doc->setIsVerilog(false);
Doc->setIsAnalog(false);
ErrText->insertPlainText(tr("Creating VHDL netlist.\n"));
ret = Doc->createLibNetlist(&ts, ErrText, 0);
@ -590,7 +590,7 @@ void LibraryDialog::slotSave()
Stream << " <Symbol>\n";
Doc->createSubcircuitSymbol();
Painting *pp;
for(pp = Doc->SymbolPaints.first(); pp != 0; pp = Doc->SymbolPaints.next())
for(pp = Doc->a_SymbolPaints.first(); pp != 0; pp = Doc->a_SymbolPaints.next())
Stream << " <" << pp->save() << ">\n";
Stream << " </Symbol>\n"

View File

@ -61,11 +61,11 @@ void SaveDialog::initDialog()
QGroupBox *group = new QGroupBox( tr( "Modified Files" ) );
QVBoxLayout *checkBoxLayout = new QVBoxLayout();
group->setLayout(checkBoxLayout);
fileView = new QListWidget(this);
checkBoxLayout->addWidget(fileView);
SaveDialogLayout->addWidget(group);
buttonsLayout = new QHBoxLayout();
abortClosingButton = new QPushButton( tr( "Abort Closing" ) );
@ -92,12 +92,12 @@ void SaveDialog::initDialog()
void SaveDialog::addUnsavedDoc(QucsDoc *doc)
{
QString text = (doc->DocName).isEmpty() ? tr("Untitled") : doc->DocName;
QString text = (doc->getDocName()).isEmpty() ? tr("Untitled") : doc->getDocName();
QListWidgetItem *item = new QListWidgetItem(text, fileView);
item->setFlags( item->flags() | Qt::ItemIsUserCheckable );
item->setCheckState(Qt::Checked);
unsavedDocs.insert(doc, item);
}
@ -107,7 +107,7 @@ void SaveDialog::dontSaveClicked()
}
void SaveDialog::saveSelectedClicked()
{
{
QList<QucsDoc*> unsavable;
QMap<QucsDoc*,QListWidgetItem*>::iterator it(unsavedDocs.begin());
for ( ; it != unsavedDocs.end(); ++it)

View File

@ -45,7 +45,7 @@
#include <QDebug>
SettingsDialog::SettingsDialog(Schematic *Doc_)
: QDialog(Doc_)
: QDialog(Doc_)
{
Doc = Doc_;
setWindowTitle(tr("Edit File Properties"));
@ -165,24 +165,24 @@ SettingsDialog::SettingsDialog(Schematic *Doc_)
// ...........................................................
// fill the fields with the QucsDoc-Properties
Input_DataSet->setText(Doc->DataSet);
Input_DataDisplay->setText(Doc->DataDisplay);
Input_Script->setText(Doc->Script);
Check_OpenDpl->setChecked(Doc->SimOpenDpl);
Check_RunScript->setChecked(Doc->SimRunScript);
Check_GridOn->setChecked(Doc->GridOn);
Input_GridX->setText(QString::number(Doc->GridX));
Input_GridY->setText(QString::number(Doc->GridY));
Combo_Frame->setCurrentIndex(Doc->showFrame);
Input_DataSet->setText(Doc->getDataSet());
Input_DataDisplay->setText(Doc->getDataDisplay());
Input_Script->setText(Doc->getScript());
Check_OpenDpl->setChecked(Doc->getSimOpenDpl());
Check_RunScript->setChecked(Doc->getSimRunScript());
Check_GridOn->setChecked(Doc->getGridOn());
Input_GridX->setText(QString::number(Doc->getGridX()));
Input_GridY->setText(QString::number(Doc->getGridY()));
Combo_Frame->setCurrentIndex(Doc->getShowFrame());
QString Text_;
decode_String(Text_ = Doc->Frame_Text0);
decode_String(Text_ = Doc->getFrame_Text0());
Input_Frame0->setText(Text_);
decode_String(Text_ = Doc->Frame_Text1);
decode_String(Text_ = Doc->getFrame_Text1());
Input_Frame1->setText(Text_);
decode_String(Text_ = Doc->Frame_Text2);
decode_String(Text_ = Doc->getFrame_Text2());
Input_Frame2->setText(Text_);
decode_String(Text_ = Doc->Frame_Text3);
decode_String(Text_ = Doc->getFrame_Text3());
Input_Frame3->setText(Text_);
resize(250, 200);
@ -229,86 +229,86 @@ void SettingsDialog::slotApply()
{
bool changed = false;
if(Doc->DataSet != Input_DataSet->text())
if(Doc->getDataSet() != Input_DataSet->text())
{
Doc->DataSet = Input_DataSet->text();
Doc->setDataSet(Input_DataSet->text());
changed = true;
}
if(Doc->DataDisplay != Input_DataDisplay->text())
if(Doc->getDataDisplay() != Input_DataDisplay->text())
{
Doc->DataDisplay = Input_DataDisplay->text();
Doc->setDataDisplay(Input_DataDisplay->text());
changed = true;
}
if(Doc->Script != Input_Script->text())
if(Doc->getScript() != Input_Script->text())
{
Doc->Script = Input_Script->text();
Doc->setScript(Input_Script->text());
changed = true;
}
if(Doc->SimOpenDpl != Check_OpenDpl->isChecked())
if(Doc->getSimOpenDpl() != Check_OpenDpl->isChecked())
{
Doc->SimOpenDpl = Check_OpenDpl->isChecked();
Doc->setSimOpenDpl(Check_OpenDpl->isChecked());
changed = true;
}
if(Doc->SimRunScript != Check_RunScript->isChecked())
if(Doc->getSimRunScript() != Check_RunScript->isChecked())
{
Doc->SimRunScript = Check_RunScript->isChecked();
Doc->setSimRunScript(Check_RunScript->isChecked());
changed = true;
}
if(Doc->GridOn != Check_GridOn->isChecked())
if(Doc->getGridOn() != Check_GridOn->isChecked())
{
Doc->GridOn = Check_GridOn->isChecked();
Doc->setGridOn(Check_GridOn->isChecked());
changed = true;
}
if(Doc->GridX != Input_GridX->text().toInt())
if(Doc->getGridX() != Input_GridX->text().toInt())
{
Doc->GridX = Input_GridX->text().toInt();
Doc->setGridX(Input_GridX->text().toInt());
changed = true;
}
if(Doc->GridY != Input_GridY->text().toInt())
if(Doc->getGridY() != Input_GridY->text().toInt())
{
Doc->GridY = Input_GridY->text().toInt();
Doc->setGridY(Input_GridY->text().toInt());
changed = true;
}
if(Doc->showFrame != Combo_Frame->currentIndex())
if(Doc->getShowFrame() != Combo_Frame->currentIndex())
{
Doc->showFrame = Combo_Frame->currentIndex();
Doc->setShowFrame(Combo_Frame->currentIndex());
changed = true;
}
QString t;
encode_String(Input_Frame0->toPlainText(), t);
if(Doc->Frame_Text0 != t)
if(Doc->getFrame_Text0() != t)
{
Doc->Frame_Text0 = t;
Doc->setFrame_Text0(t);
changed = true;
}
encode_String(Input_Frame1->text(), t);
if(Doc->Frame_Text1 != t)
if(Doc->getFrame_Text1() != t)
{
Doc->Frame_Text1 = t;
Doc->setFrame_Text1(t);
changed = true;
}
encode_String(Input_Frame2->text(), t);
if(Doc->Frame_Text2 != t)
if(Doc->getFrame_Text2() != t)
{
Doc->Frame_Text2 = t;
Doc->setFrame_Text2(t);
changed = true;
}
encode_String(Input_Frame3->text(), t);
if(Doc->Frame_Text3 != t)
if(Doc->getFrame_Text3() != t)
{
Doc->Frame_Text3 = t;
Doc->setFrame_Text3(t);
changed = true;
}
@ -345,7 +345,7 @@ AuxFilesDialog::AuxFilesDialog(QWidget *parent, const QString &filter) :QDialog(
//tree->header()->setStretchLastSection(false);
//tree->resizeColumnToContents(0);
tree->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
//tree->header()->setResizeMode(0, QHeaderView::Stretch);
//tree->header()->setResizeMode(0, QHeaderView::Stretch);
connect(tree, SIGNAL(doubleClicked(const QModelIndex &)), SLOT(slotDoubleClick(const QModelIndex &)));
setWindowTitle("Choose a file");
@ -355,7 +355,7 @@ AuxFilesDialog::AuxFilesDialog(QWidget *parent, const QString &filter) :QDialog(
Btns->setSpacing(5);
Btns->setContentsMargins(5,5,5,5);
layout->addLayout(Btns);
Btns->addStretch();
QPushButton *OkButt = new QPushButton(tr("Select"));
Btns->addWidget(OkButt);
@ -363,7 +363,7 @@ AuxFilesDialog::AuxFilesDialog(QWidget *parent, const QString &filter) :QDialog(
QPushButton *CancelButt = new QPushButton(tr("Cancel"));
Btns->addWidget(CancelButt);
connect(CancelButt, SIGNAL(clicked()), SLOT(reject()));
OkButt->setDefault(true);
resize(600, 300);

View File

@ -62,7 +62,7 @@
* simulator output messages
*/
SimMessage::SimMessage(QWidget *w, QWidget *parent)
: QDialog(parent)
: QDialog(parent)
{
setWindowTitle(tr("Qucs Simulation Messages"));
QucsDoc *Doc;
@ -72,15 +72,15 @@ SimMessage::SimMessage(QWidget *w, QWidget *parent)
else
Doc = (QucsDoc*) ((Schematic*)DocWidget);
DocName = Doc->DocName;
DataDisplay = Doc->DataDisplay;
Script = Doc->Script;
DocName = Doc->getDocName();
DataDisplay = Doc->getDataDisplay();
Script = Doc->getScript();
QFileInfo Info(DocName);
DataSet = QDir::toNativeSeparators(Info.path()) +
QDir::separator() + Doc->DataSet;
showBias = Doc->showBias; // save some settings as the document...
SimOpenDpl = Doc->SimOpenDpl; // ...could be closed during the simulation.
SimRunScript = Doc->SimRunScript;
QDir::separator() + Doc->getDataSet();
showBias = Doc->getShowBias(); // save some settings as the document...
SimOpenDpl = Doc->getSimOpenDpl(); // ...could be closed during the simulation.
SimRunScript = Doc->getSimRunScript();
all = new QVBoxLayout(this);
all->setSpacing(5);
@ -379,7 +379,7 @@ void SimMessage::startSimulator()
// Simulation.
if (Doc->simulation) {
SimTime = Doc->SimTime;
SimTime = Doc->getSimTime();
QString libs = Doc->Libraries.toLower();
/// \todo \bug error: unrecognized command line option '-Wl'
#if defined(_WIN32) || defined(__MINGW32__)
@ -417,25 +417,25 @@ void SimMessage::startSimulator()
QString dir = QDir::toNativeSeparators(QucsSettings.tempFilesDir.absolutePath());
QDir vhdlDir(dir);
if(!vhdlDir.exists("vhdl"))
if(!vhdlDir.mkdir("vhdl")) {
ErrText->appendPlainText(tr("ERROR: Cannot create VHDL directory \"%1\"!")
.arg(vhdlDir.path()+"/vhdl"));
return;
}
if(!vhdlDir.mkdir("vhdl")) {
ErrText->appendPlainText(tr("ERROR: Cannot create VHDL directory \"%1\"!")
.arg(vhdlDir.path()+"/vhdl"));
return;
}
vhdlDir.setPath(vhdlDir.path()+"/vhdl");
if(!vhdlDir.exists(lib))
if(!vhdlDir.mkdir(lib)) {
ErrText->appendPlainText(tr("ERROR: Cannot create VHDL directory \"%1\"!")
.arg(vhdlDir.path()+"/"+lib));
return;
}
if(!vhdlDir.mkdir(lib)) {
ErrText->appendPlainText(tr("ERROR: Cannot create VHDL directory \"%1\"!")
.arg(vhdlDir.path()+"/"+lib));
return;
}
vhdlDir.setPath(vhdlDir.path()+"/"+lib);
QFile destFile;
destFile.setFileName(vhdlDir.filePath(entity+".vhdl"));
if(!destFile.open(QIODevice::WriteOnly)) {
ErrText->appendPlainText(tr("ERROR: Cannot create \"%1\"!")
.arg(destFile.fileName()));
return;
ErrText->appendPlainText(tr("ERROR: Cannot create \"%1\"!")
.arg(destFile.fileName()));
return;
}
destFile.write(text.toLatin1(), text.length());
destFile.close();
@ -449,19 +449,18 @@ void SimMessage::startSimulator()
// Simulate schematic window.
else {
// output NodeSets, SPICE simulations etc.
for(QStringList::Iterator it = Collect.begin();
it != Collect.end(); ++it) {
for(QStringList::Iterator it = Collect.begin(); it != Collect.end(); ++it) {
// don't put library includes into netlist...
if ((*it).right(4) != ".lst" &&
(*it).right(5) != ".vhdl" &&
(*it).right(4) != ".vhd" &&
(*it).right(2) != ".v") {
Stream << *it << '\n';
(*it).right(5) != ".vhdl" &&
(*it).right(4) != ".vhd" &&
(*it).right(2) != ".v") {
Stream << *it << '\n';
}
}
Stream << '\n';
isVerilog = ((Schematic*)DocWidget)->isVerilog;
isVerilog = ((Schematic*)DocWidget)->getIsVerilog();
SimTime = ((Schematic*)DocWidget)->createNetlist(Stream, SimPorts);
if(SimTime.length()>0&&SimTime.at(0) == '\xA7') {
NetlistFile.close();
@ -471,12 +470,12 @@ void SimMessage::startSimulator()
}
if (isVerilog) {
Stream << "\n"
<< " initial begin\n"
<< " $dumpfile(\"digi.vcd\");\n"
<< " $dumpvars();\n"
<< " #" << SimTime << " $finish;\n"
<< " end\n\n"
<< "endmodule // TestBench\n";
<< " initial begin\n"
<< " $dumpfile(\"digi.vcd\");\n"
<< " $dumpvars();\n"
<< " #" << SimTime << " $finish;\n"
<< " end\n\n"
<< "endmodule // TestBench\n";
}
NetlistFile.close();
ProgText->insertPlainText(tr("done.\n")); // of "creating netlist...
@ -536,7 +535,7 @@ void SimMessage::startSimulator()
} // vaComponents not empty
if((SimOpt = findOptimization((Schematic*)DocWidget))) {
((Optimize_Sim*)SimOpt)->createASCOnetlist();
((Optimize_Sim*)SimOpt)->createASCOnetlist();
Program = QucsSettings.AscoBinDir.canonicalPath();
Program = QDir::toNativeSeparators(Program+"/"+"asco"+QString(executableSuffix));
@ -578,7 +577,7 @@ void SimMessage::startSimulator()
Program = QDir::toNativeSeparators(pathName(QucsSettings.BinDir + QucsDigi));
Arguments << QucsSettings.tempFilesDir.filePath("netlist.txt")
<< DataSet << SimTime.remove(" ") << pathName(SimPath)
<< pathName(QucsSettings.BinDir) << "-Wall" << "-c";
<< pathName(QucsSettings.BinDir) << "-Wall" << "-c";
#endif
}
@ -646,7 +645,7 @@ void SimMessage::startSimulator()
// ------------------------------------------------------------------------
Component * SimMessage::findOptimization(Schematic *Doc) {
Component *pc;
for(pc=Doc->Components->first(); pc!=0; pc=Doc->Components->next())
for(pc=Doc->a_Components->first(); pc!=0; pc=Doc->a_Components->next())
if(pc->isActive)
if(pc->Model == ".Opt")
return pc;
@ -690,7 +689,7 @@ void SimMessage::slotDisplayMsg()
wasLF = true;
QString tmps = ProgressText.left(i).trimmed();
if (!tmps.isEmpty()) // avoid adding a newline if no text to show
ProgText->appendPlainText(tmps);
ProgText->appendPlainText(tmps);
ProgressText.remove(0, i+1);
return;
}
@ -712,7 +711,7 @@ void SimMessage::slotUpdateProgressBar()
}
#endif
/*!
/*!
* \brief Insert process stderr output in the Error Message output window.
*
* Called when the process sends an output to stderr.
@ -731,7 +730,7 @@ void SimMessage::slotDisplayErr()
void SimMessage::slotStateChanged(QProcess::ProcessState newState)
{
static QProcess::ProcessState oldState;
qDebug() << "SimMessage::slotStateChanged() : newState = " << newState
qDebug() << "SimMessage::slotStateChanged() : newState = " << newState
<< " " << SimProcess.error();
switch(newState){
case QProcess::NotRunning:
@ -804,7 +803,7 @@ void SimMessage::slotSimEnded(int exitCode, QProcess::ExitStatus exitStatus )
/*!
* \brief Add end-of-simulation messages and save the relevant data.
*
* Called when the simulation ended with errors before starting the
* Called when the simulation ended with errors before starting the
* simulator process.
* \param[in] Status exit status of the process (0 = normal, !=0 = error)
*/
@ -836,7 +835,7 @@ void SimMessage::FinishSimulation(int Status)
stream << tr("Output:\n-------") << "\n\n";
for(int z=0; z<ProgText->document()->blockCount(); z++)
stream << ProgText->document()->findBlockByNumber(z).text() << "\n";
stream << "\n\n\n" <<
stream << "\n\n\n" <<
tr("Errors and Warnings:\n--------------------") << "\n\n";
for(int z=0; z<ErrText->document()->blockCount(); z++)
stream << ErrText->document()->findBlockByNumber(z).text() << "\n";
@ -848,15 +847,15 @@ void SimMessage::FinishSimulation(int Status)
QFile ifile(QucsSettings.tempFilesDir.filePath("asco_out.dat"));
QFile ofile(DataSet);
if(ifile.open(QIODevice::ReadOnly)) {
if(ofile.open(QIODevice::WriteOnly)) {
QByteArray data = ifile.readAll();
ofile.write(data);
ofile.close();
}
ifile.close();
if(ofile.open(QIODevice::WriteOnly)) {
QByteArray data = ifile.readAll();
ofile.write(data);
ofile.close();
}
ifile.close();
}
if(((Optimize_Sim*)SimOpt)->loadASCOout())
((Schematic*)DocWidget)->setChanged(true,true);
((Schematic*)DocWidget)->setChanged(true,true);
}
}
@ -903,15 +902,14 @@ void SimMessage::setDocWidget(QWidget *w)
else
Doc = (QucsDoc*) ((Schematic*)DocWidget);
DocName = Doc->DocName;
DataDisplay = Doc->DataDisplay;
Script = Doc->Script;
DocName = Doc->getDocName();
DataDisplay = Doc->getDataDisplay();
Script = Doc->getScript();
QFileInfo Info(DocName);
DataSet = QDir::toNativeSeparators(Info.path()) +
QDir::separator() + Doc->DataSet;
showBias = Doc->showBias; // save some settings as the document...
SimOpenDpl = Doc->SimOpenDpl; // ...could be closed during the simulation.
SimRunScript = Doc->SimRunScript;
QDir::separator() + Doc->getDataSet();
showBias = Doc->getShowBias(); // save some settings as the document...
SimOpenDpl = Doc->getSimOpenDpl(); // ...could be closed during the simulation.
SimRunScript = Doc->getSimRunScript();
}
// vim:ts=8:sw=2:et

View File

@ -35,11 +35,11 @@ mySpinBox::mySpinBox(int Min, int Max, int Step, double *Val, QWidget *Parent)
{
setMinimum(Min);
setMaximum(Max);
setSingleStep(Step);
setSingleStep(Step);
Values = Val;
ValueSize = Max;
//editor()->
// setReadOnly(true);
// setReadOnly(true);
}
@ -55,7 +55,7 @@ QString mySpinBox::textFromValue(int Val) const
QValidator::State mySpinBox::validate ( QString & text, int & pos ) const
{
if(pos>ValueSize)return QValidator::Invalid;
if(pos>ValueSize)return QValidator::Invalid;
if(QString::number(*(Values+pos))==text)
return QValidator::Acceptable;
else return QValidator::Invalid;
@ -63,7 +63,7 @@ QValidator::State mySpinBox::validate ( QString & text, int & pos ) const
SweepDialog::SweepDialog(Schematic *Doc_,QHash<QString,double> *NodeVals)
: QDialog(Doc_)
: QDialog(Doc_)
{
qDebug() << "SweepDialog::SweepDialog()";
@ -100,7 +100,7 @@ SweepDialog::SweepDialog(Schematic *Doc_,QHash<QString,double> *NodeVals)
DataX const *pD;
mySpinBox *Box;
for(unsigned ii=0; (pD=pGraph->axis(ii)); ++ii) {
all->addWidget(new QLabel(pD->Var, this), i,0);
//cout<<"count: "<<pD->count-1<<", points: "<<*pD->Points<<endl;
@ -111,7 +111,7 @@ SweepDialog::SweepDialog(Schematic *Doc_,QHash<QString,double> *NodeVals)
cout<<"Min: "<<Min<<", Max: "<<Max<<", Step: "<<Step<<endl;
Box = new mySpinBox(Min, Max, Step, pD->Points, this);*/
Box = new mySpinBox(0, pD->count-1, 1, pD->Points, this);
Box->setValue(0);
Box->setValue(0);
all->addWidget(Box, i++,1);
connect(Box, SIGNAL(valueChanged(int)), SLOT(slotNewValue(int)));
BoxList.append(Box);
@ -169,8 +169,8 @@ Graph* SweepDialog::setBiasPoints(QHash<QString,double> *NodeVals)
bool hasNoComp;
Graph *pg = new Graph(NULL, ""); // HACK!
QFileInfo Info(Doc->DocName);
QString DataSet = Info.absolutePath() + QDir::separator() + Doc->DataSet;
QFileInfo Info(Doc->getDocName());
QString DataSet = Info.absolutePath() + QDir::separator() + Doc->getDataSet();
Node *pn;
@ -183,7 +183,7 @@ Graph* SweepDialog::setBiasPoints(QHash<QString,double> *NodeVals)
ValueList.clear();
// create DC voltage for all nodes
for(pn = Doc->Nodes->first(); pn != 0; pn = Doc->Nodes->next()) {
for(pn = Doc->a_Nodes->first(); pn != 0; pn = Doc->a_Nodes->next()) {
if(pn->Name.isEmpty()) continue;
pn->x1 = 0;
@ -242,7 +242,7 @@ Graph* SweepDialog::setBiasPoints(QHash<QString,double> *NodeVals)
// create DC current through each probe
Component *pc;
for(pc = Doc->Components->first(); pc != 0; pc = Doc->Components->next())
for(pc = Doc->a_Components->first(); pc != 0; pc = Doc->a_Components->next())
if(pc->Model == "IProbe") {
pn = pc->Ports.first()->Connection;
if(!pn->Name.isEmpty()) // preserve node voltage ?
@ -298,7 +298,7 @@ Graph* SweepDialog::setBiasPoints(QHash<QString,double> *NodeVals)
}
Doc->showBias = 1;
Doc->setShowBias(1);
return pg;
}

View File

@ -48,15 +48,15 @@ VASettingsDialog::VASettingsDialog (TextDoc * Doc_)
Validator = new QRegularExpressionValidator (Expr, this);
vLayout = new QVBoxLayout(this);
QGroupBox * codeGroup = new QGroupBox (tr("Code Creation Settings"));
vLayout->addWidget(codeGroup);
QVBoxLayout *vbox = new QVBoxLayout();
codeGroup->setLayout(vbox);
QGridLayout * all = new QGridLayout ();
vbox->addLayout(all);
if (Doc->Icon.isEmpty ())
Doc->Icon = Module + ".png";
@ -69,7 +69,7 @@ VASettingsDialog::VASettingsDialog (TextDoc * Doc_)
IconEdit->setText (Doc->Icon);
IconEdit->setCursorPosition (0);
all->addWidget (IconEdit, 0, 1, 1, 3);
BrowseButt = new QPushButton (tr("Browse"));
connect (BrowseButt, SIGNAL (clicked()), SLOT (slotBrowse()));
all->addWidget (BrowseButt, 0, 4, 1, 1);
@ -94,7 +94,7 @@ VASettingsDialog::VASettingsDialog (TextDoc * Doc_)
ShortDescEdit = new QLineEdit ();
ShortDescEdit->setText (Doc->ShortDesc);
all->addWidget (ShortDescEdit, 2, 1, 1, 3);
if (Doc->LongDesc.isEmpty ())
Doc->LongDesc = Module + " verilog device";
@ -108,7 +108,7 @@ VASettingsDialog::VASettingsDialog (TextDoc * Doc_)
toggleGroupDev = new QButtonGroup ();
QRadioButton * nonRadio =
new QRadioButton (tr("unspecified device"));
QRadioButton * bjtRadio =
QRadioButton * bjtRadio =
new QRadioButton (tr("NPN/PNP polarity"));
QRadioButton * mosRadio =
new QRadioButton (tr("NMOS/PMOS polarity"));
@ -126,7 +126,7 @@ VASettingsDialog::VASettingsDialog (TextDoc * Doc_)
all->addWidget (mosRadio, 4, 4, 3, 4);
toggleGroupTyp = new QButtonGroup ();
QRadioButton * anaRadio =
QRadioButton * anaRadio =
new QRadioButton (tr("analog only"));
QRadioButton * digRadio =
new QRadioButton (tr("digital only"));
@ -154,7 +154,7 @@ VASettingsDialog::VASettingsDialog (TextDoc * Doc_)
connect (ButtonOk, SIGNAL(clicked()), SLOT(slotOk()));
connect (ButtonCancel, SIGNAL(clicked()), SLOT(reject()));
ButtonOk->setDefault(true);
}
VASettingsDialog::~VASettingsDialog ()
@ -178,8 +178,8 @@ void VASettingsDialog::slotOk ()
Doc->LongDesc = LongDescEdit->text ();
changed = true;
}
if (Doc->DataSet != OutputEdit->text ()) {
Doc->DataSet = OutputEdit->text ();
if (Doc->getDataSet() != OutputEdit->text ()) {
Doc->setDataSet(OutputEdit->text ());
changed = true;
}
if (Doc->recreate != RecreateCheck->isChecked ()) {

View File

@ -56,7 +56,7 @@ AbstractSpiceKernel::AbstractSpiceKernel(Schematic *schematic, QObject *parent)
a_sims(),
a_vars(),
a_output_files(),
a_DC_OP_only(schematic->showBias == 0 ? true : false),
a_DC_OP_only(schematic->getShowBias() == 0 ? true : false),
a_needsPrefix(false),
a_schematic(schematic),
a_parseFourTHD(false),
@ -64,7 +64,7 @@ AbstractSpiceKernel::AbstractSpiceKernel(Schematic *schematic, QObject *parent)
{
if (!checkDCSimulation()) { // Run Show bias mode automatically
a_DC_OP_only = true; // If schematic contains DC simulation only
a_schematic->showBias = 0;
a_schematic->setShowBias(0);
}
a_workdir = QucsSettings.S4Qworkdir;
@ -128,7 +128,7 @@ bool AbstractSpiceKernel::prepareSpiceNetlist(QTextStream &stream, bool isSubckt
bool AbstractSpiceKernel::checkSchematic(QStringList &incompat)
{
incompat.clear();
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if ((!pc->isEquation)&&!(pc->isProbe)) {
if (pc->SpiceModel.isEmpty() && pc->isActive) incompat.append(pc->Name);
}
@ -144,7 +144,7 @@ bool AbstractSpiceKernel::checkSchematic(QStringList &incompat)
bool AbstractSpiceKernel::checkGround()
{
bool r = false;
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if (pc->Model=="GND") {
r = true;
break;
@ -157,7 +157,7 @@ bool AbstractSpiceKernel::checkSimulations()
{
if (a_DC_OP_only) return true;
bool r = false;
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if (pc->isSimulation) {
r = true;
break;
@ -172,7 +172,7 @@ bool AbstractSpiceKernel::checkDCSimulation()
//if (a_DC_OP_only) return true;
//bool r = false;
//for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
//for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
// if (!pc->isActive) continue;
// if (pc->isSimulation && pc->Model != ".DC") {
// r = true;
@ -196,7 +196,7 @@ void AbstractSpiceKernel::startNetlist(QTextStream &stream, bool xyce)
QString s;
// User-defined functions
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if ((pc->SpiceModel==".FUNC")||
(pc->SpiceModel=="INCLSCR")) {
s = pc->getExpression();
@ -206,7 +206,7 @@ void AbstractSpiceKernel::startNetlist(QTextStream &stream, bool xyce)
// create .IC from wire labels
QStringList wire_labels;
for(Wire *pw = a_schematic->DocWires.first(); pw != 0; pw = a_schematic->DocWires.next()) {
for(Wire *pw = a_schematic->a_DocWires.first(); pw != 0; pw = a_schematic->a_DocWires.next()) {
if (pw->Label != nullptr) {
QString label = pw->Label->Name;
if (!wire_labels.contains(label)) wire_labels.append(label);
@ -218,7 +218,7 @@ void AbstractSpiceKernel::startNetlist(QTextStream &stream, bool xyce)
}
}
}
for(Node *pn = a_schematic->DocNodes.first(); pn != 0; pn = a_schematic->DocNodes.next()) {
for(Node *pn = a_schematic->a_DocNodes.first(); pn != 0; pn = a_schematic->a_DocNodes.next()) {
Conductor *pw = (Conductor*) pn;
if (pw->Label != nullptr) {
QString label = pw->Label->Name;
@ -233,7 +233,7 @@ void AbstractSpiceKernel::startNetlist(QTextStream &stream, bool xyce)
}
// Parameters, Initial conditions, Options
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if (pc->isEquation) {
s = pc->getExpression(xyce);
stream<<s;
@ -241,8 +241,8 @@ void AbstractSpiceKernel::startNetlist(QTextStream &stream, bool xyce)
}
// Components
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
if(a_schematic->isAnalog &&
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if(a_schematic->getIsAnalog() &&
!(pc->isSimulation) &&
!(pc->isEquation)) {
s = pc->getSpiceNetlist(xyce);
@ -251,7 +251,7 @@ void AbstractSpiceKernel::startNetlist(QTextStream &stream, bool xyce)
}
// Modelcards
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if (pc->SpiceModel==".MODEL") {
s = pc->getSpiceModel();
stream<<s;
@ -279,7 +279,7 @@ void AbstractSpiceKernel::createNetlist(QTextStream&, int ,QStringList&,
void AbstractSpiceKernel::createSubNetlsit(QTextStream &stream, bool lib)
{
QString header;
QString f = misc::properFileName(a_schematic->DocName);
QString f = misc::properFileName(a_schematic->getDocName());
header = QStringLiteral(".SUBCKT %1 ").arg(misc::properName(f));
QList< QPair<int,QString> > ports;
@ -288,7 +288,7 @@ void AbstractSpiceKernel::createSubNetlsit(QTextStream &stream, bool lib)
emit errors(QProcess::FailedToStart);
return;
} // Unable to perform spice simulation
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if (pc->Model=="Port") {
ports.append(qMakePair(pc->Props.first()->Value.toInt(),
pc->Ports.first()->Connection->Name));
@ -301,7 +301,7 @@ void AbstractSpiceKernel::createSubNetlsit(QTextStream &stream, bool lib)
}
Painting *pai;
for(pai = a_schematic->SymbolPaints.first(); pai != 0; pai = a_schematic->SymbolPaints.next())
for(pai = a_schematic->a_SymbolPaints.first(); pai != 0; pai = a_schematic->a_SymbolPaints.next())
if(pai->Name == ".ID ") {
ID_Text *pid = (ID_Text*)pai;
QList<SubParameter *>::const_iterator it;
@ -701,7 +701,7 @@ void AbstractSpiceKernel::parseDC_OPoutput(QString ngspice_file)
SweepDialog *swpdlg = new SweepDialog(a_schematic,&NodeVals);
delete swpdlg;
a_schematic->showBias = 1;
a_schematic->setShowBias(1);
}
/*!
@ -735,7 +735,7 @@ void AbstractSpiceKernel::parseDC_OPoutputXY(QString xyce_file)
SweepDialog *swpdlg = new SweepDialog(a_schematic,&NodeVals);
delete swpdlg;
a_schematic->showBias = 1;
a_schematic->setShowBias(1);
}
/*!
@ -1528,7 +1528,7 @@ bool AbstractSpiceKernel::waitEndOfSimulation()
QString AbstractSpiceKernel::collectSpiceLibs(Schematic* sch)
{
QStringList collected_spicelib;
for(Component *pc = sch->DocComps.first(); pc != 0; pc = sch->DocComps.next()) {
for(Component *pc = sch->a_DocComps.first(); pc != 0; pc = sch->a_DocComps.next()) {
if (pc->Model == "Sub") {
Schematic *sub = new Schematic(0, ((Subcircuit *)pc)->getSubcircuitFile());
if(!sub->loadDocument()) // load document if possible

View File

@ -163,14 +163,14 @@ void CustomSimDialog::slotCancel()
void CustomSimDialog::slotFindVars()
{
QStringList vars;
for(Node *pn = a_schematic->DocNodes.first(); pn != 0; pn = a_schematic->DocNodes.next()) {
for(Node *pn = a_schematic->a_DocNodes.first(); pn != 0; pn = a_schematic->a_DocNodes.next()) {
if(pn->Label != 0) {
if (!vars.contains(pn->Label->Name)) {
vars.append(pn->Label->Name);
}
}
}
for(Wire *pw = a_schematic->DocWires.first(); pw != 0; pw = a_schematic->DocWires.next()) {
for(Wire *pw = a_schematic->a_DocWires.first(); pw != 0; pw = a_schematic->a_DocWires.next()) {
if(pw->Label != 0) {
if (!vars.contains(pw->Label->Name)) {
vars.append(pw->Label->Name);
@ -178,7 +178,7 @@ void CustomSimDialog::slotFindVars()
}
}
for(Component *pc=a_schematic->DocComps.first();pc!=0;pc=a_schematic->DocComps.next()) {
for(Component *pc=a_schematic->a_DocComps.first();pc!=0;pc=a_schematic->a_DocComps.next()) {
if(pc->isProbe) {
if (!vars.contains(pc->getProbeVariable())) {
vars.append(pc->getProbeVariable());

View File

@ -90,7 +90,7 @@ ExternSimDialog::ExternSimDialog(Schematic *sch, bool netlist_mode) :
setLayout(vl_top);
slotSetSimulator();
if (!netlist_mode && !QucsMain->TuningMode && a_schematic->showBias != 0)
if (!netlist_mode && !QucsMain->TuningMode && a_schematic->getShowBias() != 0)
slotStart(); // Start simulation
}
@ -211,7 +211,7 @@ void ExternSimDialog::slotProcessOutput()
a_editSimConsole->insertPlainText("Simulation finished\n");
if ( !a_hasError ) {
QFileInfo inf(a_schematic->DocName);
QFileInfo inf(a_schematic->getDocName());
//QString qucs_dataset = inf.canonicalPath()+QDir::separator()+inf.baseName()+"_ngspice.dat";
QString qucs_dataset = inf.canonicalPath()+QDir::separator()+inf.completeBaseName()+ext;
switch (QucsSettings.DefaultSimulator) {
@ -230,7 +230,7 @@ void ExternSimDialog::slotProcessOutput()
//if (out.contains("error",Qt::CaseInsensitive))
// a_hasError = true;
emit simulated(this);
//if (a_schematic->showBias>0 || QucsMain->TuningMode) this->close();
//if (a_schematic->getShowBias()>0 || QucsMain->TuningMode) this->close();
}
@ -294,7 +294,7 @@ void ExternSimDialog::slotStop()
void ExternSimDialog::slotSaveNetlist()
{
QFileInfo inf(a_schematic->DocName);
QFileInfo inf(a_schematic->getDocName());
QString filename = QFileDialog::getSaveFileName(this,tr("Save netlist"),inf.path()+QDir::separator()+"netlist.cir",
"All files (*)");
if (filename.isEmpty()) return;

View File

@ -72,7 +72,7 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
{
Q_UNUSED(simulations);
stream << "* Qucs " << PACKAGE_VERSION << " " << a_schematic->DocName << "\n";
stream << "* Qucs " << PACKAGE_VERSION << " " << a_schematic->getDocName() << "\n";
// include math. functions for inter-simulator compat.
QString mathf_inc;
@ -101,14 +101,14 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
// set variable names for named nodes and wires
vars.clear();
for(Node *pn = a_schematic->DocNodes.first(); pn != 0; pn = a_schematic->DocNodes.next()) {
for(Node *pn = a_schematic->a_DocNodes.first(); pn != 0; pn = a_schematic->a_DocNodes.next()) {
if(pn->Label != 0) {
if (!vars.contains(pn->Label->Name)) {
vars.append(pn->Label->Name);
}
}
}
for(Wire *pw = a_schematic->DocWires.first(); pw != 0; pw = a_schematic->DocWires.next()) {
for(Wire *pw = a_schematic->a_DocWires.first(); pw != 0; pw = a_schematic->a_DocWires.next()) {
if(pw->Label != 0) {
if (!vars.contains(pw->Label->Name)) {
vars.append(pw->Label->Name);
@ -116,7 +116,7 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
}
}
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if (pc->isProbe) {
QString var_pr = pc->getProbeVariable();
if (!vars.contains(var_pr)) {
@ -150,8 +150,8 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
unsigned int pzSims = 0;
outputs.clear();
for ( unsigned int i = 0 ; i < a_schematic->DocComps.count() ; i++ ) {
Component *pc = a_schematic->DocComps.at(i);
for ( unsigned int i = 0 ; i < a_schematic->a_DocComps.count() ; i++ ) {
Component *pc = a_schematic->a_DocComps.at(i);
if ( !pc->isSimulation ) continue;
if ( pc->isActive != COMP_IS_ACTIVE ) continue;
@ -164,8 +164,8 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
QString cnt_var;
// Duplicate .PARAM in .control section. They may be used in euqations
for ( unsigned int i = 0 ; i < a_schematic->DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->DocComps.at(i);
for ( unsigned int i = 0 ; i < a_schematic->a_DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->a_DocComps.at(i);
if ( pc1->isActive != COMP_IS_ACTIVE ) continue;
if ( pc1->Model == "Eqn" ) {
spiceNetlist.append((reinterpret_cast<Equation *>(pc1))->getNgspiceScript());
@ -180,8 +180,8 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
nods.append(QStringLiteral("v(%1) ").arg(nod));
}
for ( unsigned int i = 0 ; i < a_schematic->DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->DocComps.at(i);
for ( unsigned int i = 0 ; i < a_schematic->a_DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->a_DocComps.at(i);
if ( !pc1->isSimulation ) continue;
if ( pc1->isActive != COMP_IS_ACTIVE ) continue;
QString sim_typ = pc1->Model;
@ -204,8 +204,8 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
} else if ( sim_typ == ".TR" ) {
timeSims++;
spiceNetlist.append(pc->getSpiceNetlist());
for ( unsigned int i = 0 ; i < a_schematic->DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->DocComps.at(i);
for ( unsigned int i = 0 ; i < a_schematic->a_DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->a_DocComps.at(i);
if ( !pc1->isSimulation ) continue;
if ( pc1->isActive != COMP_IS_ACTIVE ) continue;
if ( pc1->Model == ".FOURIER" ) {
@ -308,8 +308,8 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
if ( (sim_typ != ".PZ") && (sim_typ != ".SENS") && (sim_typ != ".SENS_AC") ) {
QStringList dep_vars;
for ( unsigned int i = 0 ; i < a_schematic->DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->DocComps.at(i);
for ( unsigned int i = 0 ; i < a_schematic->a_DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->a_DocComps.at(i);
if ( pc1->isActive != COMP_IS_ACTIVE ) continue;
if ( pc1->Model == "Eqn" || pc1->Model == "NutmegEq" )
spiceNetlist.append(pc1->getEquations(sim_name, dep_vars));
@ -338,8 +338,8 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
}
}
for ( unsigned int i = 0 ; i < a_schematic->DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->DocComps.at(i);
for ( unsigned int i = 0 ; i < a_schematic->a_DocComps.count() ; i++ ) {
Component *pc1 = a_schematic->a_DocComps.at(i);
if ( !pc1->isSimulation ) continue;
if ( pc1->isActive != COMP_IS_ACTIVE ) continue;
QString sim_typ = pc1->Model;
@ -386,8 +386,8 @@ QString Ngspice::getParentSWPscript(Component *pc_swp, QString sim, bool before,
{
hasDblSwp = false;
QString swp = pc_swp->Name.toLower();
for ( unsigned int i = 0 ; i < a_schematic->DocComps.count() ; i++ ) {
Component *pc = a_schematic->DocComps.at(i);
for ( unsigned int i = 0 ; i < a_schematic->a_DocComps.count() ; i++ ) {
Component *pc = a_schematic->a_DocComps.at(i);
if ( !pc->isSimulation ) continue;
if ( pc->isActive != COMP_IS_ACTIVE ) continue;
if ( pc->Model == ".SW" ) {
@ -500,7 +500,7 @@ void Ngspice::slotSimulate()
bool Ngspice::checkNodeNames(QStringList &incompat)
{
bool result = true;
for(Node *pn = a_schematic->DocNodes.first(); pn != 0; pn = a_schematic->DocNodes.next()) {
for(Node *pn = a_schematic->a_DocNodes.first(); pn != 0; pn = a_schematic->a_DocNodes.next()) {
if(pn->Label != 0) {
if (!spicecompat::check_nodename(pn->Label->Name)) {
incompat.append(pn->Label->Name);
@ -508,7 +508,7 @@ bool Ngspice::checkNodeNames(QStringList &incompat)
}
}
}
for(Wire *pw = a_schematic->DocWires.first(); pw != 0; pw = a_schematic->DocWires.next()) {
for(Wire *pw = a_schematic->a_DocWires.first(); pw != 0; pw = a_schematic->a_DocWires.next()) {
if(pw->Label != 0) {
if (!spicecompat::check_nodename(pw->Label->Name)) {
incompat.append(pw->Label->Name);
@ -527,7 +527,7 @@ bool Ngspice::checkNodeNames(QStringList &incompat)
QString Ngspice::collectSpiceinit(Schematic* sch)
{
QStringList collected_spiceinit;
for(Component *pc = sch->DocComps.first(); pc != 0; pc = sch->DocComps.next()) {
for(Component *pc = sch->a_DocComps.first(); pc != 0; pc = sch->a_DocComps.next()) {
if (pc->Model == "SPICEINIT") {
collected_spiceinit += ((SpiceSpiceinit*)pc)->getSpiceinit();
} else if (pc->Model == "Sub") {

View File

@ -159,7 +159,7 @@ bool VerilogAwriter::createVA_module(QTextStream &stream, Schematic *sch)
ports.clear();
nodes.clear();
for(Component *pc = sch->DocComps.first(); pc != 0; pc = sch->DocComps.next()) {
for(Component *pc = sch->a_DocComps.first(); pc != 0; pc = sch->a_DocComps.next()) {
if (pc->Model=="Port") { // Find module ports
QString s = pc->Ports.first()->Connection->Name;
if (!ports.contains(s)) ports.append(s);
@ -174,7 +174,7 @@ bool VerilogAwriter::createVA_module(QTextStream &stream, Schematic *sch)
if (ports.isEmpty()) return false; // Not a subcircuit
QFileInfo inf(sch->DocName);
QFileInfo inf(sch->getDocName());
QString base = inf.completeBaseName();
base.remove('-').remove(' ');
nodes.removeAll("gnd"); // Exclude ground node
@ -184,7 +184,7 @@ bool VerilogAwriter::createVA_module(QTextStream &stream, Schematic *sch)
stream<<QStringLiteral("electrical %1;\n").arg(nodes.join(", "));
Painting *pi; // Find module parameters
for(pi = sch->SymbolPaints.first(); pi != 0; pi = sch->SymbolPaints.next())
for(pi = sch->a_SymbolPaints.first(); pi != 0; pi = sch->a_SymbolPaints.next())
if(pi->Name == ".ID ") {
ID_Text *pid = (ID_Text*)pi;
QList<SubParameter *>::const_iterator it;
@ -197,7 +197,7 @@ bool VerilogAwriter::createVA_module(QTextStream &stream, Schematic *sch)
// List all variables
for(Component *pc = sch->DocComps.first(); pc != 0; pc = sch->DocComps.next()) {
for(Component *pc = sch->a_DocComps.first(); pc != 0; pc = sch->a_DocComps.next()) {
if (pc->isEquation && pc->isActive) {
stream<<pc->getVAvariables();
}
@ -207,7 +207,7 @@ bool VerilogAwriter::createVA_module(QTextStream &stream, Schematic *sch)
"@(initial_model)\n"
"begin \n";
// Output expressions
for(Component *pc = sch->DocComps.first(); pc != 0; pc = sch->DocComps.next()) {
for(Component *pc = sch->a_DocComps.first(); pc != 0; pc = sch->a_DocComps.next()) {
if (pc->isEquation && pc->isActive) {
stream<<pc->getVAExpressions();
}
@ -216,7 +216,7 @@ bool VerilogAwriter::createVA_module(QTextStream &stream, Schematic *sch)
stream<<"end\n";
// Convert components to current equations.
for(Component *pc = sch->DocComps.first(); pc != 0; pc = sch->DocComps.next()) {
for(Component *pc = sch->a_DocComps.first(); pc != 0; pc = sch->a_DocComps.next()) {
stream<<pc->getVerilogACode();
}

View File

@ -51,7 +51,7 @@ Xyce::Xyce(Schematic *schematic, QObject *parent) :
void Xyce::determineUsedSimulations(QStringList *sim_lst)
{
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if(pc->isSimulation && pc->isActive == COMP_IS_ACTIVE) {
QString sim_typ = pc->Model;
if (sim_typ==".AC") a_simulationsQueue.append("ac");
@ -85,7 +85,7 @@ void Xyce::createNetlist(QTextStream &stream, int , QStringList &simulations,
QString s;
bool hasParSweep = false;
stream << "* Qucs " << PACKAGE_VERSION << " " << a_schematic->DocName << "\n";
stream << "* Qucs " << PACKAGE_VERSION << " " << a_schematic->getDocName() << "\n";
stream<<collectSpiceLibs(a_schematic); // collect libraries on the top of netlist
if(!prepareSpiceNetlist(stream)) return; // Unable to perform spice simulation
@ -94,21 +94,21 @@ void Xyce::createNetlist(QTextStream &stream, int , QStringList &simulations,
// set variable names for named nodes and wires
vars.clear();
for(Node *pn = a_schematic->DocNodes.first(); pn != 0; pn = a_schematic->DocNodes.next()) {
for(Node *pn = a_schematic->a_DocNodes.first(); pn != 0; pn = a_schematic->a_DocNodes.next()) {
if(pn->Label != 0) {
if (!vars.contains(pn->Label->Name)) {
vars.append(pn->Label->Name);
}
}
}
for(Wire *pw = a_schematic->DocWires.first(); pw != 0; pw = a_schematic->DocWires.next()) {
for(Wire *pw = a_schematic->a_DocWires.first(); pw != 0; pw = a_schematic->a_DocWires.next()) {
if(pw->Label != 0) {
if (!vars.contains(pw->Label->Name)) {
vars.append(pw->Label->Name);
}
}
}
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if (pc->isProbe) {
QString var_pr = pc->getProbeVariable(true);
if (!vars.contains(var_pr)) {
@ -125,13 +125,13 @@ void Xyce::createNetlist(QTextStream &stream, int , QStringList &simulations,
if (a_DC_OP_only) {
// Add all remaining nodes, because XYCE has no equivalent for PRINT ALL
for(Node* pn = a_schematic->Nodes->first(); pn != 0; pn = a_schematic->Nodes->next()) {
for(Node* pn = a_schematic->a_Nodes->first(); pn != 0; pn = a_schematic->a_Nodes->next()) {
if ((!vars.contains(pn->Name))&&(pn->Name!="gnd")) {
vars.append(pn->Name);
}
}
// Add DC sources
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if ((pc->Model == "S4Q_V")||(pc->Model == "Vdc")) {
vars.append("I("+pc->Name+")");
}
@ -142,7 +142,7 @@ void Xyce::createNetlist(QTextStream &stream, int , QStringList &simulations,
//execute simulations
//QFileInfo inf(a_schematic->DocName);
//QFileInfo inf(a_schematic->getDocName());
//QString basenam = inf.baseName();
QString basenam = "spice4qucs";
@ -165,7 +165,7 @@ void Xyce::createNetlist(QTextStream &stream, int , QStringList &simulations,
QString sim = simulations.first();
QStringList spar_vars;
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) { // Xyce can run
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) { // Xyce can run
if(pc->isSimulation && pc->isActive == COMP_IS_ACTIVE) { // only one simulations per time.
QString sim_typ = pc->Model; // Multiple simulations are forbidden.
QString s = pc->getSpiceNetlist(true);
@ -180,7 +180,7 @@ void Xyce::createNetlist(QTextStream &stream, int , QStringList &simulations,
if (sim==pc->Name) stream<<s; // Xyce scripts
if ((sim_typ==".TR")&&(sim=="tran")){
stream<<s;
Q3PtrList<Component> comps(a_schematic->DocComps); // find Fourier tran
Q3PtrList<Component> comps(a_schematic->a_DocComps); // find Fourier tran
for(Component *pc1 = comps.first(); pc1 != 0; pc1 = comps.next()) {
if (pc1->Model==".FOURIER") {
if (pc1->Props.at(0)->Value==pc->Name) {
@ -214,7 +214,7 @@ void Xyce::createNetlist(QTextStream &stream, int , QStringList &simulations,
stream<<s;
hasParSweep = true;
} else if (SwpSim.startsWith("SW")&&(sim=="dc")) {
for(Component *pc1 = a_schematic->DocComps.first(); pc1 != 0; pc1 = a_schematic->DocComps.next()) {
for(Component *pc1 = a_schematic->a_DocComps.first(); pc1 != 0; pc1 = a_schematic->a_DocComps.next()) {
if ((pc1->Name==SwpSim)&&(pc1->Props.at(0)->Value.startsWith("DC"))) {
stream<<s;
hasParSweep = true;
@ -227,7 +227,7 @@ void Xyce::createNetlist(QTextStream &stream, int , QStringList &simulations,
}
if (sim.startsWith("XYCESCR")) {
for(Component *pc = a_schematic->DocComps.first(); pc != 0; pc = a_schematic->DocComps.next()) {
for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) {
if (pc->isSimulation)
if (sim == pc->Name)
outputs.append(pc->Props.at(2)->Value.split(';'));

View File

@ -121,8 +121,8 @@ bool loadSettings()
QucsSettings.XyceParExecutable = _settings::Get().item<QString>("XyceParExecutable");
QucsSettings.SpiceOpusExecutable = _settings::Get().item<QString>("SpiceOpusExecutable");
QucsSettings.NProcs = _settings::Get().item<int>("Nprocs");
// TODO: Currently the default settings cannot include other settings during initialisation. This is a
// TODO: Currently the default settings cannot include other settings during initialisation. This is a
// problem for this setting as it needs to include the QucsWorkDir setting. Therefore, set the default to an
// empty string and populate it here by brute force.
QucsSettings.S4Qworkdir = _settings::Get().item<QString>("S4Q_workdir");
@ -169,10 +169,10 @@ bool saveApplSettings()
{
QSettings settings ("qucs","qucs_s");
// Note: It is not really necessary to take the following reference, but it
// Note: It is not really necessary to take the following reference, but it
// arguably makes the code slightly cleaner - thoughts? To be clear:
// qs.item<int>() is identical to _settings::get().item<int>()
settingsManager& qs = _settings::Get();
settingsManager& qs = _settings::Get();
qs.setItem<int>("DefaultSimulator", QucsSettings.DefaultSimulator);
qs.setItem<bool>("firstRun", false);
@ -182,7 +182,7 @@ bool saveApplSettings()
if (QucsMain != nullptr) {
qs.setItem<QByteArray>("MainWindowGeometry", QucsMain->saveGeometry());
}
// store LargeFontSize as a string, so it will be also human-readable in the settings file (will be a @Variant() otherwise)
qs.setItem<QString>("LargeFontSize", QString::number(QucsSettings.largeFontSize));
qs.setItem<unsigned int>("maxUndo", QucsSettings.maxUndo);
@ -201,7 +201,7 @@ bool saveApplSettings()
qs.setItem<QString>("Directive", QucsSettings.Directive.name());
qs.setItem<QString>("Task", QucsSettings.Task.name());
qs.setItem<QString>("AdmsXmlBinDir", QucsSettings.AdmsXmlBinDir.canonicalPath());
qs.setItem<QString>("AscoBinDir", QucsSettings.AscoBinDir.canonicalPath());
qs.setItem<QString>("AscoBinDir", QucsSettings.AscoBinDir.canonicalPath());
qs.setItem<QString>("NgspiceExecutable",QucsSettings.NgspiceExecutable);
qs.setItem<QString>("XyceExecutable",QucsSettings.XyceExecutable);
qs.setItem<QString>("XyceParExecutable",QucsSettings.XyceParExecutable);
@ -209,7 +209,7 @@ bool saveApplSettings()
qs.setItem<QString>("Qucsator",QucsSettings.Qucsator);
qs.setItem<int>("Nprocs",QucsSettings.NProcs);
qs.setItem<QString>("S4Q_workdir",QucsSettings.S4Qworkdir);
qs.setItem<QString>("SimParameters",QucsSettings.SimParameters);
qs.setItem<QString>("SimParameters",QucsSettings.SimParameters);
qs.setItem<QString>("OctaveExecutable",QucsSettings.OctaveExecutable);
qs.setItem<QString>("OpenVAFExecutable",QucsSettings.OpenVAFExecutable);
qs.setItem<QString>("QucsHomeDir", QucsSettings.qucsWorkspaceDir.canonicalPath());
@ -446,11 +446,11 @@ int doPrint(QString schematic, QString printFile,
return 1;
}
sch->Nodes = &(sch->DocNodes);
sch->Wires = &(sch->DocWires);
sch->Diagrams = &(sch->DocDiags);
sch->Paintings = &(sch->DocPaints);
sch->Components = &(sch->DocComps);
sch->a_Nodes = &(sch->a_DocNodes);
sch->a_Wires = &(sch->a_DocWires);
sch->a_Diagrams = &(sch->a_DocDiags);
sch->a_Paintings = &(sch->a_DocPaints);
sch->a_Components = &(sch->a_DocComps);
sch->reloadGraphs();
qDebug() << "*** try to print file :" << printFile;

View File

@ -90,8 +90,8 @@ void MouseActions::setPainter(Schematic *Doc)
// contents to viewport transformation
Doc->PostPaintEvent(_Translate, -Doc->contentsX(), -Doc->contentsY());
Doc->PostPaintEvent(_Scale, Doc->Scale, Doc->Scale);
Doc->PostPaintEvent(_Translate, -Doc->ViewX1, -Doc->ViewY1);
Doc->PostPaintEvent(_Scale, Doc->getScale(), Doc->getScale());
Doc->PostPaintEvent(_Translate, -Doc->getViewX1(), -Doc->getViewY1());
Doc->PostPaintEvent(_NotRop);
}
@ -208,10 +208,10 @@ void MouseActions::endElementMoving(Schematic *Doc,
Doc->insertWire((Wire *)pe);
break;
case isDiagram:
Doc->Diagrams->append((Diagram *)pe);
Doc->a_Diagrams->append((Diagram *)pe);
break;
case isPainting:
Doc->Paintings->append((Painting *)pe);
Doc->a_Paintings->append((Painting *)pe);
break;
case isComponent:
case isAnalogComponent:
@ -628,7 +628,7 @@ void MouseActions::MMoveScrollBar(Schematic *Doc, QMouseEvent *Event)
// FIXME #warning QPainter p(Doc->viewport());
// FIXME #warning ViewPainter Painter;
// FIXME #warning Painter.init(&p, Doc->Scale, -Doc->ViewX1, -Doc->ViewY1,
// FIXME #warning Painter.init(&p, Doc->a_Scale, -Doc->getViewX1(), -Doc->getViewY1(),
// FIXME #warning Doc->contentsX(), Doc->contentsY());
// FIXME #warning Painter.fillRect(d->cx-d->x1, d->cy-d->y2, d->x2+d->x1, d->y2+d->y1,
// FIXME #warning QucsSettings.BGColor);
@ -905,7 +905,7 @@ void MouseActions::rightPressMenu(Schematic *Doc, QMouseEvent *Event, float fX,
Diagram* diagram = static_cast<Diagram*>(focusElement);
// Only show reset limits action if one or more axis is not autoscaled.
if (diagram->Name == "Rect" &&
if (diagram->Name == "Rect" &&
(!diagram->xAxis.autoScale || !diagram->yAxis.autoScale || !diagram->zAxis.autoScale)) {
ComponentMenu->addAction(QucsMain->resetDiagramLimits);
}
@ -1326,7 +1326,7 @@ void MouseActions::MPressRotate(Schematic *Doc, QMouseEvent *, float fX, float f
case isWire:
pl = ((Wire *) e)->Label;
((Wire *) e)->Label = 0; // prevent label to be deleted
Doc->Wires->setAutoDelete(false);
Doc->a_Wires->setAutoDelete(false);
Doc->deleteWire((Wire *) e);
((Wire *) e)->Label = pl;
((Wire *) e)->rotate();
@ -1335,8 +1335,8 @@ void MouseActions::MPressRotate(Schematic *Doc, QMouseEvent *, float fX, float f
if (pl)
Doc->setOnGrid(pl->cx, pl->cy);
Doc->insertWire((Wire *) e);
Doc->Wires->setAutoDelete(true);
if (Doc->Wires->containsRef((Wire *) e))
Doc->a_Wires->setAutoDelete(true);
if (Doc->a_Wires->containsRef((Wire *) e))
Doc->enlargeView(e->x1, e->y1, e->x2, e->y2);
break;
@ -1432,7 +1432,7 @@ void MouseActions::MPressElement(Schematic *Doc, QMouseEvent *Event, float, floa
return;
Diagram *Diag = (Diagram *) selElem;
QFileInfo Info(Doc->DocName);
QFileInfo Info(Doc->getDocName());
// dialog is Qt::WDestructiveClose !!!
DiagramDialog *dia = new DiagramDialog(Diag, Doc);
if (dia->exec() == QDialog::Rejected) { // don't insert if dialog canceled
@ -1440,7 +1440,7 @@ void MouseActions::MPressElement(Schematic *Doc, QMouseEvent *Event, float, floa
return;
}
Doc->Diagrams->append(Diag);
Doc->a_Diagrams->append(Diag);
Doc->enlargeView(Diag->cx, Diag->cy - Diag->y2, Diag->cx + Diag->x2, Diag->cy);
Doc->setChanged(true, true); // document has been changed
@ -1453,7 +1453,7 @@ void MouseActions::MPressElement(Schematic *Doc, QMouseEvent *Event, float, floa
// *********** it is a painting !!!
if (((Painting *) selElem)->MousePressing(Doc)) {
Doc->Paintings->append((Painting *) selElem);
Doc->a_Paintings->append((Painting *) selElem);
((Painting *) selElem)->Bounding(x1, y1, x2, y2);
//Doc->enlargeView(x1, y1, x2, y2);
selElem = ((Painting *) selElem)->newOne();
@ -1477,7 +1477,7 @@ void MouseActions::MPressWire1(Schematic *Doc, QMouseEvent *, float fX, float fY
//Doc->PostPaintEvent (PPENotRop);
//if(drawn) {
#if 0 //ALYS - it draws some garbage, not deleted because of possible questions
Doc->PostPaintEvent (_Line, 0, MAy3, MAx2, MAy3); // erase old mouse cross
Doc->PostPaintEvent (_Line, 0, MAy3, MAx2, MAy3); // erase old mouse cross
Doc->PostPaintEvent (_Line, MAx3, 0, MAx3, MAy2);
#endif
//}
@ -1554,10 +1554,10 @@ void MouseActions::MPressWire2(Schematic *Doc, QMouseEvent *Event, float fX, flo
case Qt::RightButton:
#if 0
//ALYS - old code preserved because isn't clear - what it was???
//looks like deletion via painting.
//i'll delete it after possible clarification from team
if(MAx1 == 0) {
//ALYS - old code preserved because isn't clear - what it was???
//looks like deletion via painting.
//i'll delete it after possible clarification from team
if(MAx1 == 0) {
Doc->PostPaintEvent (_Line, MAx3, MAy3, MAx3, MAy2); // erase old
Doc->PostPaintEvent (_Line, MAx3, MAy2, MAx2, MAy2); // erase old
}
@ -1620,7 +1620,7 @@ void MouseActions::MPressSetLimits(Schematic *Doc, QMouseEvent*, float fX, float
// TODO: Diagrams is currently a Q3PtrList, but it would be better to refactor
// this (and many other collections) to be std::vector.
// Check to see if the mouse is within a diagram using the oddly named "getSelected".
for (Diagram* diagram = Doc->Diagrams->last(); diagram != 0; diagram = Doc->Diagrams->prev()) {
for (Diagram* diagram = Doc->a_Diagrams->last(); diagram != 0; diagram = Doc->a_Diagrams->prev()) {
// BUG: Obtaining the diagram type by name is marked as a bug elsewhere (to be solved separately).
// TODO: Currently only rectangular diagrams are supported.
if (diagram->getSelected(fX, fY) && diagram->Name == "Rect") {
@ -1633,7 +1633,7 @@ void MouseActions::MPressSetLimits(Schematic *Doc, QMouseEvent*, float fX, float
QucsMain->MouseMoveAction = &MouseActions::MMoveSelect;
QucsMain->MouseReleaseAction = &MouseActions::MReleaseSetLimits;
Doc->grabKeyboard(); // no keyboard inputs during move actions
// No need to continue searching;
break;
}
@ -1746,7 +1746,7 @@ void MouseActions::MReleaseSelect2(Schematic *Doc, QMouseEvent *Event)
QucsMain->MouseReleaseAction = &MouseActions::MReleaseSelect;
QucsMain->MouseDoubleClickAction = &MouseActions::MDoubleClickSelect;
Doc->highlightWireLabels();
Doc->PostedPaintEvents.clear();
Doc->clearPostedPaintEvents();
Doc->viewport()->update();
}
@ -1869,16 +1869,16 @@ void MouseActions::MReleaseSetLimits(Schematic *Doc, QMouseEvent *Event)
qDebug() << "Mouse released after setting limits.";
// Check to see if the mouse is within a diagram using the oddly named "getSelected".
for (Diagram* diagram = Doc->Diagrams->last(); diagram != 0; diagram = Doc->Diagrams->prev()) {
for (Diagram* diagram = Doc->a_Diagrams->last(); diagram != 0; diagram = Doc->a_Diagrams->prev()) {
// Only process the selection if it ends in a diagram, and is the same diagram as start.
if (diagram->getSelected(MAx2, MAy2) && diagram == pActiveDiagram) {
qDebug() << "In the same diagram, setting limits";
mouseUpPoint = QPointF(MAx2 - diagram->cx, diagram->cy - MAy2);
// Normalise the selection in case user starts at bottom and/or right.
QRectF select = QRectF(mouseDownPoint, mouseUpPoint).normalized();
QRectF select = QRectF(mouseDownPoint, mouseUpPoint).normalized();
// Only process if there is a valid selection box.
if (select.width() < MIN_SELECT_SIZE || select.height() < MIN_SELECT_SIZE)
@ -1887,8 +1887,8 @@ void MouseActions::MReleaseSetLimits(Schematic *Doc, QMouseEvent *Event)
diagram->setLimitsBySelectionRect(select);
// TODO: Consider refactoring loadGraphData to reload the current dataset if an empty string is passed.
QFileInfo Info(Doc->DocName);
QString defaultDataSet = Info.absolutePath() + QDir::separator() + Doc->DataSet;
QFileInfo Info(Doc->getDocName());
QString defaultDataSet = Info.absolutePath() + QDir::separator() + Doc->getDataSet();
diagram->loadGraphData(defaultDataSet);
Doc->setChanged(true, true);
@ -1968,7 +1968,7 @@ void MouseActions::rotateElements(Schematic *Doc, int &x1, int &y1)
void MouseActions::MReleasePaste(Schematic *Doc, QMouseEvent *Event)
{
int x1, y1, x2, y2, rot;
QFileInfo Info(Doc->DocName);
QFileInfo Info(Doc->getDocName());
//QPainter painter(Doc->viewport());
Element *pe;
@ -1983,19 +1983,19 @@ void MouseActions::MReleasePaste(Schematic *Doc, QMouseEvent *Event)
if (pe->y1 == pe->y2)
break;
Doc->insertWire((Wire *) pe);
if (Doc->Wires->containsRef((Wire *) pe))
if (Doc->a_Wires->containsRef((Wire *) pe))
Doc->enlargeView(pe->x1, pe->y1, pe->x2, pe->y2);
else
pe = NULL;
break;
case isDiagram:
Doc->Diagrams->append((Diagram *) pe);
Doc->a_Diagrams->append((Diagram *) pe);
((Diagram *) pe)
->loadGraphData(Info.absolutePath() + QDir::separator() + Doc->DataSet);
->loadGraphData(Info.absolutePath() + QDir::separator() + Doc->getDataSet());
Doc->enlargeView(pe->cx, pe->cy - pe->y2, pe->cx + pe->x2, pe->cy);
break;
case isPainting:
Doc->Paintings->append((Painting *) pe);
Doc->a_Paintings->append((Painting *) pe);
((Painting *) pe)->Bounding(x1, y1, x2, y2);
Doc->enlargeView(x1, y1, x2, y2);
break;
@ -2104,7 +2104,7 @@ void MouseActions::editElement(Schematic *Doc, QMouseEvent *Event)
MarkerDialog *mdia;
int x1, y1, x2, y2;
QFileInfo Info(Doc->DocName);
QFileInfo Info(Doc->getDocName());
auto inModel = Doc->contentsToModel(Event->pos());
float fX = static_cast<float>(inModel.x());
float fY = static_cast<float>(inModel.y());
@ -2144,10 +2144,10 @@ void MouseActions::editElement(Schematic *Doc, QMouseEvent *Event)
if (cd->exec() != 1)
break; // dialog is WDestructiveClose
Doc->Components->findRef(c);
Doc->Components->take();
Doc->a_Components->findRef(c);
Doc->a_Components->take();
Doc->setComponentNumber(c); // for ports/power sources
Doc->Components->append(c);
Doc->a_Components->append(c);
}
Doc->setChanged(true, true);
@ -2185,7 +2185,7 @@ void MouseActions::editElement(Schematic *Doc, QMouseEvent *Event)
case isGraph:
pg = (Graph *) focusElement;
// searching diagram for this graph
for (dia = Doc->Diagrams->last(); dia != 0; dia = Doc->Diagrams->prev())
for (dia = Doc->a_Diagrams->last(); dia != 0; dia = Doc->a_Diagrams->prev())
if (dia->Graphs.indexOf(pg) >= 0)
break;
if (!dia)
@ -2308,7 +2308,7 @@ void MouseActions::MPressTune(Schematic *Doc, QMouseEvent *Event, float fX, floa
if (!App->tunerDia->containsProperty(pp)) {
if (isPropertyTunable(pc, pp)) {
tunerElement *tune = new tunerElement(App->tunerDia, pc, pp, No);
tune->schematicName = Doc->DocName;
tune->schematicName = Doc->getDocName();
if (tune != NULL)
App->tunerDia->addTunerElement(tune); //Tunable property
} else {

View File

@ -235,7 +235,7 @@ void PortSymbol::mirrorY()
}
bool PortSymbol::MousePressing(Schematic *sch) {
if (!sch->isSymbolOnly) {
if (!sch->getIsSymbolOnly()) {
return false;
}
QString text = QInputDialog::getText(nullptr, QObject::tr("Port name"),
@ -266,7 +266,7 @@ bool PortSymbol::Dialog(QWidget* /*parent*/Doc) {
// Forbid manual editing, change port name on schematic to change it in the symbol
// Allow to edit ports only for SymbolOnly documents (*.sym).
Schematic *sch = (Schematic *) Doc;
if (!sch->isSymbolOnly) {
if (!sch->getIsSymbolOnly()) {
return false;
}

View File

@ -121,7 +121,7 @@ QucsApp::QucsApp()
int h = size.height();
setGeometry (w * 0.25, h * 0.25, w * 0.5, h * 0.5);
}
QucsFileFilter =
tr("Schematic") + " (*.sch);;" +
tr("Symbol only") + " (*.sym);;" +
@ -360,7 +360,7 @@ void QucsApp::initView()
TabView->addTab(Content, tr("Content"));
TabView->setTabToolTip(TabView->indexOf(Content), tr("content of current project"));
connect(Content, SIGNAL(clicked(const QModelIndex &)),
connect(Content, SIGNAL(clicked(const QModelIndex &)),
SLOT(slotSelectSubcircuit(const QModelIndex &)));
connect(Content, SIGNAL(doubleClicked(const QModelIndex &)),
@ -444,7 +444,7 @@ void QucsApp::initView()
)";
CompComps->setStyleSheet(itemStyle);
#ifdef _MSC_VER
CompComps->setDragEnabled(false);
#endif
@ -722,7 +722,7 @@ QucsDoc * QucsApp::findDoc (QString File, int * Pos)
int No = 0;
File = QDir::toNativeSeparators (File);
while ((d = getDoc (No++)) != 0)
if (QDir::toNativeSeparators (d->DocName) == File) {
if (QDir::toNativeSeparators (d->getDocName()) == File) {
if (Pos) *Pos = No - 1;
return d;
}
@ -1171,7 +1171,7 @@ void QucsApp::initCursorMenu()
connect(action, SIGNAL(triggered()), SLOT(slot())); \
ContentMenu->addAction(action); \
}
APPEND_MENU(ActionCMenuOpen, slotCMenuOpen, "Open")
APPEND_MENU(ActionCMenuCopy, slotCMenuCopy, "Duplicate")
APPEND_MENU(ActionCMenuRename, slotCMenuRename, "Rename")
@ -1184,7 +1184,7 @@ void QucsApp::initCursorMenu()
// ----------------------------------------------------------
// Shows the menu.
void QucsApp::slotShowContentMenu(const QPoint& pos)
void QucsApp::slotShowContentMenu(const QPoint& pos)
{
QModelIndex idx = Content->indexAt(pos);
if (idx.isValid() && idx.parent().isValid()) {
@ -1192,7 +1192,7 @@ void QucsApp::slotShowContentMenu(const QPoint& pos)
idx.sibling(idx.row(), 1).data().toString().contains(tr("-port"))
);
ContentMenu->popup(Content->mapToGlobal(pos));
}
}
}
// ----------------------------------------------------------
@ -1240,10 +1240,10 @@ void QucsApp::slotCMenuCopy()
//check changed file save
int z = 0; //search if the doc is loaded
QucsDoc *d = findDoc(file, &z);
if (d != NULL && d->DocChanged) {
if (d != NULL && d->getDocChanged()) {
DocumentTab->setCurrentIndex(z);
int ret = QMessageBox::question(this, tr("Copying Qucs document"),
tr("The document contains unsaved changes!\n") +
tr("The document contains unsaved changes!\n") +
tr("Do you want to save the changes before copying?"),
QMessageBox::Ignore|QMessageBox::Save);
if (ret == QMessageBox::Save) {
@ -1319,7 +1319,7 @@ void QucsApp::slotCMenuRename()
bool ok;
QString s = QInputDialog::getText(this, tr("Rename file"), tr("Enter new filename:"), QLineEdit::Normal, base, &ok);
if(ok && !s.isEmpty()) {
if(ok && !s.isEmpty()) {
if (!s.endsWith(suffix)) {
s += QStringLiteral(".") + suffix;
}
@ -1489,7 +1489,7 @@ void QucsApp::slotButtonProjOpen()
QModelIndex idx = Projects->currentIndex();
if (!idx.isValid()) {
QMessageBox::information(this, tr("Info"),
tr("No project is selected !"));
tr("No project is selected !"));
} else {
slotListProjOpen(idx);
}
@ -1630,7 +1630,7 @@ void QucsApp::slotSymbolNew()
int i = addDocumentTab(d);
DocumentTab->setCurrentIndex(i);
slotSymbolEdit();
d->isSymbolOnly = true;
d->setIsSymbolOnly(true);
statusBar()->showMessage(tr("Ready."));
}
@ -1696,15 +1696,15 @@ bool QucsApp::gotoPage(const QString& Name)
// and skip any actions performed with a usual schematic.
Schematic *sch = (Schematic *)d;
slotSymbolEdit();
sch->isSymbolOnly = true;
sch->setIsSymbolOnly(true);
} else if (is_sch) {
Schematic *sch = (Schematic *)d;
if (sch->checkDplAndDatNames()) sch->setChanged(true,true);
}
// if only an untitled document was open -> close it
if(getDoc(0)->DocName.isEmpty())
if(!getDoc(0)->DocChanged)
if(getDoc(0)->getDocName().isEmpty())
if(!getDoc(0)->getDocChanged())
delete DocumentTab->widget(0);
return true;
@ -1740,7 +1740,7 @@ bool QucsApp::saveFile(QucsDoc *Doc)
if(!Doc)
Doc = getDoc();
if(Doc->DocName.isEmpty())
if(Doc->getDocName().isEmpty())
return saveAs();
int Result = Doc->save();
@ -1750,7 +1750,7 @@ bool QucsApp::saveFile(QucsDoc *Doc)
// definition. We don't want these files to be subject
// of any activities or "optimizations" which may change
// the symbol.
if (!Doc->DocName.endsWith(".sym")) {
if (!Doc->getDocName().endsWith(".sym")) {
updatePortNumber(Doc, Result);
}
slotUpdateTreeview();
@ -1788,7 +1788,7 @@ bool QucsApp::saveAs()
QString s, Filter;
QFileInfo Info;
while(true) {
s = Doc->DocName;
s = Doc->getDocName();
Info.setFile(s);
if(s.isEmpty()) { // which is default directory ?
if(ProjName.isEmpty()) {
@ -1804,16 +1804,16 @@ bool QucsApp::saveAs()
if(isTextDocument (w)) {
Filter = tr("VHDL Sources")+" (*.vhdl *.vhd);;" +
tr("Verilog Sources")+" (*.v);;"+
tr("Verilog-A Sources")+" (*.va);;"+
tr("Octave Scripts")+" (*.m *.oct);;"+
tr("Qucs Netlist")+" (*.net *.qnet);;"+
tr("SPICE Netlist")+" (*.ckt *.cir *.sp);;"+
tr("Plain Text")+" (*.txt);;"+
tr("Any File")+" (*)";
tr("Verilog Sources")+" (*.v);;"+
tr("Verilog-A Sources")+" (*.va);;"+
tr("Octave Scripts")+" (*.m *.oct);;"+
tr("Qucs Netlist")+" (*.net *.qnet);;"+
tr("SPICE Netlist")+" (*.ckt *.cir *.sp);;"+
tr("Plain Text")+" (*.txt);;"+
tr("Any File")+" (*)";
} else {
Schematic *sch = (Schematic *) Doc;
if (sch->isSymbolOnly) {
if (sch->getIsSymbolOnly()) {
Filter = tr("Subcircuit symbol") + "(*.sym)";
} else {
Filter = QucsFileFilter;
@ -1839,8 +1839,8 @@ bool QucsApp::saveAs()
Info.setFile(s);
if(QFile::exists(s)) {
n = QMessageBox::warning(this, tr("Warning"),
tr("The file '")+Info.fileName()+tr("' already exists!\n")+
tr("Saving will overwrite the old one! Continue?"),
tr("The file '")+Info.fileName()+tr("' already exists!\n")+
tr("Saving will overwrite the old one! Continue?"),
QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel,QMessageBox::Cancel);
if(n == QMessageBox::Cancel) return false; // cancel
if(n == QMessageBox::No) continue;
@ -1850,7 +1850,7 @@ bool QucsApp::saveAs()
QucsDoc * d = findDoc (s);
if(d) {
QMessageBox::information(this, tr("Info"),
tr("Cannot overwrite an open document"));
tr("Cannot overwrite an open document"));
return false;
}
@ -1867,7 +1867,7 @@ bool QucsApp::saveAs()
// definition. We don't want these files to be subject
// of any activities or "optimizations" which may change
// the symbol.
if (!Doc->DocName.endsWith(".sym")) {
if (!Doc->getDocName().endsWith(".sym")) {
updatePortNumber(Doc, n);
}
@ -1911,7 +1911,7 @@ void QucsApp::slotFileSaveAll()
int No=0;
QucsDoc *Doc; // search, if page is already loaded
while((Doc=getDoc(No++)) != 0) {
if(Doc->DocName.isEmpty()) // make document the current ?
if(Doc->getDocName().isEmpty()) // make document the current ?
DocumentTab->setCurrentIndex(No-1);
if (saveFile(Doc)) { // Hack! TODO: Maybe it's better to let slotFileChanged()
setDocumentTabChanged(No-1, false); // know about Tab number?
@ -1962,7 +1962,7 @@ void QucsApp::closeFile(int index)
slotHideEdit(); // disable text edit of component property
QucsDoc *Doc = getDoc(index);
if(Doc->DocChanged) {
if(Doc->getDocChanged()) {
switch(QMessageBox::warning(this,tr("Closing Qucs document"),
tr("The document contains unsaved changes!\n")+
tr("Do you want to save the changes before closing?"),
@ -1979,7 +1979,7 @@ void QucsApp::closeFile(int index)
if(DocumentTab->count() < 1) { // if no document left, create an untitled
Schematic *d = new Schematic(this, "");
addDocumentTab(d);
addDocumentTab(d);
DocumentTab->setCurrentIndex(0);
}
@ -1994,7 +1994,7 @@ bool QucsApp::closeAllFiles()
sd->setApp(this);
for(int i=0; i < DocumentTab->count(); ++i) {
QucsDoc *doc = getDoc(i);
if(doc->DocChanged)
if(doc->getDocChanged())
sd->addUnsavedDoc(doc);
}
int Result = SaveDialog::DontSave;
@ -2005,7 +2005,7 @@ bool QucsApp::closeAllFiles()
return false;
QucsDoc *doc = 0;
while((doc = getDoc()) != 0)
delete doc;
delete doc;
//switchEditMode(true); // set schematic edit mode
@ -2079,7 +2079,7 @@ void QucsApp::slotChangeView()
// already in schematic?
if(cursorLeft->isEnabled()) {
// which mode: schematic or symbol editor ?
if((CompChoose->count() > 1) == d->symbolMode)
if((CompChoose->count() > 1) == d->getSymbolMode())
changeSchematicSymbolMode (d);
}
else {
@ -2091,7 +2091,7 @@ void QucsApp::slotChangeView()
Doc->becomeCurrent(true);
// TODO proper window title
// QFileInfo Info (Doc-> DocName);
// QFileInfo Info (Doc-> getDocName());
//
// if (!ProjName.isEmpty()) {
// QDir parentDir = QucsSettings.QucsWorkDir;
@ -2159,7 +2159,7 @@ void QucsApp::updatePortNumber(QucsDoc *currDoc, int No)
{
if(No<0) return;
QString pathName = currDoc->DocName;
QString pathName = currDoc->getDocName();
QString ext = currDoc->fileSuffix ();
QFileInfo Info (pathName);
QString Model, File, Name = Info.fileName();
@ -2183,19 +2183,19 @@ void QucsApp::updatePortNumber(QucsDoc *currDoc, int No)
// start from the last to omit re-appended components
Schematic *Doc = (Schematic*)w;
for(Component *pc=Doc->Components->last(); pc!=0; ) {
for(Component *pc=Doc->a_Components->last(); pc!=0; ) {
if(pc->Model == Model) {
File = pc->Props.front()->Value;
if((File == pathName) || (File == Name)) {
pc_tmp = Doc->Components->prev();
pc_tmp = Doc->a_Components->prev();
Doc->recreateComponent(pc); // delete and re-append component
if(!pc_tmp) break;
Doc->Components->findRef(pc_tmp);
pc = Doc->Components->current();
Doc->a_Components->findRef(pc_tmp);
pc = Doc->a_Components->current();
continue;
}
}
pc = Doc->Components->prev();
pc = Doc->a_Components->prev();
}
}
}
@ -2307,7 +2307,7 @@ void QucsApp::slotIntoHierarchy()
QString s = pc->getSubcircuitFile();
if(!gotoPage(s)) { return; }
HierarchyHistory.push(Doc->DocName); //remember for the way back
HierarchyHistory.push(Doc->getDocName()); //remember for the way back
popH->setEnabled(true);
}
@ -2386,7 +2386,7 @@ void QucsApp::slotTune(bool checked)
bool found = false;
bool digi_found = false;
bool exit = false;
for(Component *pc = d->DocComps.first(); pc != 0; pc = d->DocComps.next()) {
for(Component *pc = d->a_DocComps.first(); pc != 0; pc = d->a_DocComps.next()) {
if (pc->isSimulation) {
found = true;
}
@ -2404,7 +2404,7 @@ void QucsApp::slotTune(bool checked)
QMessageBox::warning(this,tr("Error"),tr("Tuning not possible for digital simulation. "
"Only analog simulation supported."));
}
if (d->Diagrams->isEmpty() && !d->SimOpenDpl) {
if (d->a_Diagrams->isEmpty() && !d->getSimOpenDpl()) {
QMessageBox::warning(this,tr("Error"),tr("Tuning has no effect without diagrams. "
"Add at least one diagram on schematic."));
exit = true;
@ -2448,10 +2448,10 @@ void QucsApp::slotTune(bool checked)
QWidget *QucsApp::getSchematicWidget(QucsDoc *Doc)
{
QWidget *w = nullptr;
QFileInfo Info(QucsSettings.QucsWorkDir.filePath(Doc->DataDisplay));
QFileInfo Info(QucsSettings.QucsWorkDir.filePath(Doc->getDataDisplay()));
int z = 0;
QFileInfo sch_inf(Doc->DocName);
QString sch_name = sch_inf.absolutePath() + QDir::separator() + Doc->DataDisplay;
QFileInfo sch_inf(Doc->getDocName());
QString sch_name = sch_inf.absolutePath() + QDir::separator() + Doc->getDataDisplay();
QucsDoc *d = findDoc(sch_name, &z); // check if schematic is already open in a Tab
if (d)
@ -2505,7 +2505,7 @@ void QucsApp::slotSimulate(QWidget *w)
Schematic* schematicPtr = (Schematic*)w;
isDigital = schematicPtr->isDigitalCircuit();
if (isDigital && schematicPtr->showBias == 0) {
if (isDigital && schematicPtr->getShowBias() == 0) {
QMessageBox::warning(this,tr("Simulate schematic"),
tr("DC bias simulation mode is not supported "
"for digital schematic!"));
@ -2524,23 +2524,23 @@ void QucsApp::slotSimulate(QWidget *w)
if(isTextDocument (w)) {
Doc = (QucsDoc*)((TextDoc*)w);
if(Doc->SimTime.isEmpty() && ((TextDoc*)Doc)->simulation) {
if(Doc->getSimTime().isEmpty() && ((TextDoc*)Doc)->simulation) {
DigiSettingsDialog *d = new DigiSettingsDialog((TextDoc*)Doc);
if(d->exec() == QDialog::Rejected)
return;
return;
}
}
else
Doc = (QucsDoc*)((Schematic*)w);
if(Doc->DocName.isEmpty()) // if document 'untitled' ...
if(Doc->getDocName().isEmpty()) // if document 'untitled' ...
if(!saveAs()) return; // ... save schematic before
// Perhaps the document was modified from another program ?
QFileInfo Info(Doc->DocName);
QFileInfo Info(Doc->getDocName());
QString ext = Info.suffix();
if(Doc->lastSaved.isValid()) {
if(Doc->lastSaved < Info.lastModified()) {
if(Doc->getLastSaved().isValid()) {
if(Doc->getLastSaved() < Info.lastModified()) {
int No = QMessageBox::warning(this, tr("Warning"),
tr("The document was modified by another program !") + '\n' +
tr("Do you want to reload or keep this version ?"),
@ -2554,10 +2554,10 @@ void QucsApp::slotSimulate(QWidget *w)
if(Info.suffix() == "m" || Info.suffix() == "oct") {
// It is an Octave script.
if(Doc->DocChanged)
if(Doc->getDocChanged())
Doc->save();
slotViewOctaveDock(true);
octave->runOctaveScript(Doc->DocName);
octave->runOctaveScript(Doc->getDocName());
return;
}
@ -2571,9 +2571,9 @@ void QucsApp::slotSimulate(QWidget *w)
// disconnect is automatically performed, if one of the involved objects
// is destroyed !
connect(sim, SIGNAL(SimulationEnded(int, SimMessage*)), this,
SLOT(slotAfterSimulation(int, SimMessage*)));
SLOT(slotAfterSimulation(int, SimMessage*)));
connect(sim, SIGNAL(displayDataPage(QString&, QString&)),
this, SLOT(slotChangePage(QString&, QString&)));
this, SLOT(slotChangePage(QString&, QString&)));
if (TuningMode == true) {
connect(sim, SIGNAL(progressBarChanged(int)), tunerDia, SLOT(slotUpdateProgressBar(int)));
@ -2630,12 +2630,12 @@ void QucsApp::slotAfterSimulation(int Status, SimMessage *sim)
if(sim->SimOpenDpl) {
// switch to data display
if(sim->DataDisplay.right(2) == ".m" ||
sim->DataDisplay.right(4) == ".oct") { // Is it an Octave script?
octave->startOctave();
octave->runOctaveScript(sim->DataDisplay);
sim->DataDisplay.right(4) == ".oct") { // Is it an Octave script?
octave->startOctave();
octave->runOctaveScript(sim->DataDisplay);
}
else
slotChangePage(sim->DocName, sim->DataDisplay);
slotChangePage(sim->DocName, sim->DataDisplay);
//sim->slotClose(); // close and delete simulation window
}
else {
@ -2667,13 +2667,13 @@ void QucsApp::slotAfterSimulation(int Status, SimMessage *sim)
// ------------------------------------------------------------------------
void QucsApp::slotDCbias()
{
getDoc()->showBias = 0;
getDoc()->setShowBias(0);
slotSimulate();
}
// ------------------------------------------------------------------------
// Changes to the corresponding data display page or vice versa.
void QucsApp::slotChangePage(QString& DocName, QString& DataDisplay)
void QucsApp::slotChangePage(const QString& DocName, const QString& DataDisplay)
{
if(DataDisplay.isEmpty()) return;
@ -2692,7 +2692,7 @@ void QucsApp::slotChangePage(QString& DocName, QString& DataDisplay)
int i = 0;
if (ext != "vhd" && ext != "vhdl" && ext != "v" && ext != "va" &&
ext != "oct" && ext != "m") {
ext != "oct" && ext != "m") {
d = new Schematic(this, Name);
i = addDocumentTab((Schematic *)d, DataDisplay);
}
@ -2712,7 +2712,7 @@ void QucsApp::slotChangePage(QString& DocName, QString& DataDisplay)
}
else {
if(file.open(QIODevice::ReadWrite)) { // if document doesn't exist, create
d->DataDisplay = Info.fileName();
d->setDataDisplay(Info.fileName());
slotUpdateTreeview();
}
else {
@ -2743,16 +2743,16 @@ void QucsApp::slotChangePage(QString& DocName, QString& DataDisplay)
void QucsApp::slotToPage()
{
QucsDoc *d = getDoc();
if(d->DataDisplay.isEmpty()) {
if(d->getDataDisplay().isEmpty()) {
QMessageBox::critical(this, tr("Error"), tr("No page set !"));
return;
}
if(d->DocName.right(2) == ".m" ||
d->DocName.right(4) == ".oct")
if(d->getDocName().right(2) == ".m" ||
d->getDocName().right(4) == ".oct")
slotViewOctaveDock(true);
else
slotChangePage(d->DocName, d->DataDisplay);
slotChangePage(d->getDocName(), d->getDataDisplay());
}
// -------------------------------------------------------------------
@ -3054,7 +3054,7 @@ void QucsApp::switchEditMode(bool SchematicMode)
// ---------------------------------------------------------
void QucsApp::changeSchematicSymbolMode(Schematic *Doc)
{
if(Doc->symbolMode) {
if(Doc->getSymbolMode()) {
// go into select modus to avoid placing a forbidden element
select->setChecked(true);
@ -3080,7 +3080,7 @@ void QucsApp::slotSymbolEdit()
// in a text document (e.g. VHDL)
if (isTextDocument (w)) {
TextDoc *TDoc = (TextDoc*)w;
if (!TDoc->DocName.endsWith(".va")) {
if (!TDoc->getDocName().endsWith(".va")) {
QMessageBox::warning(this,tr("Error"),
tr("Symbol editing supported only for schematics and Verilog-A documents!"));
return;
@ -3091,9 +3091,9 @@ void QucsApp::slotSymbolEdit()
"for more details."));
}
// set 'DataDisplay' document of text file to symbol file
QFileInfo Info(TDoc->DocName);
QFileInfo Info(TDoc->getDocName());
QString sym = Info.completeBaseName()+".sym";
TDoc->DataDisplay = sym;
TDoc->setDataDisplay(sym);
// symbol file already loaded?
int paint_mode = 0;
@ -3101,16 +3101,16 @@ void QucsApp::slotSymbolEdit()
paint_mode = 1;
// change current page to appropriate symbol file
slotChangePage(TDoc->DocName,TDoc->DataDisplay);
slotChangePage(TDoc->getDocName(),TDoc->getDataDisplay());
// set 'DataDisplay' document of symbol file to original text file
Schematic *SDoc = (Schematic*)DocumentTab->currentWidget();
SDoc->DataDisplay = Info.fileName();
SDoc->setDataDisplay(Info.fileName());
// change into symbol mode
if (paint_mode) // but only switch coordinates if newly loaded
SDoc->switchPaintMode();
SDoc->symbolMode = true;
SDoc->setSymbolMode(true);
changeSchematicSymbolMode(SDoc);
SDoc->becomeCurrent(true);
SDoc->viewport()->update();
@ -3118,7 +3118,7 @@ void QucsApp::slotSymbolEdit()
// in a normal schematic, symbol file
else {
Schematic *SDoc = (Schematic*)w;
if (!SDoc->isSymbolOnly) {
if (!SDoc->getIsSymbolOnly()) {
slotHideEdit(); // disable text edit of component property
SDoc->switchPaintMode(); // twist the view coordinates
changeSchematicSymbolMode(SDoc);
@ -3150,7 +3150,7 @@ void QucsApp::slotPowerMatching()
Dia->setTwoPortMatch(false); // will also cause the corresponding impedance LineEdit to be updated
Schematic *sch = dynamic_cast<Schematic*>(w);
if (sch->SimOpenDpl || sch->DocName.endsWith(".dpl")) {
if (sch->getSimOpenDpl() || sch->getDocName().endsWith(".dpl")) {
slotToPage();
}
if(Dia->exec() != QDialog::Accepted)
@ -3169,11 +3169,11 @@ void QucsApp::slot2PortMatching()
QString DataSet;
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
int z = pm->pGraph->Var.indexOf(':');
if(z <= 0) DataSet = Doc->DataSet;
if(z <= 0) DataSet = Doc->getDataSet();
else DataSet = pm->pGraph->Var.mid(z+1);
double Freq = pm->powFreq();
QFileInfo Info(Doc->DocName);
QFileInfo Info(Doc->getDocName());
DataSet = Info.path()+QDir::separator()+DataSet;
Diagram *Diag = new Diagram();
@ -3238,7 +3238,7 @@ void QucsApp::slot2PortMatching()
Dia->setS22LineEdits(S22real, S22imag);
Schematic *sch = dynamic_cast<Schematic*>(w);
if (sch->SimOpenDpl || sch->DocName.endsWith(".dpl")) {
if (sch->getSimOpenDpl() || sch->getDocName().endsWith(".dpl")) {
slotToPage();
}
if(Dia->exec() != QDialog::Accepted)
@ -3436,7 +3436,7 @@ void QucsApp::slotSimulateWithSpice()
if (!isTextDocument(DocumentTab->currentWidget())) {
Schematic *sch = (Schematic*)DocumentTab->currentWidget();
if (TuningMode) {
QFileInfo Info(sch->DocName);
QFileInfo Info(sch->getDocName());
QString ext = Info.suffix();
if (ext == "dpl") {
QucsDoc *Doc = (QucsDoc *)sch;
@ -3445,26 +3445,26 @@ void QucsApp::slotSimulateWithSpice()
}
}
if (sch->DocName.isEmpty()) {
auto biasState = sch->showBias;
if (sch->getDocName().isEmpty()) {
auto biasState = sch->getShowBias();
QMessageBox::warning(this,tr("Simulate schematic"),
tr("Schematic not saved! Simulation of unsaved schematic "
"not possible. Save schematic first!"));
slotFileSaveAs();
sch->showBias = biasState;
sch->setShowBias(biasState);
}
ExternSimDialog *SimDlg = new ExternSimDialog(sch);
connect(SimDlg,SIGNAL(simulated(ExternSimDialog*)),
this,SLOT(slotAfterSpiceSimulation(ExternSimDialog*)));
connect(SimDlg,SIGNAL(warnings()),this,SLOT(slotShowWarnings()));
connect(SimDlg,SIGNAL(success()),this,SLOT(slotResetWarnings()));
if (TuningMode || sch->showBias == 0) SimDlg->slotStart();
if (TuningMode || sch->getShowBias() == 0) SimDlg->slotStart();
else SimDlg->exec();
/*disconnect(SimDlg,SIGNAL(simulated()),this,SLOT(slotAfterSpiceSimulation()));
disconnect(SimDlg,SIGNAL(warnings()),this,SLOT(slotShowWarnings()));
disconnect(SimDlg,SIGNAL(success()),this,SLOT(slotResetWarnings()));*/
/*if (SimDlg->wasSimulated && sch->SimOpenDpl)
if (sch->showBias < 1) slotChangePage(sch->DocName,sch->DataDisplay);
/*if (SimDlg->wasSimulated && sch->getSimOpenDpl())
if (sch->getShowBias() < 1) slotChangePage(sch->getDocName(),sch->getDataDisplay());
delete SimDlg;*/
} else {
QMessageBox::warning(this,tr("Simulate schematic"),
@ -3499,16 +3499,16 @@ void QucsApp::slotAfterSpiceSimulation(ExternSimDialog *SimDlg)
return;
}
if (SimDlg->wasSimulated()) {
if(sch->SimOpenDpl) {
if (sch->showBias < 1) {
if(sch->getSimOpenDpl()) {
if (sch->getShowBias() < 1) {
if (!TuningMode) {
slotChangePage(sch->DocName,sch->DataDisplay);
} else if (!sch->DocName.endsWith(".dpl")) {
slotChangePage(sch->DocName,sch->DataDisplay);
slotChangePage(sch->getDocName(),sch->getDataDisplay());
} else if (!sch->getDocName().endsWith(".dpl")) {
slotChangePage(sch->getDocName(),sch->getDataDisplay());
}
}
} else {
if (sch->showBias < 1 && !TuningMode) {
if (sch->getShowBias() < 1 && !TuningMode) {
int idx = Category::getModulesNr (QObject::tr("diagrams"));
CompChoose->setCurrentIndex(idx); // switch to diagrams
slotSetCompView (idx);
@ -3518,15 +3518,15 @@ void QucsApp::slotAfterSpiceSimulation(ExternSimDialog *SimDlg)
sch->reloadGraphs();
sch->viewport()->update();
if(sch->SimRunScript) {
if(sch->getSimRunScript()) {
// run script
octave->startOctave();
octave->runOctaveScript(sch->Script);
octave->runOctaveScript(sch->getScript());
}
if (TuningMode) {
tunerDia->SimulationEnded();
}
if (sch->showBias>0 || QucsMain->TuningMode) SimDlg->close();
if (sch->getShowBias()>0 || QucsMain->TuningMode) SimDlg->close();
}
void QucsApp::slotBuildVAModule()
@ -3534,7 +3534,7 @@ void QucsApp::slotBuildVAModule()
if (!isTextDocument(DocumentTab->currentWidget())) {
Schematic *Sch = (Schematic*)DocumentTab->currentWidget();
QFileInfo inf(Sch->DocName);
QFileInfo inf(Sch->getDocName());
QString filename = QFileDialog::getSaveFileName(this,tr("Save Verilog-A module"),
inf.path()+QDir::separator()+"testmodule.va",
"Verilog-A (*.va)");
@ -3564,7 +3564,7 @@ void QucsApp::slotBuildVAModule()
if (!isTextDocument(DocumentTab->currentWidget())) {
Schematic *Sch = (Schematic*)DocumentTab->currentWidget();
QFileInfo inf(Sch->DocName);
QFileInfo inf(Sch->getDocName());
QString msg,ext;
switch(mode) {
@ -3590,7 +3590,7 @@ void QucsApp::slotBuildVAModule()
switch(mode) {
case spicecompat::cmgenSUBifs: r = cmgen->createIFS(stream,Sch);
case spicecompat::cmgenEDDifs: {
for(Component *pc = Sch->DocComps.first(); pc != 0; pc = Sch->DocComps.next()) {
for(Component *pc = Sch->a_DocComps.first(); pc != 0; pc = Sch->a_DocComps.next()) {
if (pc->isSelected) {
r = cmgen->createIFSfromEDD(stream,Sch,pc);
break;
@ -3599,7 +3599,7 @@ void QucsApp::slotBuildVAModule()
}
break;
case spicecompat::cmgenEDDmod : {
for(Component *pc = Sch->DocComps.first(); pc != 0; pc = Sch->DocComps.next()) {
for(Component *pc = Sch->a_DocComps.first(); pc != 0; pc = Sch->a_DocComps.next()) {
if (pc->isSelected) {
r = cmgen->createMODfromEDD(stream,Sch,pc);
break;

View File

@ -186,7 +186,7 @@ private slots:
void slotChangeView();
void slotAfterSimulation(int, SimMessage*);
void slotDCbias();
void slotChangePage(QString&, QString&);
void slotChangePage(const QString&, const QString&);
void slotHideEdit();
void slotFileChanged(bool);
void slotSimSettings();

View File

@ -75,7 +75,7 @@ QRegularExpressionValidator Val_CompProp(Expr_CompProp, 0);
// -----------------------------------------------------------------------
// This function is called from all toggle actions.
bool QucsApp::performToggleAction(bool on, QAction *Action,
pToggleFunc Function, pMouseFunc MouseMove, pMouseFunc2 MousePress)
pToggleFunc Function, pMouseFunc MouseMove, pMouseFunc2 MousePress)
{
slotHideEdit(); // disable text edit of component property
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
@ -125,7 +125,7 @@ bool QucsApp::performToggleAction(bool on, QAction *Action,
void QucsApp::slotOnGrid(bool on)
{
performToggleAction(on, onGrid, &Schematic::elementsOnGrid,
&MouseActions::MMoveOnGrid, &MouseActions::MPressOnGrid);
&MouseActions::MMoveOnGrid, &MouseActions::MPressOnGrid);
}
// -----------------------------------------------------------------------
@ -133,7 +133,7 @@ void QucsApp::slotOnGrid(bool on)
void QucsApp::slotEditRotate(bool on)
{
performToggleAction(on, editRotate, &Schematic::rotateElements,
&MouseActions::MMoveRotate, &MouseActions::MPressRotate);
&MouseActions::MMoveRotate, &MouseActions::MPressRotate);
}
// -----------------------------------------------------------------------
@ -141,7 +141,7 @@ void QucsApp::slotEditRotate(bool on)
void QucsApp::slotEditMirrorX(bool on)
{
performToggleAction(on, editMirror, &Schematic::mirrorXComponents,
&MouseActions::MMoveMirrorX, &MouseActions::MPressMirrorX);
&MouseActions::MMoveMirrorX, &MouseActions::MPressMirrorX);
}
// -----------------------------------------------------------------------
@ -149,7 +149,7 @@ void QucsApp::slotEditMirrorX(bool on)
void QucsApp::slotEditMirrorY(bool on)
{
performToggleAction(on, editMirrorY, &Schematic::mirrorYComponents,
&MouseActions::MMoveMirrorY, &MouseActions::MPressMirrorY);
&MouseActions::MMoveMirrorY, &MouseActions::MPressMirrorY);
}
// -----------------------------------------------------------------------
@ -197,21 +197,21 @@ void QucsApp::slotEditDelete(bool on)
void QucsApp::slotSetWire(bool on)
{
performToggleAction(on, insWire, 0,
&MouseActions::MMoveWire1, &MouseActions::MPressWire1);
&MouseActions::MMoveWire1, &MouseActions::MPressWire1);
}
// -----------------------------------------------------------------------
void QucsApp::slotInsertLabel(bool on)
{
performToggleAction(on, insLabel, 0,
&MouseActions::MMoveLabel, &MouseActions::MPressLabel);
&MouseActions::MMoveLabel, &MouseActions::MPressLabel);
}
// -----------------------------------------------------------------------
void QucsApp::slotSetMarker(bool on)
{
performToggleAction(on, setMarker, 0,
&MouseActions::MMoveMarker, &MouseActions::MPressMarker);
&MouseActions::MMoveMarker, &MouseActions::MPressMarker);
}
// -----------------------------------------------------------------------
@ -219,7 +219,7 @@ void QucsApp::slotSetMarker(bool on)
void QucsApp::slotSetDiagramLimits(bool on)
{
performToggleAction(on, setDiagramLimits, 0,
&MouseActions::MMoveSetLimits, &MouseActions::MPressSetLimits);
&MouseActions::MMoveSetLimits, &MouseActions::MPressSetLimits);
}
// -----------------------------------------------------------------------
@ -227,17 +227,17 @@ void QucsApp::slotSetDiagramLimits(bool on)
void QucsApp::slotResetDiagramLimits()
{
if (view->focusElement && view->focusElement->Type == isDiagram)
{
{
Diagram* diagram = (Diagram*)(view->focusElement);
diagram->xAxis.autoScale = true;
diagram->yAxis.autoScale = true;
diagram->zAxis.autoScale = true;
// Now read in the data.
auto* Doc = (Schematic*)DocumentTab->currentWidget();
QFileInfo Info(Doc->DocName);
QString defaultDataSet = Info.absolutePath() + QDir::separator() + Doc->DataSet;
QFileInfo Info(Doc->getDocName());
QString defaultDataSet = Info.absolutePath() + QDir::separator() + Doc->getDataSet();
diagram->loadGraphData(defaultDataSet);
Doc->setChanged(true, true);
@ -253,7 +253,7 @@ void QucsApp::slotResetDiagramLimits()
void QucsApp::slotMoveText(bool on)
{
performToggleAction(on, moveText, 0,
&MouseActions::MMoveMoveTextB, &MouseActions::MPressMoveText);
&MouseActions::MMoveMoveTextB, &MouseActions::MPressMoveText);
}
// -----------------------------------------------------------------------
@ -269,7 +269,7 @@ void QucsApp::slotZoomIn(bool on)
}
else
performToggleAction(on, magPlus, 0,
&MouseActions::MMoveZoomIn, &MouseActions::MPressZoomIn);
&MouseActions::MMoveZoomIn, &MouseActions::MPressZoomIn);
}
@ -502,7 +502,7 @@ void QucsApp::slotInsertPort(bool on)
delete view->selElem; // delete previously selected component
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
if (Doc->symbolMode) {
if (Doc->getSymbolMode()) {
view->selElem = new PortSymbol();
} else {
view->selElem = new SubCirPort();
@ -555,7 +555,7 @@ void QucsApp::slotAlignTop()
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
if(!Doc->aligning(0))
QMessageBox::information(this, tr("Info"),
tr("At least two elements must be selected !"));
tr("At least two elements must be selected !"));
Doc->viewport()->update();
}
@ -568,7 +568,7 @@ void QucsApp::slotAlignBottom()
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
if(!Doc->aligning(1))
QMessageBox::information(this, tr("Info"),
tr("At least two elements must be selected !"));
tr("At least two elements must be selected !"));
Doc->viewport()->update();
}
@ -581,7 +581,7 @@ void QucsApp::slotAlignLeft()
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
if(!Doc->aligning(2))
QMessageBox::information(this, tr("Info"),
tr("At least two elements must be selected !"));
tr("At least two elements must be selected !"));
Doc->viewport()->update();
}
@ -594,7 +594,7 @@ void QucsApp::slotAlignRight()
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
if(!Doc->aligning(3))
QMessageBox::information(this, tr("Info"),
tr("At least two elements must be selected !"));
tr("At least two elements must be selected !"));
Doc->viewport()->update();
}
@ -629,7 +629,7 @@ void QucsApp::slotCenterHorizontal()
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
if(!Doc->aligning(4))
QMessageBox::information(this, tr("Info"),
tr("At least two elements must be selected !"));
tr("At least two elements must be selected !"));
Doc->viewport()->update();
}
@ -642,7 +642,7 @@ void QucsApp::slotCenterVertical()
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
if(!Doc->aligning(5))
QMessageBox::information(this, tr("Info"),
tr("At least two elements must be selected !"));
tr("At least two elements must be selected !"));
Doc->viewport()->update();
}
@ -918,8 +918,8 @@ void QucsApp::slotCallRFLayout()
tr("Layouting of display pages is not supported!"));
return;
}
input_file = sch->DocName;
QFileInfo inf(sch->DocName);
input_file = sch->getDocName();
QFileInfo inf(sch->getDocName());
odir = inf.absolutePath();
netlist_file = inf.absolutePath() + QDir::separator()
+ inf.baseName() + ".net";
@ -932,7 +932,7 @@ void QucsApp::slotCallRFLayout()
QStringList Collect;
QPlainTextEdit *ErrText = new QPlainTextEdit(); //dummy
int pNum = sch->prepareNetlist(stream, Collect, ErrText);
if (!sch->isAnalog) {
if (!sch->getIsAnalog()) {
QMessageBox::critical(this, tr("Error"), tr("Digital schematic not supported!"));
return;
}
@ -1119,7 +1119,7 @@ void QucsApp::slotCursorLeft(bool left)
Doc->viewport()->update();
return;
} else { // random selection. move all of them
view->moveElements(&movingElements, sign*Doc->GridX, 0);
view->moveElements(&movingElements, sign*Doc->getGridX(), 0);
view->MAx3 = 1; // sign for moved elements
view->endElementMoving(Doc, &movingElements);
}
@ -1185,7 +1185,7 @@ void QucsApp::slotCursorUp(bool up)
Doc->viewport()->update();
return;
}else{ // some random selection, put it back
view->moveElements(&movingElements, 0, ((up)?-1:1) * Doc->GridY);
view->moveElements(&movingElements, 0, ((up)?-1:1) * Doc->getGridY());
view->MAx3 = 1; // sign for moved elements
view->endElementMoving(Doc, &movingElements);
}
@ -1199,7 +1199,7 @@ void QucsApp::slotApplyCompText()
{
QFont f = QucsSettings.font;
Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
f.setPointSizeF( Doc->Scale * float(f.pointSize()) );
f.setPointSizeF( Doc->getScale() * float(f.pointSize()) );
editText->setFont(f);
Component *const component = dynamic_cast<Component*>(view->focusElement);
@ -1225,7 +1225,7 @@ void QucsApp::slotApplyCompText()
// TODO: rewrite with std::none_of after replacing Q3PtrList
// with modern container
bool is_unique = true;
for (auto* other : *Doc->Components) {
for (auto* other : *Doc->a_Components) {
if (other->Name == new_name) {
is_unique = false;
break;
@ -1328,10 +1328,10 @@ void QucsApp::slotImportData()
QString dname;
if (isTextDocument(DocumentTab->currentWidget())) {
TextDoc *doc = (TextDoc *)DocumentTab->currentWidget();
dname = doc->DocName;
dname = doc->getDocName();
} else {
Schematic *doc = (Schematic *)DocumentTab->currentWidget();
dname = doc->DocName;
dname = doc->getDocName();
}
QFileInfo inf(dname);
if (inf.exists()) {
@ -1404,7 +1404,7 @@ void QucsApp::slotExportGraphAsCsv()
int Count = g->countY * g->axis(0)->count;
for(n = 0; n < Count; n++) {
m = n;
for(unsigned ii=0; (pD=g->axis(ii)); ++ii) {
for(unsigned ii=0; (pD=g->axis(ii)); ++ii) {
Stream << *(pD->Points + m%pD->count) << ';';
m /= pD->count;
}
@ -1598,7 +1598,7 @@ void QucsApp::slotBuildModule()
builder->setProcessChannelMode(QProcess::MergedChannels);
// get current va document
QucsDoc *Doc = getDoc();
QString vaModule = Doc->fileBase(Doc->DocName);
QString vaModule = Doc->fileBase(Doc->getDocName());
QString admsXml = QucsSettings.AdmsXmlBinDir.canonicalPath();
@ -1689,7 +1689,7 @@ void QucsApp::buildWithOpenVAF()
builder->setProcessChannelMode(QProcess::MergedChannels);
// get current va document
QucsDoc *Doc = getDoc();
QString vaModule = Doc->DocName;
QString vaModule = Doc->getDocName();
QString openVAF = QucsSettings.OpenVAFExecutable;

View File

@ -21,36 +21,41 @@
#include "qucs.h"
QucsDoc::QucsDoc(QucsApp *App_, const QString& Name_)
QucsDoc::QucsDoc(QucsApp *App_, const QString& Name_) :
a_DocName(Name_),
a_DataSet(),
a_DataDisplay(),
a_Script(),
a_SimTime(),
a_lastSaved(),
a_Scale(1.0),
a_App(App_),
a_DocChanged(false),
a_SimOpenDpl(false),
a_SimRunScript(false),
a_showBias(-1), // don't show DC bias (currently for "Schematic" only)
a_GridOn(true),
a_tmpPosX(0),
a_tmpPosY(0)
{
App = App_;
GridOn = true;
DocName = Name_;
QFileInfo Info(DocName);
if(!DocName.isEmpty()) {
DocName = Info.absoluteFilePath();
QFileInfo Info(a_DocName);
if(!a_DocName.isEmpty()) {
a_DocName = Info.absoluteFilePath();
QString base = Info.completeBaseName();
QString ext = Info.suffix();
if(ext == "m" || ext == "oct")
SimTime = "1";
a_SimTime = "1";
DataSet = base + ".dat"; // name of the default dataset
Script = base + ".m"; // name of the default script
a_DataSet = base + ".dat"; // name of the default dataset
a_Script = base + ".m"; // name of the default script
if(ext != "dpl")
DataDisplay = base + ".dpl"; // name of default data display
a_DataDisplay = base + ".dpl"; // name of default data display
else {
DataDisplay = base + ".sch"; // name of default schematic
GridOn = false; // data display without grid (per default)
a_DataDisplay = base + ".sch"; // name of default schematic
a_GridOn = false; // data display without grid (per default)
}
}
SimOpenDpl = false;
SimRunScript = false;
DocChanged = false;
showBias = -1; // don't show DC bias (currently for "Schematic" only)
Scale = 1.0;
}
QString QucsDoc::fileSuffix (const QString& Name) {
@ -59,7 +64,7 @@ QString QucsDoc::fileSuffix (const QString& Name) {
}
QString QucsDoc::fileSuffix (void) {
return fileSuffix (DocName);
return fileSuffix (a_DocName);
}
QString QucsDoc::fileBase (const QString& Name) {
@ -68,6 +73,6 @@ QString QucsDoc::fileBase (const QString& Name) {
}
QString QucsDoc::fileBase (void) {
return fileBase (DocName);
return fileBase (a_DocName);
}

View File

@ -26,7 +26,7 @@ class QPrinter;
class QPainter;
class QucsDoc {
public:
public:
QucsDoc(QucsApp*, const QString&);
virtual ~QucsDoc() {};
@ -45,21 +45,48 @@ public:
static QString fileBase (const QString&);
QString fileBase (void);
QString DocName;
QString DataSet; // name of the default dataset
QString DataDisplay; // name of the default data display
QString Script;
QString SimTime; // used for VHDL simulation, but stored in datadisplay
QDateTime lastSaved;
float getScale() const { return a_Scale; }
bool getDocChanged() const { return a_DocChanged; }
void setDocChanged(bool value) { a_DocChanged = value; }
bool getSimOpenDpl() const { return a_SimOpenDpl; }
void setSimOpenDpl(bool value) { a_SimOpenDpl = value; }
bool getSimRunScript() const { return a_SimRunScript; }
void setSimRunScript(bool value) { a_SimRunScript = value; }
bool getGridOn() const { return a_GridOn; }
void setGridOn(bool value) { a_GridOn = value; }
QucsApp* getApp() const { return a_App; }
int getShowBias() const { return a_showBias; }
void setShowBias(int value) { a_showBias = value; }
QString getDocName() const { return a_DocName; }
void setDocName(const QString& value) { a_DocName = value; }
QString getDataSet() const { return a_DataSet; }
void setDataSet(const QString& value) { a_DataSet = value; }
QString getDataDisplay() const { return a_DataDisplay; }
void setDataDisplay(const QString& value) { a_DataDisplay = value; }
QString getScript() const { return a_Script; }
void setScript(const QString& value) { a_Script = value; }
QString getSimTime() const { return a_SimTime; }
void setSimTime(const QString& value) { a_SimTime = value; }
QDateTime getLastSaved() const { return a_lastSaved; }
void setLastSaved(const QDateTime& value) { a_lastSaved = value; }
float Scale;
QucsApp *App;
bool DocChanged;
bool SimOpenDpl; // open data display after simulation ?
bool SimRunScript; // run script after simulation ?
int showBias; // -1=no, 0=calculation running, >0=show DC bias points
bool GridOn;
int tmpPosX, tmpPosY;
protected:
QString a_DocName;
QString a_DataSet; // name of the default dataset
QString a_DataDisplay; // name of the default data display
QString a_Script;
QString a_SimTime; // used for VHDL simulation, but stored in datadisplay
QDateTime a_lastSaved;
float a_Scale;
QucsApp* a_App;
bool a_DocChanged;
bool a_SimOpenDpl; // open data display after simulation ?
bool a_SimRunScript; // run script after simulation ?
int a_showBias; // -1=no, 0=calculation running, >0=show DC bias points
bool a_GridOn;
int a_tmpPosX;
int a_tmpPosY;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -76,6 +76,7 @@ typedef QMap<QString, SubFile> SubMap;
class Schematic : public Q3ScrollView, public QucsDoc {
Q_OBJECT
public:
Schematic(QucsApp*, const QString&);
~Schematic();
@ -191,22 +192,57 @@ public:
bool checkDplAndDatNames();
/*! \brief Get (schematic) file reference */
QFileInfo getFileInfo (void) { return a_FileInfo; }
/*! \brief Set reference to file (schematic) */
void setFileInfo(QString FileName) { a_FileInfo = QFileInfo(FileName); }
QString getFrame_Text0() const { return a_Frame_Text0; }
void setFrame_Text0(const QString value) { a_Frame_Text0 = value; }
QString getFrame_Text1() const { return a_Frame_Text1; }
void setFrame_Text1(const QString value) { a_Frame_Text1 = value; }
QString getFrame_Text2() const { return a_Frame_Text2; }
void setFrame_Text2(const QString value) { a_Frame_Text2 = value; }
QString getFrame_Text3() const { return a_Frame_Text3; }
void setFrame_Text3(const QString value) { a_Frame_Text3 = value; }
int getShowFrame() const { return a_showFrame; }
void setShowFrame(int value) { a_showFrame = value; }
int getViewX1() const { return a_ViewX1; }
int getViewY1() const { return a_ViewY1; }
int getGridX() const { return a_GridX; }
void setGridX(int value) { a_GridX = value; }
int getGridY() const { return a_GridY; }
void setGridY(int value) { a_GridY = value; }
bool getSymbolMode() const { return a_symbolMode; }
void setSymbolMode(bool value) { a_symbolMode = value; }
bool getIsSymbolOnly() const { return a_isSymbolOnly; }
void setIsSymbolOnly(bool value) { a_isSymbolOnly = value; }
void clearPostedPaintEvents() { a_PostedPaintEvents.clear(); }
// The pointers points to the current lists, either to the schematic
// elements "Doc..." or to the symbol elements "SymbolPaints".
Q3PtrList<Wire> *Wires, DocWires;
Q3PtrList<Node> *Nodes, DocNodes;
Q3PtrList<Diagram> *Diagrams, DocDiags;
Q3PtrList<Painting> *Paintings, DocPaints;
Q3PtrList<Component> *Components, DocComps;
Q3PtrList<Wire> *a_Wires;
Q3PtrList<Wire> a_DocWires;
Q3PtrList<Node>* a_Nodes;
Q3PtrList<Node> a_DocNodes;
Q3PtrList<Diagram>* a_Diagrams;
Q3PtrList<Diagram> a_DocDiags;
Q3PtrList<Painting>* a_Paintings;
Q3PtrList<Painting> a_DocPaints;
Q3PtrList<Component>* a_Components;
Q3PtrList<Component> a_DocComps;
Q3PtrList<Painting> SymbolPaints; // symbol definition for subcircuit
Q3PtrList<Painting> a_SymbolPaints; // symbol definition for subcircuit
QList<PostedPaintEvent> PostedPaintEvents;
bool symbolMode; // true if in symbol painting mode
bool isSymbolOnly;
private:
QList<PostedPaintEvent> a_PostedPaintEvents;
bool a_symbolMode; // true if in symbol painting mode
bool a_isSymbolOnly;
// Horizontal and vertical grid step
int GridX, GridY;
int a_GridX;
int a_GridY;
// Variables View* are the coordinates of top-level and bottom-right corners
// of a rectangle representing the schematic "model". This
@ -215,26 +251,33 @@ public:
// inside this rectangle. The size of this rectangle is the "logical" size
// of the schematic. The comment in "renderModel" method describes how
// these variables ("model") is used to draw the scematic.
int ViewX1, ViewY1, ViewX2, ViewY2;
int a_ViewX1;
int a_ViewY1;
int a_ViewX2;
int a_ViewY2;
int showFrame;
QString Frame_Text0, Frame_Text1, Frame_Text2, Frame_Text3;
int a_showFrame;
QString a_Frame_Text0;
QString a_Frame_Text1;
QString a_Frame_Text2;
QString a_Frame_Text3;
// Two of those data sets are needed for Schematic and for symbol.
// Which one is in "tmp..." depends on "symbolMode".
float tmpScale;
int tmpViewX1, tmpViewY1, tmpViewX2, tmpViewY2;
int tmpUsedX1, tmpUsedY1, tmpUsedX2, tmpUsedY2;
float a_tmpScale;
int a_tmpViewX1;
int a_tmpViewY1;
int a_tmpViewX2;
int a_tmpViewY2;
int a_tmpUsedX1;
int a_tmpUsedY1;
int a_tmpUsedX2;
int a_tmpUsedY2;
int undoActionIdx;
QVector<QString *> undoAction;
int undoSymbolIdx;
QVector<QString *> undoSymbol; // undo stack for circuit symbol
/*! \brief Get (schematic) file reference */
QFileInfo getFileInfo (void) { return FileInfo; }
/*! \brief Set reference to file (schematic) */
void setFileInfo(QString FileName) { FileInfo = QFileInfo(FileName); }
int a_undoActionIdx;
QVector<QString *> a_undoAction;
int a_undoSymbolIdx;
QVector<QString *> a_undoSymbol; // undo stack for circuit symbol
signals:
void signalCursorPosChanged(int, int, QString);
@ -267,27 +310,30 @@ private:
// Variables Used* hold the coordinates of top-left and bottom-right corners
// of a smallest rectangle which can fit all elements of the schematic.
// This rectangle exists in the same coordinate system as View*-rectangle
int UsedX1, UsedY1, UsedX2, UsedY2;
int a_UsedX1;
int a_UsedY1;
int a_UsedX2;
int a_UsedY2;
void sizeOfAll(int&, int&, int&, int&);
void sizeOfAll(int&, int&, int&, int&);
// Viewport-realative coordinates of the cursor between mouse movements.
// Used in "pan with mouse" feature.
QPoint previousCursorPosition;
QPoint a_previousCursorPosition;
bool dragIsOkay;
bool a_dragIsOkay;
/*! \brief hold system-independent information about a schematic file */
QFileInfo FileInfo;
QFileInfo a_FileInfo;
/**
Minimum scale at which schematic could be drawn.
*/
static constexpr double minScale = 0.1;
static constexpr double a_minScale = 0.1;
/**
Maximum scale at which schematic could be drawn.
*/
static constexpr double maxScale = 10.0;
static constexpr double a_maxScale = 10.0;
/**
Returns a rectangle which describes the model plane of the schematic.
@ -462,6 +508,11 @@ public:
void clearSignalsAndFileList();
void clearSignals();
void setIsAnalog(bool value) { a_isAnalog = value; }
bool getIsAnalog() const { return a_isAnalog; }
void setIsVerilog(bool value) { a_isVerilog = value; }
bool getIsVerilog() const { return a_isVerilog; }
private:
int saveDocument();
@ -491,14 +542,12 @@ private:
void endNetlistDigital(QTextStream &);
bool throughAllComps(QTextStream *, int&, QStringList&, QPlainTextEdit *, int);
DigMap Signals; // collecting node names for VHDL signal declarations
QStringList PortTypes;
public:
bool isAnalog;
bool isVerilog;
bool creatingLib;
DigMap a_Signals; // collecting node names for VHDL signal declarations
QStringList a_PortTypes;
bool a_isAnalog;
bool a_isVerilog;
bool a_creatingLib;
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,7 @@
QRect Schematic::modelRect()
{
return QRect{ViewX1, ViewY1, ViewX2 - ViewX1, ViewY2 - ViewY1};
return QRect{a_ViewX1, a_ViewY1, a_ViewX2 - a_ViewX1, a_ViewY2 - a_ViewY1};
}
QRect Schematic::viewportRect() {
@ -91,17 +91,17 @@ QPoint Schematic::contentsToModel(const QPoint& coordinates)
// in model plane
// QPoint overrides operator /. It divides both coordinates on given value
QPoint modelCoords = coordinates / Scale;
QPoint modelCoords = coordinates / a_Scale;
modelCoords.setX(ViewX1 + modelCoords.x());
modelCoords.setY(ViewY1 + modelCoords.y());
modelCoords.setX(a_ViewX1 + modelCoords.x());
modelCoords.setY(a_ViewY1 + modelCoords.y());
return modelCoords;
}
QPoint Schematic::modelToContents(const QPoint& coordinates)
{
// Model and contents sizes are interconnected and obey the rule:
// <size on model plane> * <Scale> = <size on contents>
// <size on model plane> * <a_Scale> = <size on contents>
//
// Contents is a rectangle with (0, 0) at its top-left corner. Model plane
// is rectangular area of abstract infinite plane, so model plane's top-left
@ -114,17 +114,17 @@ QPoint Schematic::modelToContents(const QPoint& coordinates)
// 2. Adjust resulting coordinates so thay they become having the same scale
// as contents
QPoint contentsCoords{coordinates.x() - ViewX1, coordinates.y() - ViewY1};
contentsCoords *= Scale;
QPoint contentsCoords{coordinates.x() - a_ViewX1, coordinates.y() - a_ViewY1};
contentsCoords *= a_Scale;
return contentsCoords;
}
double Schematic::clipScale(double offeredScale)
{
if (offeredScale > maxScale) {
return maxScale;
} else if (offeredScale < minScale) {
return minScale;
if (offeredScale > a_maxScale) {
return a_maxScale;
} else if (offeredScale < a_minScale) {
return a_minScale;
} else {
return offeredScale;
}
@ -134,7 +134,7 @@ bool Schematic::shouldRender(const double& newScale, const QRect& newModelBounds
const QRect currentModelBounds = modelRect();
// This point currently displayed at "viewportCoords" of the viewport
const QPoint currenlyDisplayed = viewportToModel(viewportCoords);
return Scale != newScale || toBeDisplayed != currenlyDisplayed || currentModelBounds != newModelBounds;
return a_Scale != newScale || toBeDisplayed != currenlyDisplayed || currentModelBounds != newModelBounds;
}
double Schematic::renderModel(const double offeredScale, QRect newModel, const QPoint modelPoint, const QPoint viewportPoint)
@ -151,7 +151,7 @@ double Schematic::renderModel(const double offeredScale, QRect newModel, const Q
// Maybe there is no need to do anything
const double newScale = clipScale(offeredScale);
if (!shouldRender(newScale, newModel, modelPoint, viewportPoint)) {
return Scale;
return a_Scale;
}
// The part below is quite tricky: while working at the model plane scale,
@ -176,19 +176,19 @@ double Schematic::renderModel(const double offeredScale, QRect newModel, const Q
// At this point everything is ready for rendering and positioning
// Set new model size
ViewX1 = newModel.left();
ViewY1 = newModel.top();
ViewX2 = newModel.left() + newModel.width();
ViewY2 = newModel.top() + newModel.height();
a_ViewX1 = newModel.left();
a_ViewY1 = newModel.top();
a_ViewX2 = newModel.left() + newModel.width();
a_ViewY2 = newModel.top() + newModel.height();
Scale = newScale;
resizeContents(static_cast<int>(std::round(newModel.width() * Scale)),
static_cast<int>(std::round(newModel.height() * Scale)));
a_Scale = newScale;
resizeContents(static_cast<int>(std::round(newModel.width() * a_Scale)),
static_cast<int>(std::round(newModel.height() * a_Scale)));
auto contentTopLeft = modelToContents(vpTopLeftOnModelPlane);
setContentsPos(contentTopLeft.x(), contentTopLeft.y());
viewport()->update();
return Scale;
}
return a_Scale;
}

View File

@ -51,7 +51,7 @@ TextDoc::TextDoc(QucsApp *App_, const QString& Name_) : QPlainTextEdit(), QucsDo
SetChanged = false;
devtype = DEV_DEF;
tmpPosX = tmpPosY = 1; // set to 1 to trigger line highlighting
a_tmpPosX = a_tmpPosY = 1; // set to 1 to trigger line highlighting
setLanguage (Name_);
viewport()->setFocus();
@ -125,22 +125,22 @@ void TextDoc::setLanguage (int lang)
*/
bool TextDoc::saveSettings (void)
{
QFile file (DocName + ".cfg");
QFile file (a_DocName + ".cfg");
if (!file.open (QIODevice::WriteOnly))
return false;
QTextStream stream (&file);
stream << "Textfile settings file, Qucs " PACKAGE_VERSION "\n"
<< "Simulation=" << simulation << "\n"
<< "Duration=" << SimTime << "\n"
<< "Module=" << (!simulation) << "\n"
<< "Library=" << Library << "\n"
<< "Libraries=" << Libraries << "\n"
<< "ShortDesc=" << ShortDesc << "\n"
<< "LongDesc=" << LongDesc << "\n"
<< "Icon=" << Icon << "\n"
<< "Recreate=" << recreate << "\n"
<< "DeviceType=" << devtype << "\n";
<< "Simulation=" << simulation << "\n"
<< "Duration=" << a_SimTime << "\n"
<< "Module=" << (!simulation) << "\n"
<< "Library=" << Library << "\n"
<< "Libraries=" << Libraries << "\n"
<< "ShortDesc=" << ShortDesc << "\n"
<< "LongDesc=" << LongDesc << "\n"
<< "Icon=" << Icon << "\n"
<< "Recreate=" << recreate << "\n"
<< "DeviceType=" << devtype << "\n";
file.close ();
SetChanged = false;
@ -153,7 +153,7 @@ bool TextDoc::saveSettings (void)
*/
bool TextDoc::loadSettings (void)
{
QFile file (DocName + ".cfg");
QFile file (a_DocName + ".cfg");
if (!file.open (QIODevice::ReadOnly))
return false;
@ -168,7 +168,7 @@ bool TextDoc::loadSettings (void)
if (Setting == "Simulation") {
simulation = Line.toInt (&ok);
} else if (Setting == "Duration") {
SimTime = Line;
a_SimTime = Line;
} else if (Setting == "Module") {
} else if (Setting == "Library") {
Library = Line;
@ -197,15 +197,15 @@ bool TextDoc::loadSettings (void)
*/
void TextDoc::setName (const QString& Name_)
{
DocName = Name_;
setLanguage (DocName);
a_DocName = Name_;
setLanguage (a_DocName);
QFileInfo Info (DocName);
QFileInfo Info (a_DocName);
DataSet = Info.baseName () + ".dat";
DataDisplay = Info.baseName () + ".dpl";
a_DataSet = Info.baseName () + ".dat";
a_DataDisplay = Info.baseName () + ".dpl";
if(Info.suffix() == "m" || Info.suffix() == "oct")
SimTime = "1";
a_SimTime = "1";
}
/*!
@ -222,32 +222,32 @@ void TextDoc::becomeCurrent (bool)
emit signalRedoState(document()->isRedoAvailable());
// update appropriate menu entries
App->symEdit->setText (tr("Edit Text Symbol"));
App->symEdit->setStatusTip (tr("Edits the symbol for this text document"));
App->symEdit->setWhatsThis (
tr("Edit Text Symbol\n\nEdits the symbol for this text document"));
a_App->symEdit->setText (tr("Edit Text Symbol"));
a_App->symEdit->setStatusTip (tr("Edits the symbol for this text document"));
a_App->symEdit->setWhatsThis (
tr("Edit Text Symbol\n\nEdits the symbol for this text document"));
if (language == LANG_VHDL) {
App->insEntity->setText (tr("VHDL entity"));
App->insEntity->setStatusTip (tr("Inserts skeleton of VHDL entity"));
App->insEntity->setWhatsThis (
tr("VHDL entity\n\nInserts the skeleton of a VHDL entity"));
a_App->insEntity->setText (tr("VHDL entity"));
a_App->insEntity->setStatusTip (tr("Inserts skeleton of VHDL entity"));
a_App->insEntity->setWhatsThis (
tr("VHDL entity\n\nInserts the skeleton of a VHDL entity"));
}
else if (language == LANG_VERILOG || language == LANG_VERILOGA) {
App->insEntity->setText (tr("Verilog module"));
App->insEntity->setStatusTip (tr("Inserts skeleton of Verilog module"));
App->insEntity->setWhatsThis (
tr("Verilog module\n\nInserts the skeleton of a Verilog module"));
App->buildModule->setEnabled(true);
a_App->insEntity->setText (tr("Verilog module"));
a_App->insEntity->setStatusTip (tr("Inserts skeleton of Verilog module"));
a_App->insEntity->setWhatsThis (
tr("Verilog module\n\nInserts the skeleton of a Verilog module"));
a_App->buildModule->setEnabled(true);
}
else if (language == LANG_OCTAVE) {
App->insEntity->setText (tr("Octave function"));
App->insEntity->setStatusTip (tr("Inserts skeleton of Octave function"));
App->insEntity->setWhatsThis (
tr("Octave function\n\nInserts the skeleton of a Octave function"));
a_App->insEntity->setText (tr("Octave function"));
a_App->insEntity->setStatusTip (tr("Inserts skeleton of Octave function"));
a_App->insEntity->setWhatsThis (
tr("Octave function\n\nInserts the skeleton of a Octave function"));
}
App->simulate->setEnabled (true);
App->editActivate->setEnabled (true);
a_App->simulate->setEnabled (true);
a_App->editActivate->setEnabled (true);
}
bool TextDoc::baseSearch(const QString &str, bool CaseSensitive, bool wordOnly, bool backward)
@ -320,8 +320,8 @@ void TextDoc::slotCursorPosChanged()
int x = pos.blockNumber();
int y = pos.columnNumber();
emit signalCursorPosChanged(x+1, y+1, "");
tmpPosX = x;
tmpPosY = y;
a_tmpPosX = x;
a_tmpPosY = y;
}
/*!
@ -329,13 +329,13 @@ void TextDoc::slotCursorPosChanged()
*/
void TextDoc::slotSetChanged()
{
if((document()->isModified() && !DocChanged) || SetChanged) {
DocChanged = true;
if((document()->isModified() && !a_DocChanged) || SetChanged) {
a_DocChanged = true;
}
else if((!document()->isModified() && DocChanged)) {
DocChanged = false;
else if((!document()->isModified() && a_DocChanged)) {
a_DocChanged = false;
}
emit signalFileChanged(DocChanged);
emit signalFileChanged(a_DocChanged);
emit signalUndoState(document()->isUndoAvailable());
emit signalRedoState(document()->isRedoAvailable());
}
@ -352,7 +352,7 @@ QMenu *TextDoc::createStandardContextMenu()
QMenu *popup = QPlainTextEdit::createStandardContextMenu();
if (language != LANG_OCTAVE) {
((QWidget *) popup)->addAction(App->fileSettings);
((QWidget *) popup)->addAction(a_App->fileSettings);
}
return popup;
}
@ -363,19 +363,19 @@ QMenu *TextDoc::createStandardContextMenu()
*/
bool TextDoc::load ()
{
QFile file (DocName);
QFile file (a_DocName);
if (!file.open (QIODevice::ReadOnly))
return false;
setLanguage (DocName);
setLanguage (a_DocName);
QTextStream stream (&file);
insertPlainText(stream.readAll());
document()->setModified(false);
slotSetChanged ();
file.close ();
lastSaved = QDateTime::currentDateTime ();
a_lastSaved = QDateTime::currentDateTime ();
loadSettings ();
SimOpenDpl = simulation ? true : false;
a_SimOpenDpl = simulation ? true : false;
refreshLanguage();
return true;
}
@ -389,10 +389,10 @@ int TextDoc::save ()
{
saveSettings ();
QFile file (DocName);
QFile file (a_DocName);
if (!file.open (QIODevice::WriteOnly))
return -1;
setLanguage (DocName);
setLanguage (a_DocName);
QTextStream stream (&file);
stream << toPlainText();
@ -400,8 +400,8 @@ int TextDoc::save ()
slotSetChanged ();
file.close ();
QFileInfo Info (DocName);
lastSaved = Info.lastModified ();
QFileInfo Info (a_DocName);
a_lastSaved = Info.lastModified ();
/// clear highlighted lines on save \see MessageDock::slotCursor()
QList<QTextEdit::ExtraSelection> extraSelections;
@ -412,7 +412,7 @@ int TextDoc::save ()
}
/*!
* \brief Zooms the document in and out. Note, the zoom amount is fixed by Qt and the
* \brief Zooms the document in and out. Note, the zoom amount is fixed by Qt and the
* amount passed is ignored.
*/
float TextDoc::zoomBy(float zoom)
@ -441,14 +441,14 @@ void TextDoc::showNoZoom()
}
/*!
* \brief TextDoc::loadSimulationTime set SimTime member variable
* \brief TextDoc::loadSimulationTime set a_SimTime member variable
* \param Time string with simulation time
* \return true if SimTime is set
* \return true if a_SimTime is set
*/
bool TextDoc::loadSimulationTime(QString& Time)
{
if(!SimTime.isEmpty()) {
Time = SimTime;
if(!a_SimTime.isEmpty()) {
Time = a_SimTime;
return true;
}
return false;
@ -517,13 +517,13 @@ void TextDoc::insertSkeleton ()
{
if (language == LANG_VHDL)
appendPlainText("entity is\n port ( : in bit);\nend;\n"
"architecture of is\n signal : bit;\nbegin\n\nend;\n\n");
"architecture of is\n signal : bit;\nbegin\n\nend;\n\n");
else if (language == LANG_VERILOG)
appendPlainText ("module ( );\ninput ;\noutput ;\nbegin\n\nend\n"
"endmodule\n\n");
"endmodule\n\n");
else if (language == LANG_OCTAVE)
appendPlainText ("function = ( )\n"
"endfunction\n\n");
"endfunction\n\n");
}
/*!
@ -550,7 +550,7 @@ QString TextDoc::getModuleName (void)
}
case LANG_OCTAVE:
{
QFileInfo Info (DocName);
QFileInfo Info (a_DocName);
return Info.baseName ();
}
default:
@ -568,7 +568,7 @@ void TextDoc::wheelEvent(QWheelEvent* event)
if (event->angleDelta().y() > 0) {
zoomIn();
}
else {
zoomOut();
}
@ -603,7 +603,7 @@ void TextDoc::highlightCurrentLine()
void TextDoc::refreshLanguage()
{
this->setLanguage(DocName);
this->setLanguage(a_DocName);
syntaxHighlight->setLanguage(language);
syntaxHighlight->setDocument(document());
}