Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for CDL netlist export #1049

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions qucs/components/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -1493,7 +1493,7 @@ void MultiViewComponent::recreate(Schematic *Doc) {

if (Doc) {
Doc->insertRawComponent(this);
Doc->Components->setAutoDelete(true);
Doc->a_Components->setAutoDelete(true);
}
}

Expand Down
70 changes: 35 additions & 35 deletions qucs/components/componentdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand Down Expand Up @@ -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;
}
Expand All @@ -248,23 +248,23 @@ 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");
}
slotNumberChanged(0);
++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)));
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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*)),
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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());
Expand Down Expand Up @@ -1061,18 +1061,18 @@ 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();
}
} else { // a file name is not defined
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"),
Expand Down Expand Up @@ -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));
}

/*!
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
48 changes: 24 additions & 24 deletions qucs/components/optimizedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@


OptimizeDialog::OptimizeDialog(Optimize_Sim *c_, Schematic *d_)
: QDialog(d_)
: QDialog(d_)
{
Comp = c_;
Doc = d_;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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...
Expand Down Expand Up @@ -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));
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions qucs/components/sp_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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++;
}
Expand Down
Loading
Loading