diff --git a/qucs/components/component.cpp b/qucs/components/component.cpp index 9490d1ea..5ce3ba8d 100644 --- a/qucs/components/component.cpp +++ b/qucs/components/component.cpp @@ -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); } } diff --git a/qucs/components/componentdialog.cpp b/qucs/components/componentdialog.cpp index 0562e78d..de83fbfa 100644 --- a/qucs/components/componentdialog.cpp +++ b/qucs/components/componentdialog.cpp @@ -40,7 +40,7 @@ #include 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 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; diff --git a/qucs/components/optimizedialog.cpp b/qucs/components/optimizedialog.cpp index f2372c92..702dce30 100644 --- a/qucs/components/optimizedialog.cpp +++ b/qucs/components/optimizedialog.cpp @@ -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 "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n"); + "\n" + "\n" + "\n" + "\n" + "\n" + "\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)); } } } diff --git a/qucs/components/sp_sim.cpp b/qucs/components/sp_sim.cpp index 919727ea..0e340a6d 100644 --- a/qucs/components/sp_sim.cpp +++ b/qucs/components/sp_sim.cpp @@ -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++; } diff --git a/qucs/components/spicedialog.cpp b/qucs/components/spicedialog.cpp index 7b085918..230d8331 100644 --- a/qucs/components/spicedialog.cpp +++ b/qucs/components/spicedialog.cpp @@ -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)); } // ------------------------------------------------------------------------- diff --git a/qucs/diagrams/diagramdialog.cpp b/qucs/diagrams/diagramdialog.cpp index d661386a..5859df7b 100644 --- a/qucs/diagrams/diagramdialog.cpp +++ b/qucs/diagrams/diagramdialog.cpp @@ -82,16 +82,16 @@ class Cross3D : public QWidget { 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(parent); - assert(s); - QFileInfo Info(s->DocName); - defaultDataSet = Info.absolutePath() + QDir::separator() + s->DataSet; + const Schematic* s = dynamic_cast(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"); diff --git a/qucs/dialogs/changedialog.cpp b/qucs/dialogs/changedialog.cpp index d9c006ec..161f2ba3 100644 --- a/qucs/dialogs/changedialog.cpp +++ b/qucs/dialogs/changedialog.cpp @@ -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 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 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) { diff --git a/qucs/dialogs/digisettingsdialog.cpp b/qucs/dialogs/digisettingsdialog.cpp index da222275..5e72769e 100644 --- a/qucs/dialogs/digisettingsdialog.cpp +++ b/qucs/dialogs/digisettingsdialog.cpp @@ -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()) { diff --git a/qucs/dialogs/librarydialog.cpp b/qucs/dialogs/librarydialog.cpp index 06c16c1f..11a70484 100644 --- a/qucs/dialogs/librarydialog.cpp +++ b/qucs/dialogs/librarydialog.cpp @@ -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 << "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 << " \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 << " \n" diff --git a/qucs/dialogs/savedialog.cpp b/qucs/dialogs/savedialog.cpp index 64d8df29..e24673be 100644 --- a/qucs/dialogs/savedialog.cpp +++ b/qucs/dialogs/savedialog.cpp @@ -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 unsavable; QMap::iterator it(unsavedDocs.begin()); for ( ; it != unsavedDocs.end(); ++it) diff --git a/qucs/dialogs/settingsdialog.cpp b/qucs/dialogs/settingsdialog.cpp index 54ebf79b..73d3270a 100644 --- a/qucs/dialogs/settingsdialog.cpp +++ b/qucs/dialogs/settingsdialog.cpp @@ -45,7 +45,7 @@ #include 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); diff --git a/qucs/dialogs/simmessage.cpp b/qucs/dialogs/simmessage.cpp index ab84aba9..0ab07358 100644 --- a/qucs/dialogs/simmessage.cpp +++ b/qucs/dialogs/simmessage.cpp @@ -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; zdocument()->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; zdocument()->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 diff --git a/qucs/dialogs/sweepdialog.cpp b/qucs/dialogs/sweepdialog.cpp index a6ee96df..cc3b1234 100644 --- a/qucs/dialogs/sweepdialog.cpp +++ b/qucs/dialogs/sweepdialog.cpp @@ -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 *NodeVals) - : QDialog(Doc_) + : QDialog(Doc_) { qDebug() << "SweepDialog::SweepDialog()"; @@ -100,7 +100,7 @@ SweepDialog::SweepDialog(Schematic *Doc_,QHash *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: "<count-1<<", points: "<<*pD->Points< *NodeVals) cout<<"Min: "<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 *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 *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 *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 *NodeVals) } - Doc->showBias = 1; + Doc->setShowBias(1); return pg; } diff --git a/qucs/dialogs/vasettingsdialog.cpp b/qucs/dialogs/vasettingsdialog.cpp index 7ed08a20..7eed5068 100644 --- a/qucs/dialogs/vasettingsdialog.cpp +++ b/qucs/dialogs/vasettingsdialog.cpp @@ -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 ()) { diff --git a/qucs/extsimkernels/abstractspicekernel.cpp b/qucs/extsimkernels/abstractspicekernel.cpp index 7f7d7b46..13d490fb 100644 --- a/qucs/extsimkernels/abstractspicekernel.cpp +++ b/qucs/extsimkernels/abstractspicekernel.cpp @@ -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<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<DocName); + QString f = misc::properFileName(a_schematic->getDocName()); header = QStringLiteral(".SUBCKT %1 ").arg(misc::properName(f)); QList< QPair > 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::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 diff --git a/qucs/extsimkernels/customsimdialog.cpp b/qucs/extsimkernels/customsimdialog.cpp index c2d1a2f0..664d6ecf 100644 --- a/qucs/extsimkernels/customsimdialog.cpp +++ b/qucs/extsimkernels/customsimdialog.cpp @@ -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()); diff --git a/qucs/extsimkernels/externsimdialog.cpp b/qucs/extsimkernels/externsimdialog.cpp index ea061807..c8df482f 100644 --- a/qucs/extsimkernels/externsimdialog.cpp +++ b/qucs/extsimkernels/externsimdialog.cpp @@ -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 } @@ -206,7 +206,7 @@ void ExternSimDialog::slotProcessOutput() saveLog(); a_editSimConsole->insertPlainText("Simulation finished\n"); - 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) { @@ -224,7 +224,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(); } @@ -282,7 +282,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; diff --git a/qucs/extsimkernels/ngspice.cpp b/qucs/extsimkernels/ngspice.cpp index 1e5524f8..b61ae257 100644 --- a/qucs/extsimkernels/ngspice.cpp +++ b/qucs/extsimkernels/ngspice.cpp @@ -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(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") { diff --git a/qucs/extsimkernels/verilogawriter.cpp b/qucs/extsimkernels/verilogawriter.cpp index 7f2d691c..8e899c60 100644 --- a/qucs/extsimkernels/verilogawriter.cpp +++ b/qucs/extsimkernels/verilogawriter.cpp @@ -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<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::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<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<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<getVerilogACode(); } diff --git a/qucs/extsimkernels/xyce.cpp b/qucs/extsimkernels/xyce.cpp index 5a75375a..49cb95b5 100644 --- a/qucs/extsimkernels/xyce.cpp +++ b/qucs/extsimkernels/xyce.cpp @@ -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<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< comps(a_schematic->DocComps); // find Fourier tran + Q3PtrList 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<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<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(';')); diff --git a/qucs/main.cpp b/qucs/main.cpp index 0366ffa6..287cd5b8 100644 --- a/qucs/main.cpp +++ b/qucs/main.cpp @@ -121,8 +121,8 @@ bool loadSettings() QucsSettings.XyceParExecutable = _settings::Get().item("XyceParExecutable"); QucsSettings.SpiceOpusExecutable = _settings::Get().item("SpiceOpusExecutable"); QucsSettings.NProcs = _settings::Get().item("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("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() is identical to _settings::get().item() - settingsManager& qs = _settings::Get(); + settingsManager& qs = _settings::Get(); qs.setItem("DefaultSimulator", QucsSettings.DefaultSimulator); qs.setItem("firstRun", false); @@ -182,7 +182,7 @@ bool saveApplSettings() if (QucsMain != nullptr) { qs.setItem("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("LargeFontSize", QString::number(QucsSettings.largeFontSize)); qs.setItem("maxUndo", QucsSettings.maxUndo); @@ -201,7 +201,7 @@ bool saveApplSettings() qs.setItem("Directive", QucsSettings.Directive.name()); qs.setItem("Task", QucsSettings.Task.name()); qs.setItem("AdmsXmlBinDir", QucsSettings.AdmsXmlBinDir.canonicalPath()); - qs.setItem("AscoBinDir", QucsSettings.AscoBinDir.canonicalPath()); + qs.setItem("AscoBinDir", QucsSettings.AscoBinDir.canonicalPath()); qs.setItem("NgspiceExecutable",QucsSettings.NgspiceExecutable); qs.setItem("XyceExecutable",QucsSettings.XyceExecutable); qs.setItem("XyceParExecutable",QucsSettings.XyceParExecutable); @@ -209,7 +209,7 @@ bool saveApplSettings() qs.setItem("Qucsator",QucsSettings.Qucsator); qs.setItem("Nprocs",QucsSettings.NProcs); qs.setItem("S4Q_workdir",QucsSettings.S4Qworkdir); - qs.setItem("SimParameters",QucsSettings.SimParameters); + qs.setItem("SimParameters",QucsSettings.SimParameters); qs.setItem("OctaveExecutable",QucsSettings.OctaveExecutable); qs.setItem("OpenVAFExecutable",QucsSettings.OpenVAFExecutable); qs.setItem("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; diff --git a/qucs/mouseactions.cpp b/qucs/mouseactions.cpp index f66f9dcc..c4a1a523 100644 --- a/qucs/mouseactions.cpp +++ b/qucs/mouseactions.cpp @@ -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(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(inModel.x()); float fY = static_cast(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 { diff --git a/qucs/paintings/portsymbol.cpp b/qucs/paintings/portsymbol.cpp index 86a32c4d..e89711e1 100644 --- a/qucs/paintings/portsymbol.cpp +++ b/qucs/paintings/portsymbol.cpp @@ -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; } diff --git a/qucs/qucs.cpp b/qucs/qucs.cpp index 74550e91..8105a1f3 100644 --- a/qucs/qucs.cpp +++ b/qucs/qucs.cpp @@ -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(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(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; diff --git a/qucs/qucs.h b/qucs/qucs.h index a279b2bc..95439cb0 100644 --- a/qucs/qucs.h +++ b/qucs/qucs.h @@ -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(); diff --git a/qucs/qucs_actions.cpp b/qucs/qucs_actions.cpp index e9430075..25b35ba5 100644 --- a/qucs/qucs_actions.cpp +++ b/qucs/qucs_actions.cpp @@ -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(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; diff --git a/qucs/qucsdoc.cpp b/qucs/qucsdoc.cpp index 86b5c2cc..19a45382 100644 --- a/qucs/qucsdoc.cpp +++ b/qucs/qucsdoc.cpp @@ -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); } diff --git a/qucs/qucsdoc.h b/qucs/qucsdoc.h index ad0cab95..0485c095 100644 --- a/qucs/qucsdoc.h +++ b/qucs/qucsdoc.h @@ -26,7 +26,7 @@ class QPrinter; class QPainter; class QucsDoc { -public: +public: QucsDoc(QucsApp*, const QString&); virtual ~QucsDoc() {}; @@ -45,21 +45,48 @@ class QucsDoc { 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 diff --git a/qucs/schematic.cpp b/qucs/schematic.cpp index ad8b2fab..00fac75d 100644 --- a/qucs/schematic.cpp +++ b/qucs/schematic.cpp @@ -78,53 +78,71 @@ static QRect includePoint(QRect rect, QPoint point) { } } -Schematic::Schematic(QucsApp *App_, const QString &Name_) - : QucsDoc(App_, Name_) +Schematic::Schematic(QucsApp *App_, const QString &Name_) : + QucsDoc(App_, Name_), + a_Wires(&a_DocWires), + a_DocWires(), + a_Nodes(&a_DocNodes), + a_DocNodes(), + a_Diagrams(&a_DocDiags), + a_DocDiags(), + a_Paintings(&a_DocPaints), + a_DocPaints(), + a_Components(&a_DocComps), + a_DocComps(), + a_SymbolPaints(), + a_PostedPaintEvents(), + a_symbolMode(false), + a_isSymbolOnly(false), + a_GridX(10), + a_GridY(10), + a_ViewX1(0), + a_ViewY1(0), + a_ViewX2(1), + a_ViewY2(1), + a_showFrame(0), // don't show + a_Frame_Text0(tr("Title")), + a_Frame_Text1(tr("Drawn By:")), + a_Frame_Text2(tr("Date:")), + a_Frame_Text3(tr("Revision:")), + a_tmpScale(1.0), + a_tmpViewX1(-200), + a_tmpViewY1(-200), + a_tmpViewX2(200), + a_tmpViewY2(200), + a_tmpUsedX1(-200), + a_tmpUsedY1(-200), + a_tmpUsedX2(200), + a_tmpUsedY2(200), + a_undoActionIdx(0), + // The 'i' means state for being unchanged. + a_undoAction((QVector() << new QString(" i\n\n\n\n\n"))), + a_undoSymbolIdx(0), + // The 'i' means state for being unchanged. + a_undoSymbol((QVector() << new QString(" i\n\n\n\n\n"))), + a_UsedX1(INT_MAX), + a_UsedY1(INT_MAX), + a_UsedX2(INT_MAX), + a_UsedY2(INT_MAX), + a_previousCursorPosition(), + a_dragIsOkay(false), + a_FileInfo(), + a_Signals(), + a_PortTypes(), + a_isAnalog(false), + a_isVerilog(false), + a_creatingLib(false) { - symbolMode = false; - isSymbolOnly = false; - setFont(QucsSettings.font); - // ........................................................... - GridX = GridY = 10; - ViewX1 = ViewY1 = 0; - ViewX2 = ViewY2 = 1; - UsedX1 = UsedY1 = INT_MAX; - UsedX2 = UsedY2 = INT_MIN; - - - tmpPosX = tmpPosY = -100; - tmpUsedX1 = tmpUsedY1 = tmpViewX1 = tmpViewY1 = -200; - tmpUsedX2 = tmpUsedY2 = tmpViewX2 = tmpViewY2 = 200; - tmpScale = 1.0; - - DocComps.setAutoDelete(true); - DocWires.setAutoDelete(true); - DocNodes.setAutoDelete(true); - DocDiags.setAutoDelete(true); - DocPaints.setAutoDelete(true); - SymbolPaints.setAutoDelete(true); - - Nodes = &DocNodes; - Wires = &DocWires; - Diagrams = &DocDiags; - Paintings = &DocPaints; - Components = &DocComps; - - // The 'i' means state for being unchanged. - undoActionIdx = 0; - undoAction.append(new QString(" i\n\n\n\n\n")); - undoSymbolIdx = 0; - undoSymbol.append(new QString(" i\n\n\n\n\n")); - isVerilog = false; - creatingLib = false; + a_tmpPosX = a_tmpPosY = -100; - showFrame = 0; // don't show - Frame_Text0 = tr("Title"); - Frame_Text1 = tr("Drawn By:"); - Frame_Text2 = tr("Date:"); - Frame_Text3 = tr("Revision:"); + a_DocComps.setAutoDelete(true); + a_DocWires.setAutoDelete(true); + a_DocNodes.setAutoDelete(true); + a_DocDiags.setAutoDelete(true); + a_DocPaints.setAutoDelete(true); + a_SymbolPaints.setAutoDelete(true); setVScrollBarMode(Q3ScrollView::AlwaysOn); setHScrollBarMode(Q3ScrollView::AlwaysOn); @@ -155,28 +173,28 @@ bool Schematic::createSubcircuitSymbol() unsigned int countPort = adjustPortNumbers(); // If a symbol does not yet exist, create one. - if (SymbolPaints.count() != countPort) + if (a_SymbolPaints.count() != countPort) return false; int h = 30 * ((countPort - 1) / 2) + 10; - SymbolPaints.prepend(new ID_Text(-20, h + 4)); + a_SymbolPaints.prepend(new ID_Text(-20, h + 4)); - SymbolPaints.append(new GraphicLine(-20, -h, 40, 0, QPen(Qt::darkBlue, 2))); - SymbolPaints.append(new GraphicLine(20, -h, 0, 2 * h, QPen(Qt::darkBlue, 2))); - SymbolPaints.append(new GraphicLine(-20, h, 40, 0, QPen(Qt::darkBlue, 2))); - SymbolPaints.append(new GraphicLine(-20, -h, 0, 2 * h, QPen(Qt::darkBlue, 2))); + a_SymbolPaints.append(new GraphicLine(-20, -h, 40, 0, QPen(Qt::darkBlue, 2))); + a_SymbolPaints.append(new GraphicLine(20, -h, 0, 2 * h, QPen(Qt::darkBlue, 2))); + a_SymbolPaints.append(new GraphicLine(-20, h, 40, 0, QPen(Qt::darkBlue, 2))); + a_SymbolPaints.append(new GraphicLine(-20, -h, 0, 2 * h, QPen(Qt::darkBlue, 2))); unsigned int i = 0, y = 10 - h; while (i < countPort) { i++; - SymbolPaints.append(new GraphicLine(-30, y, 10, 0, QPen(Qt::darkBlue, 2))); - SymbolPaints.at(i)->setCenter(-30, y); + a_SymbolPaints.append(new GraphicLine(-30, y, 10, 0, QPen(Qt::darkBlue, 2))); + a_SymbolPaints.at(i)->setCenter(-30, y); if (i == countPort) break; i++; - SymbolPaints.append(new GraphicLine(20, y, 10, 0, QPen(Qt::darkBlue, 2))); - SymbolPaints.at(i)->setCenter(30, y); + a_SymbolPaints.append(new GraphicLine(20, y, 10, 0, QPen(Qt::darkBlue, 2))); + a_SymbolPaints.at(i)->setCenter(30, y); y += 60; } return true; @@ -188,45 +206,45 @@ void Schematic::becomeCurrent(bool update) emit signalCursorPosChanged(0, 0, ""); // update appropriate menu entry - if (symbolMode) { - App->symEdit->setText(tr("Edit Schematic")); - App->symEdit->setStatusTip(tr("Edits the schematic")); - App->symEdit->setWhatsThis(tr("Edit Schematic\n\nEdits the schematic")); + if (a_symbolMode) { + a_App->symEdit->setText(tr("Edit Schematic")); + a_App->symEdit->setStatusTip(tr("Edits the schematic")); + a_App->symEdit->setWhatsThis(tr("Edit Schematic\n\nEdits the schematic")); } else { - App->symEdit->setText(tr("Edit Circuit Symbol")); - App->symEdit->setStatusTip(tr("Edits the symbol for this schematic")); - App->symEdit->setWhatsThis( + a_App->symEdit->setText(tr("Edit Circuit Symbol")); + a_App->symEdit->setStatusTip(tr("Edits the symbol for this schematic")); + a_App->symEdit->setWhatsThis( tr("Edit Circuit Symbol\n\nEdits the symbol for this schematic")); } - if (symbolMode) { - Nodes = &SymbolNodes; - Wires = &SymbolWires; - Diagrams = &SymbolDiags; - Paintings = &SymbolPaints; - Components = &SymbolComps; + if (a_symbolMode) { + a_Nodes = &SymbolNodes; + a_Wires = &SymbolWires; + a_Diagrams = &SymbolDiags; + a_Paintings = &a_SymbolPaints; + a_Components = &SymbolComps; // "Schematic" is used to edit usual schematic files (containing // a schematic and a subcircuit symbol) and *.sym files (which // contain *only* a symbol definition). If we're dealing with // symbol file, then there is no need to create a subcircuit // symbol, a symbol is already there. - if (!DocName.endsWith(".sym") && createSubcircuitSymbol()) { + if (!a_DocName.endsWith(".sym") && createSubcircuitSymbol()) { updateAllBoundingRect(); setChanged(true, true); } - emit signalUndoState(undoSymbolIdx != 0); - emit signalRedoState(undoSymbolIdx != undoSymbol.size() - 1); + emit signalUndoState(a_undoSymbolIdx != 0); + emit signalRedoState(a_undoSymbolIdx != a_undoSymbol.size() - 1); } else { - Nodes = &DocNodes; - Wires = &DocWires; - Diagrams = &DocDiags; - Paintings = &DocPaints; - Components = &DocComps; - - emit signalUndoState(undoActionIdx != 0); - emit signalRedoState(undoActionIdx != undoAction.size() - 1); + a_Nodes = &a_DocNodes; + a_Wires = &a_DocWires; + a_Diagrams = &a_DocDiags; + a_Paintings = &a_DocPaints; + a_Components = &a_DocComps; + + emit signalUndoState(a_undoActionIdx != 0); + emit signalRedoState(a_undoActionIdx != a_undoAction.size() - 1); if (update) reloadGraphs(); // load recent simulation data } @@ -235,81 +253,81 @@ void Schematic::becomeCurrent(bool update) // --------------------------------------------------- void Schematic::setName(const QString &Name_) { - DocName = Name_; - QFileInfo Info(DocName); + a_DocName = Name_; + QFileInfo Info(a_DocName); QString base = Info.completeBaseName(); QString ext = Info.suffix(); - DataSet = base + ".dat"; - Script = base + ".m"; + a_DataSet = base + ".dat"; + a_Script = base + ".m"; if (ext != "dpl") - DataDisplay = base + ".dpl"; + a_DataDisplay = base + ".dpl"; else - DataDisplay = base + ".sch"; + a_DataDisplay = base + ".sch"; } // --------------------------------------------------- // Sets the document to be changed or not to be changed. void Schematic::setChanged(bool c, bool fillStack, char Op) { - if ((!DocChanged) && c) + if ((!a_DocChanged) && c) emit signalFileChanged(true); - else if (DocChanged && (!c)) + else if (a_DocChanged && (!c)) emit signalFileChanged(false); - DocChanged = c; + a_DocChanged = c; - showBias = -1; // schematic changed => bias points may be invalid + a_showBias = -1; // schematic changed => bias points may be invalid if (!fillStack) return; // ................................................ - if (symbolMode) { // for symbol edit mode - while (undoSymbol.size() > undoSymbolIdx + 1) { - delete undoSymbol.last(); - undoSymbol.pop_back(); + if (a_symbolMode) { // for symbol edit mode + while (a_undoSymbol.size() > a_undoSymbolIdx + 1) { + delete a_undoSymbol.last(); + a_undoSymbol.pop_back(); } - undoSymbol.append(new QString(createSymbolUndoString(Op))); - undoSymbolIdx++; + a_undoSymbol.append(new QString(createSymbolUndoString(Op))); + a_undoSymbolIdx++; emit signalUndoState(true); emit signalRedoState(false); - while (static_cast(undoSymbol.size()) + while (static_cast(a_undoSymbol.size()) > QucsSettings.maxUndo) { // "while..." because - delete undoSymbol.first(); - undoSymbol.pop_front(); - undoSymbolIdx--; + delete a_undoSymbol.first(); + a_undoSymbol.pop_front(); + a_undoSymbolIdx--; } return; } // ................................................ // for schematic edit mode - while (undoAction.size() > undoActionIdx + 1) { - delete undoAction.last(); - undoAction.pop_back(); + while (a_undoAction.size() > a_undoActionIdx + 1) { + delete a_undoAction.last(); + a_undoAction.pop_back(); } if (Op == 'm') { // only one for move marker - if (undoAction.at(undoActionIdx)->at(0) == Op) { - delete undoAction.last(); - undoAction.pop_back(); - undoActionIdx--; + if (a_undoAction.at(a_undoActionIdx)->at(0) == Op) { + delete a_undoAction.last(); + a_undoAction.pop_back(); + a_undoActionIdx--; } } - undoAction.append(new QString(createUndoString(Op))); - undoActionIdx++; + a_undoAction.append(new QString(createUndoString(Op))); + a_undoActionIdx++; emit signalUndoState(true); emit signalRedoState(false); - while (static_cast(undoAction.size()) + while (static_cast(a_undoAction.size()) > QucsSettings.maxUndo) { // "while..." because - delete undoAction.first(); // "maxUndo" could be decreased meanwhile - undoAction.pop_front(); - undoActionIdx--; + delete a_undoAction.first(); // "maxUndo" could be decreased meanwhile + a_undoAction.pop_front(); + a_undoActionIdx--; } return; } @@ -318,7 +336,7 @@ void Schematic::setChanged(bool c, bool fillStack, char Op) bool Schematic::sizeOfFrame(int &xall, int &yall) { // Values exclude border of 1.5cm at each side. - switch (showFrame) { + switch (a_showFrame) { case 1: xall = 1020; yall = 765; @@ -389,7 +407,7 @@ void Schematic::paintFrame(QPainter* painter) { painter->drawText(tx, 3, 1, 1, Qt::TextDontClip, cn); painter->drawText(tx, frame_height - frame_margin + 3, 1, 1, Qt::TextDontClip, cn); - column_number++; + column_number++; } } @@ -407,7 +425,7 @@ void Schematic::paintFrame(QPainter* painter) { painter->drawText(5, ty, rl); painter->drawText(frame_width - frame_margin + 5, ty, rl); - row_letter++; + row_letter++; } } @@ -421,15 +439,15 @@ void Schematic::paintFrame(QPainter* painter) { const double z = 200.0; y1_ -= painter->fontMetrics().lineSpacing() + d; painter->drawLine(x1_, y1_, x2_, y1_); - painter->drawText(x1_ + d, y1_ + (d >> 1), 1, 1, Qt::TextDontClip, Frame_Text2); + painter->drawText(x1_ + d, y1_ + (d >> 1), 1, 1, Qt::TextDontClip, a_Frame_Text2); painter->drawLine(x1_ + z, y1_, x1_ + z, y1_ + painter->fontMetrics().lineSpacing() + d); - painter->drawText(x1_ + d + z, y1_ + (d >> 1), 1, 1, Qt::TextDontClip, Frame_Text3); + painter->drawText(x1_ + d + z, y1_ + (d >> 1), 1, 1, Qt::TextDontClip, a_Frame_Text3); y1_ -= painter->fontMetrics().lineSpacing() + d; painter->drawLine(x1_, y1_, x2_, y1_); - painter->drawText(x1_ + d, y1_ + (d >> 1), 1, 1, Qt::TextDontClip, Frame_Text1); - y1_ -= (Frame_Text0.count('\n') + 1) * painter->fontMetrics().lineSpacing() + d; + painter->drawText(x1_ + d, y1_ + (d >> 1), 1, 1, Qt::TextDontClip, a_Frame_Text1); + y1_ -= (a_Frame_Text0.count('\n') + 1) * painter->fontMetrics().lineSpacing() + d; painter->drawRect(x2_, y2_, x1_ - x2_ - 1, y1_ - y2_ - 1); - painter->drawText(x1_ + d, y1_ + (d >> 1), 1, 1, Qt::TextDontClip, Frame_Text0); + painter->drawText(x1_ + d, y1_ + (d >> 1), 1, 1, Qt::TextDontClip, a_Frame_Text0); painter->restore(); } @@ -440,8 +458,8 @@ void Schematic::drawContents(QPainter *p, int, int, int, int) { QTransform trf{p->transform()}; trf - .scale(Scale, Scale) - .translate(-ViewX1, -ViewY1); + .scale(a_Scale, a_Scale) + .translate(-a_ViewX1, -a_ViewY1); p->setTransform(trf); auto renderHints = p->renderHints(); @@ -454,11 +472,11 @@ void Schematic::drawContents(QPainter *p, int, int, int, int) p->setFont(QucsSettings.font); drawGrid(p); - if (!symbolMode) + if (!a_symbolMode) paintFrame(p); drawElements(p); - if (showBias > 0) { + if (a_showBias > 0) { drawDcBiasPoints(p); } @@ -466,29 +484,29 @@ void Schematic::drawContents(QPainter *p, int, int, int, int) } void Schematic::drawElements(QPainter* painter) { - for (auto* component : *Components) { + for (auto* component : *a_Components) { component->paint(painter); } - for (auto* wire : *Wires) { + for (auto* wire : *a_Wires) { wire->paint(painter); if (wire->Label) { wire->Label->paint(painter); // separate because of paintSelected } } - for (auto* node : *Nodes) { + for (auto* node : *a_Nodes) { node->paint(painter); if (node->Label) { node->Label->paint(painter); // separate because of paintSelected } } - for (auto* diagram : *Diagrams) { + for (auto* diagram : *a_Diagrams) { diagram->paint(painter); } - for (auto* painting : *Paintings) { + for (auto* painting : *a_Paintings) { painting->paint(painter); } } @@ -496,7 +514,7 @@ void Schematic::drawElements(QPainter* painter) { void Schematic::drawDcBiasPoints(QPainter* painter) { painter->save(); int x, y, z; - for (auto* pn : *Nodes) { + for (auto* pn : *a_Nodes) { if (pn->Name.isEmpty()) continue; x = pn->cx; @@ -527,7 +545,7 @@ void Schematic::drawPostPaintEvents(QPainter* painter) { * Paint actions can only be called from within the paint event, so they * are put into a QList (PostedPaintEvents) and processed here */ - for (auto p : PostedPaintEvents) { + for (auto p : a_PostedPaintEvents) { // QPainter painter2(viewport()); for if(p.PaintOnViewport) QPen pen(Qt::black); painter->setPen(Qt::black); @@ -568,7 +586,7 @@ void Schematic::drawPostPaintEvents(QPainter* painter) { break; } } - PostedPaintEvents.clear(); + a_PostedPaintEvents.clear(); painter->restore(); } @@ -576,7 +594,7 @@ void Schematic::PostPaintEvent( PE pe, int x1, int y1, int x2, int y2, int a, int b, bool PaintOnViewport) { PostedPaintEvent p = {pe, x1, y1, x2, y2, a, b, PaintOnViewport}; - PostedPaintEvents.push_back(p); + a_PostedPaintEvents.push_back(p); viewport()->update(); update(); } @@ -593,9 +611,9 @@ void Schematic::contentsMouseMoveEvent(QMouseEvent *Event) return condition ? misc::num2str(number) : misc::StringNiceNum(number); }; - if (Diagrams == nullptr) return; // fix for crash on document closing; appears time to time + if (a_Diagrams == nullptr) return; // fix for crash on document closing; appears time to time - for (Diagram* diagram = Diagrams->last(); diagram != nullptr; diagram = Diagrams->prev()) { + for (Diagram* diagram = a_Diagrams->last(); diagram != nullptr; diagram = 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(xpos, ypos) && diagram->Name == "Rect") { @@ -630,58 +648,58 @@ void Schematic::contentsMouseMoveEvent(QMouseEvent *Event) if (Event->buttons() & Qt::MiddleButton) { const QPoint currentCursorPosition = contentsToViewport(Event->pos()); - const int dx = currentCursorPosition.x() - previousCursorPosition.x(); + const int dx = currentCursorPosition.x() - a_previousCursorPosition.x(); if (dx < 0) { scrollRight(std::abs(dx)); } else if (dx > 0) { scrollLeft(dx); } - const int dy = currentCursorPosition.y() - previousCursorPosition.y(); + const int dy = currentCursorPosition.y() - a_previousCursorPosition.y(); if (dy < 0) { scrollDown(std::abs(dy)); } else if (dy > 0) { scrollUp(dy); } - previousCursorPosition = currentCursorPosition; + a_previousCursorPosition = currentCursorPosition; } - if (App->MouseMoveAction) - (App->view->*(App->MouseMoveAction))(this, Event); + if (a_App->MouseMoveAction) + (a_App->view->*(a_App->MouseMoveAction))(this, Event); } // ----------------------------------------------------------- void Schematic::contentsMousePressEvent(QMouseEvent *Event) { - App->editText->setHidden(true); // disable text edit of component property + a_App->editText->setHidden(true); // disable text edit of component property this->setFocus(); - if (App->MouseReleaseAction == &MouseActions::MReleasePaste) + if (a_App->MouseReleaseAction == &MouseActions::MReleasePaste) return; const QPoint inModel = contentsToModel(Event->pos()); if (Event->button() == Qt::RightButton) - if (App->MousePressAction != &MouseActions::MPressElement) - if (App->MousePressAction != &MouseActions::MPressWire2) { + if (a_App->MousePressAction != &MouseActions::MPressElement) + if (a_App->MousePressAction != &MouseActions::MPressWire2) { // show menu on right mouse button - App->view->rightPressMenu(this, Event, inModel.x(), inModel.y()); - if (App->MouseReleaseAction) + a_App->view->rightPressMenu(this, Event, inModel.x(), inModel.y()); + if (a_App->MouseReleaseAction) // Is not called automatically because menu has focus. - (App->view->*(App->MouseReleaseAction))(this, Event); + (a_App->view->*(a_App->MouseReleaseAction))(this, Event); return; } // Begin "pan with mouse" action. Panning starts if *only* // the middle button is pressed. if (Event->button() == Qt::MiddleButton) { - previousCursorPosition = contentsToViewport(Event->pos()); + a_previousCursorPosition = contentsToViewport(Event->pos()); setCursor(Qt::ClosedHandCursor); return; } - if (App->MousePressAction) - (App->view->*(App->MousePressAction))(this, Event, inModel.x(), inModel.y()); + if (a_App->MousePressAction) + (a_App->view->*(a_App->MousePressAction))(this, Event, inModel.x(), inModel.y()); } // ----------------------------------------------------------- @@ -693,15 +711,15 @@ void Schematic::contentsMouseReleaseEvent(QMouseEvent *Event) return; } - if (App->MouseReleaseAction) - (App->view->*(App->MouseReleaseAction))(this, Event); + if (a_App->MouseReleaseAction) + (a_App->view->*(a_App->MouseReleaseAction))(this, Event); } // ----------------------------------------------------------- void Schematic::contentsMouseDoubleClickEvent(QMouseEvent *Event) { - if (App->MouseDoubleClickAction) - (App->view->*(App->MouseDoubleClickAction))(this, Event); + if (a_App->MouseDoubleClickAction) + (a_App->view->*(a_App->MouseDoubleClickAction))(this, Event); } void Schematic::print(QPrinter*, QPainter* painter, bool printAll, @@ -713,7 +731,7 @@ void Schematic::print(QPrinter*, QPainter* painter, bool printAll, QRect printedArea = printAll ? allBoundingRect() : sizeOfSelection(); - if (printAll && showFrame) { + if (printAll && a_showFrame) { int frame_width, frame_height; sizeOfFrame(frame_width, frame_height); printedArea |= QRect{0, 0, frame_width, frame_height}; @@ -780,7 +798,7 @@ template void draw_preserve_selection(T* elem, QPainter* p) { } // namespace void Schematic::paintSchToViewpainter(QPainter* painter, bool printAll) { - if (printAll && showFrame && !symbolMode) { + if (printAll && a_showFrame && !a_symbolMode) { paintFrame(painter); } @@ -788,13 +806,13 @@ void Schematic::paintSchToViewpainter(QPainter* painter, bool printAll) { return printAll || drawable->isSelected; }; - for (auto* component : *Components) { + for (auto* component : *a_Components) { if (should_draw(component)) { draw_preserve_selection(component, painter); } } - for (auto* wire : *Wires) { + for (auto* wire : *a_Wires) { if (should_draw(wire)) { draw_preserve_selection(wire, painter); } @@ -806,7 +824,7 @@ void Schematic::paintSchToViewpainter(QPainter* painter, bool printAll) { } } - for (auto* node : *Nodes) { + for (auto* node : *a_Nodes) { for (auto* connected : *node) { if (should_draw(connected)) { draw_preserve_selection(node, painter); @@ -821,13 +839,13 @@ void Schematic::paintSchToViewpainter(QPainter* painter, bool printAll) { } } - for (auto* painting : *Paintings) { + for (auto* painting : *a_Paintings) { if (should_draw(painting)) { draw_preserve_selection(painting, painter); } } - for (auto* diagram : *Diagrams) { + for (auto* diagram : *a_Diagrams) { if (!should_draw(diagram)) { continue; } @@ -862,14 +880,14 @@ void Schematic::paintSchToViewpainter(QPainter* painter, bool printAll) { } } - if (showBias > 0) { // show DC bias points in schematic ? + if (a_showBias > 0) { // show DC bias points in schematic ? drawDcBiasPoints(painter); } } void Schematic::zoomAroundPoint(double offeredScaleChange, QPoint coords, bool viewportRelative=true) { - const double desiredScale = Scale * offeredScaleChange; + const double desiredScale = a_Scale * offeredScaleChange; const auto viewportCoords = viewportRelative ? coords : coords - QPoint{contentsX(), contentsY()}; const auto focusPoint = viewportToModel(viewportCoords); @@ -884,7 +902,7 @@ float Schematic::zoomBy(float s) // Change scale and keep the point displayed in the center // of the viewport at same place after scaling. - const double newScale = Scale * s; + const double newScale = a_Scale * s; const auto vpCenter = viewportRect().center(); const auto centerPoint = viewportToModel(vpCenter); const auto model = includePoint(modelRect(), centerPoint); @@ -895,23 +913,23 @@ float Schematic::zoomBy(float s) // --------------------------------------------------- void Schematic::showAll() { - sizeOfAll(UsedX1, UsedY1, UsedX2, UsedY2); - if (UsedX1 == 0) - if (UsedX2 == 0) - if (UsedY1 == 0) - if (UsedY2 == 0) { - UsedX1 = UsedY1 = INT_MAX; - UsedX2 = UsedY2 = INT_MIN; + sizeOfAll(a_UsedX1, a_UsedY1, a_UsedX2, a_UsedY2); + if (a_UsedX1 == 0) + if (a_UsedX2 == 0) + if (a_UsedY1 == 0) + if (a_UsedY2 == 0) { + a_UsedX1 = a_UsedY1 = INT_MAX; + a_UsedX2 = a_UsedY2 = INT_MIN; return; } // Reshape model plane to cut off unused parts constexpr int margin = 40; QRect newModelBounds = modelRect(); - newModelBounds.setLeft(UsedX1 - margin); - newModelBounds.setTop(UsedY1 - margin); - newModelBounds.setRight(UsedX2 + margin); - newModelBounds.setBottom(UsedY2 + margin); + newModelBounds.setLeft(a_UsedX1 - margin); + newModelBounds.setTop(a_UsedY1 - margin); + newModelBounds.setRight(a_UsedX2 + margin); + newModelBounds.setBottom(a_UsedY2 + margin); // The shape of the model plane may not fit the shape of the viewport, // so we looking for a scale value which enables to fit the whole model @@ -927,13 +945,13 @@ void Schematic::showAll() // ------------------------------------------------------ void Schematic::zoomToSelection() { - sizeOfAll(UsedX1, UsedY1, UsedX2, UsedY2); - if (UsedX1 == 0) - if (UsedX2 == 0) - if (UsedY1 == 0) - if (UsedY2 == 0) { - UsedX1 = UsedY1 = INT_MAX; - UsedX2 = UsedY2 = INT_MIN; + sizeOfAll(a_UsedX1, a_UsedY1, a_UsedX2, a_UsedY2); + if (a_UsedX1 == 0) + if (a_UsedX2 == 0) + if (a_UsedY1 == 0) + if (a_UsedY2 == 0) { + a_UsedX1 = a_UsedY1 = INT_MAX; + a_UsedX2 = a_UsedY2 = INT_MIN; // No elements present – nothing can be selected; quit return; @@ -942,7 +960,7 @@ void Schematic::zoomToSelection() { const QRect selectedBoundingRect{ sizeOfSelection() }; // Working with raw coordinates is clumsy, abstract them out - const QRect usedBoundingRect{UsedX1, UsedY1, UsedX2 - UsedX1, UsedY2 - UsedY1}; + const QRect usedBoundingRect{a_UsedX1, a_UsedY1, a_UsedX2 - a_UsedX1, a_UsedY2 - a_UsedY1}; if (selectedBoundingRect.width() == 0 || selectedBoundingRect.height() == 0) { // If nothing is selected, then what should be shown? Probably it's best @@ -976,13 +994,13 @@ void Schematic::showNoZoom() const QPoint vpCenter = viewportRect().center(); const QPoint displayedInCenter = viewportToModel(vpCenter); - sizeOfAll(UsedX1, UsedY1, UsedX2, UsedY2); - if (UsedX1 == 0) - if (UsedX2 == 0) - if (UsedY1 == 0) - if (UsedY2 == 0) { - UsedX1 = UsedY1 = INT_MAX; - UsedX2 = UsedY2 = INT_MIN; + sizeOfAll(a_UsedX1, a_UsedY1, a_UsedX2, a_UsedY2); + if (a_UsedX1 == 0) + if (a_UsedX2 == 0) + if (a_UsedY1 == 0) + if (a_UsedY2 == 0) { + a_UsedX1 = a_UsedY1 = INT_MAX; + a_UsedX2 = a_UsedY2 = INT_MIN; // If there is no elements in schematic, then just set scale 1.0 // at the place we currently in. renderModel(noScale, includePoint(modelRect(), displayedInCenter), displayedInCenter, vpCenter); @@ -990,7 +1008,7 @@ void Schematic::showNoZoom() } // Working with raw coordinates is clumsy. Wrap them in useful abstraction. - const QRect usedBoundingRect{UsedX1, UsedY1, UsedX2 - UsedX1, UsedY2 - UsedY1}; + const QRect usedBoundingRect{a_UsedX1, a_UsedY1, a_UsedX2 - a_UsedX1, a_UsedY2 - a_UsedY1}; // Trim unused model space constexpr int margin = 40; @@ -1014,31 +1032,31 @@ void Schematic::showNoZoom() // and (x2, y2) than extend the model plane size. void Schematic::enlargeView(int x1, int y1, int x2, int y2) { // Set 'Used' area size to the of the given rectangle - if (x1 < UsedX1) - UsedX1 = x1; - if (y1 < UsedY1) - UsedY1 = y1; - if (x2 > UsedX2) - UsedX2 = x2; - if (y2 > UsedY2) - UsedY2 = y2; + if (x1 < a_UsedX1) + a_UsedX1 = x1; + if (y1 < a_UsedY1) + a_UsedY1 = y1; + if (x2 > a_UsedX2) + a_UsedX2 = x2; + if (y2 > a_UsedY2) + a_UsedY2 = y2; // Construct the desired model plane constexpr int margin = 40; QRect newModel = modelRect(); - if (x1 < ViewX1) + if (x1 < a_ViewX1) newModel.setLeft(x1 - margin); - if (y1 < ViewY1) + if (y1 < a_ViewY1) newModel.setTop(y1 - margin); - if (x2 > ViewX2) + if (x2 > a_ViewX2) newModel.setRight(x2 + margin); - if (y2 > ViewY2) + if (y2 > a_ViewY2) newModel.setBottom(y2 + margin); const auto vpCenter = viewportRect().center(); const auto displayedInCenter = viewportToModel(vpCenter); newModel = includePoint(newModel, displayedInCenter); - renderModel(Scale, newModel, displayedInCenter, vpCenter); + renderModel(a_Scale, newModel, displayedInCenter, vpCenter); } QPoint Schematic::setOnGrid(const QPoint& p) { @@ -1052,20 +1070,20 @@ void Schematic::showNoZoom() void Schematic::setOnGrid(int &x, int &y) { if (x < 0) - x -= (GridX >> 1) - 1; + x -= (a_GridX >> 1) - 1; else - x += GridX >> 1; - x -= x % GridX; + x += a_GridX >> 1; + x -= x % a_GridX; if (y < 0) - y -= (GridY >> 1) - 1; + y -= (a_GridY >> 1) - 1; else - y += GridY >> 1; - y -= y % GridY; + y += a_GridY >> 1; + y -= y % a_GridY; } void Schematic::drawGrid(QPainter* painter) { - if (!GridOn) + if (!a_GridOn) return; painter->save(); @@ -1124,14 +1142,14 @@ void Schematic::drawGrid(QPainter* painter) { // grid-step and grow it until its "size in scale" gets larger than the minimal // distance between points. - double horizontalStep{ GridX * Scale }; + double horizontalStep{ a_GridX * a_Scale }; for (int n = 2; horizontalStep < minimalVisibleGridStep; n++) { - horizontalStep = n * GridX * Scale; + horizontalStep = n * a_GridX * a_Scale; } - double verticalStep{ GridY * Scale }; + double verticalStep{ a_GridY * a_Scale }; for (int n = 2; verticalStep < minimalVisibleGridStep; n++) { - verticalStep = n * GridY * Scale; + verticalStep = n * a_GridY * a_Scale; } // Finally draw the grid-nodes @@ -1154,12 +1172,12 @@ void Schematic::relativeRotation(int &newX, int &newY, int comX, int comY, int o } void Schematic::updateAllBoundingRect() { - sizeOfAll(UsedX1, UsedY1, UsedX2, UsedY2); + sizeOfAll(a_UsedX1, a_UsedY1, a_UsedX2, a_UsedY2); } QRect Schematic::allBoundingRect() { updateAllBoundingRect(); - return QRect{UsedX1, UsedY1, (UsedX2 - UsedX1), (UsedY2 - UsedY1)}; + return QRect{a_UsedX1, a_UsedY1, (a_UsedX2 - a_UsedX1), (a_UsedY2 - a_UsedY1)}; } // --------------------------------------------------- @@ -1170,7 +1188,7 @@ void Schematic::sizeOfAll(int &xmin, int &ymin, int &xmax, int &ymax) xmax = INT_MIN; ymax = INT_MIN; - if (Components->isEmpty() && Wires->isEmpty() && Diagrams->isEmpty() && Paintings->isEmpty()) { + if (a_Components->isEmpty() && a_Wires->isEmpty() && a_Diagrams->isEmpty() && a_Paintings->isEmpty()) { xmin = xmax = 0; ymin = ymax = 0; return; @@ -1178,7 +1196,7 @@ void Schematic::sizeOfAll(int &xmin, int &ymin, int &xmax, int &ymax) int x1, y1, x2, y2; // find boundings of all components - for (auto* pc : *Components) { + for (auto* pc : *a_Components) { pc->entireBounds(x1, y1, x2, y2); xmin = std::min(x1, xmin); xmax = std::max(x2, xmax); @@ -1187,7 +1205,7 @@ void Schematic::sizeOfAll(int &xmin, int &ymin, int &xmax, int &ymax) } // find boundings of all wires - for (auto* pw : *Wires) { + for (auto* pw : *a_Wires) { xmin = std::min(pw->x1, xmin); xmax = std::max(pw->x2, xmax); ymin = std::min(pw->y1, ymin); @@ -1203,7 +1221,7 @@ void Schematic::sizeOfAll(int &xmin, int &ymin, int &xmax, int &ymax) } // find boundings of all node labels - for (auto* pn : *Nodes) { + for (auto* pn : *a_Nodes) { if (auto* pl = pn->Label; pl) { // check position of node label pl->getLabelBounding(x1, y1, x2, y2); xmin = std::min(x1, xmin); @@ -1214,7 +1232,7 @@ void Schematic::sizeOfAll(int &xmin, int &ymin, int &xmax, int &ymax) } // find boundings of all diagrams - for (auto* pd : *Diagrams) { + for (auto* pd : *a_Diagrams) { pd->Bounding(x1, y1, x2, y2); xmin = std::min(x1, xmin); xmax = std::max(x2, xmax); @@ -1233,7 +1251,7 @@ void Schematic::sizeOfAll(int &xmin, int &ymin, int &xmax, int &ymax) } // find boundings of all Paintings - for (auto* pp : *Paintings) { + for (auto* pp : *a_Paintings) { pp->Bounding(x1, y1, x2, y2); xmin = std::min(x1, xmin); xmax = std::max(x2, xmax); @@ -1250,14 +1268,14 @@ QRect Schematic::sizeOfSelection() const { bool isAnySelected = false; - if (Components->isEmpty() && Wires->isEmpty() && Diagrams->isEmpty() && - Paintings->isEmpty()) { + if (a_Components->isEmpty() && a_Wires->isEmpty() && a_Diagrams->isEmpty() && + a_Paintings->isEmpty()) { return QRect{}; } int x1, y1, x2, y2; // find boundings of all components - for (auto* pc : *Components) { + for (auto* pc : *a_Components) { if (!pc->isSelected) { continue; } @@ -1270,7 +1288,7 @@ QRect Schematic::sizeOfSelection() const { } // find boundings of all wires - for (auto* pw : *Wires) { + for (auto* pw : *a_Wires) { if (!pw->isSelected) { continue; } @@ -1290,7 +1308,7 @@ QRect Schematic::sizeOfSelection() const { } // find boundings of all node labels - for (auto* pn : *Nodes) { + for (auto* pn : *a_Nodes) { if (!pn->isSelected) { continue; } @@ -1306,7 +1324,7 @@ QRect Schematic::sizeOfSelection() const { } // find boundings of all diagrams - for (auto* pd : *Diagrams) { + for (auto* pd : *a_Diagrams) { if (!pd->isSelected) { continue; } @@ -1330,7 +1348,7 @@ QRect Schematic::sizeOfSelection() const { } // find boundings of all Paintings - for (auto* pp : *Paintings) { + for (auto* pp : *a_Paintings) { if (!pp->isSelected) { continue; } @@ -1353,8 +1371,8 @@ QRect Schematic::sizeOfSelection() const { // Rotates all selected components around their midpoint. bool Schematic::rotateElements() { - Wires->setAutoDelete(false); - Components->setAutoDelete(false); + a_Wires->setAutoDelete(false); + a_Components->setAutoDelete(false); // To rotate a selected area its necessary to work with half steps int x1 = INT_MAX, y1 = INT_MAX; @@ -1373,8 +1391,8 @@ bool Schematic::rotateElements() int newPosX = INT_MIN; int newPosY = INT_MIN; - Wires->setAutoDelete(true); - Components->setAutoDelete(true); + a_Wires->setAutoDelete(true); + a_Components->setAutoDelete(true); setOnGrid(comX, comY); Wire *pw; @@ -1440,7 +1458,7 @@ bool Schematic::rotateElements() case isPainting: pp = (Painting *) pe; pp->rotate(x1, y1); // rotate around the center x1 y1 - Paintings->append(pp); + a_Paintings->append(pp); break; default:; } @@ -1456,15 +1474,15 @@ bool Schematic::rotateElements() // First copy them to 'ElementCache', then mirror and insert again. bool Schematic::mirrorXComponents() { - Wires->setAutoDelete(false); - Components->setAutoDelete(false); + a_Wires->setAutoDelete(false); + a_Components->setAutoDelete(false); int x1, y1, x2, y2; QList ElementCache; if (!copyComps2WiresPaints(x1, y1, x2, y2, &ElementCache)) return false; - Wires->setAutoDelete(true); - Components->setAutoDelete(true); + a_Wires->setAutoDelete(true); + a_Components->setAutoDelete(true); y1 = (y1 + y2) >> 1; // axis for mirroring setOnGrid(y2, y1); @@ -1511,7 +1529,7 @@ bool Schematic::mirrorXComponents() pp->getCenter(x2, y2); pp->mirrorX(); // mirror painting !before! mirroring its center pp->setCenter(x2, y1 - y2); - Paintings->append(pp); + a_Paintings->append(pp); break; default:; } @@ -1525,15 +1543,15 @@ bool Schematic::mirrorXComponents() // Mirrors all selected components. First copy them to 'ElementCache', then mirror and insert again. bool Schematic::mirrorYComponents() { - Wires->setAutoDelete(false); - Components->setAutoDelete(false); + a_Wires->setAutoDelete(false); + a_Components->setAutoDelete(false); int x1, y1, x2, y2; QList ElementCache; if (!copyComps2WiresPaints(x1, y1, x2, y2, &ElementCache)) return false; - Wires->setAutoDelete(true); - Components->setAutoDelete(true); + a_Wires->setAutoDelete(true); + a_Components->setAutoDelete(true); x1 = (x1 + x2) >> 1; // axis for mirroring setOnGrid(x1, x2); @@ -1580,7 +1598,7 @@ bool Schematic::mirrorYComponents() pp->getCenter(x2, y2); pp->mirrorY(); // mirror painting !before! mirroring its center pp->setCenter(x1 - x2, y2); - Paintings->append(pp); + a_Paintings->append(pp); break; default:; } @@ -1594,9 +1612,9 @@ bool Schematic::mirrorYComponents() // Updates the graph data of all diagrams (load from data files). void Schematic::reloadGraphs() { - QFileInfo Info(DocName); - for (Diagram *pd = Diagrams->first(); pd != 0; pd = Diagrams->next()) - pd->loadGraphData(Info.path() + QDir::separator() + DataSet); + QFileInfo Info(a_DocName); + for (Diagram *pd = a_Diagrams->first(); pd != 0; pd = a_Diagrams->next()) + pd->loadGraphData(Info.path() + QDir::separator() + a_DataSet); } // Copy function, @@ -1629,34 +1647,34 @@ bool Schematic::paste(QTextStream *stream, Q3PtrList *pe) // Loads this Qucs document. bool Schematic::load() { - DocComps.clear(); - DocWires.clear(); - DocNodes.clear(); - DocDiags.clear(); - DocPaints.clear(); - SymbolPaints.clear(); + a_DocComps.clear(); + a_DocWires.clear(); + a_DocNodes.clear(); + a_DocDiags.clear(); + a_DocPaints.clear(); + a_SymbolPaints.clear(); if (!loadDocument()) return false; - lastSaved = QDateTime::currentDateTime(); + a_lastSaved = QDateTime::currentDateTime(); - while (!undoAction.isEmpty()) { - delete undoAction.last(); - undoAction.pop_back(); + while (!a_undoAction.isEmpty()) { + delete a_undoAction.last(); + a_undoAction.pop_back(); } - undoActionIdx = 0; - while (!undoSymbol.isEmpty()) { - delete undoSymbol.last(); - undoSymbol.pop_back(); + a_undoActionIdx = 0; + while (!a_undoSymbol.isEmpty()) { + delete a_undoSymbol.last(); + a_undoSymbol.pop_back(); } - symbolMode = true; + a_symbolMode = true; setChanged(false, true); // "not changed" state, but put on undo stack - undoSymbolIdx = 0; - undoSymbol.at(undoSymbolIdx)->replace(1, 1, 'i'); - symbolMode = false; + a_undoSymbolIdx = 0; + a_undoSymbol.at(a_undoSymbolIdx)->replace(1, 1, 'i'); + a_symbolMode = false; setChanged(false, true); // "not changed" state, but put on undo stack - undoActionIdx = 0; - undoAction.at(undoActionIdx)->replace(1, 1, 'i'); + a_undoActionIdx = 0; + a_undoAction.at(a_undoActionIdx)->replace(1, 1, 'i'); // The undo stack of the circuit symbol is initialized when first // entering its edit mode. @@ -1665,7 +1683,7 @@ bool Schematic::load() becomeCurrent(false); showAll(); - tmpViewX1 = tmpViewY1 = -200; // was used as temporary cache + a_tmpViewX1 = a_tmpViewY1 = -200; // was used as temporary cache return true; } @@ -1680,7 +1698,7 @@ int Schematic::save() // // In other cases we want to delete any dangling ports from symbol // and invoke "adjustPortNumbers" for it. - if (!isSymbolOnly) { + if (!a_isSymbolOnly) { result = adjustPortNumbers(); // same port number for schematic and symbol } else { orderSymbolPorts(); @@ -1688,24 +1706,24 @@ int Schematic::save() if (saveDocument() < 0) return -1; - QFileInfo Info(DocName); - lastSaved = Info.lastModified(); + QFileInfo Info(a_DocName); + a_lastSaved = Info.lastModified(); if (result >= 0) { setChanged(false); QVector::iterator it; - for (it = undoAction.begin(); it != undoAction.end(); it++) { + for (it = a_undoAction.begin(); it != a_undoAction.end(); it++) { (*it)->replace(1, 1, ' '); //at(1) = ' '; state of being changed } //(1) = 'i'; // state of being unchanged - undoAction.at(undoActionIdx)->replace(1, 1, 'i'); + a_undoAction.at(a_undoActionIdx)->replace(1, 1, 'i'); - for (it = undoSymbol.begin(); it != undoSymbol.end(); it++) { + for (it = a_undoSymbol.begin(); it != a_undoSymbol.end(); it++) { (*it)->replace(1, 1, ' '); //at(1) = ' '; state of being changed } //at(1) = 'i'; // state of being unchanged - undoSymbol.at(undoSymbolIdx)->replace(1, 1, 'i'); + a_undoSymbol.at(a_undoSymbolIdx)->replace(1, 1, 'i'); } // update the subcircuit file lookup hashes //QucsMain->updateSchNameHash(); @@ -1721,20 +1739,20 @@ int Schematic::adjustPortNumbers() { int x1, x2, y1, y2; // get size of whole symbol to know where to place new ports - if (symbolMode) + if (a_symbolMode) sizeOfAll(x1, y1, x2, y2); else { - Components = &SymbolComps; - Wires = &SymbolWires; - Nodes = &SymbolNodes; - Diagrams = &SymbolDiags; - Paintings = &SymbolPaints; + a_Components = &SymbolComps; + a_Wires = &SymbolWires; + a_Nodes = &SymbolNodes; + a_Diagrams = &SymbolDiags; + a_Paintings = &a_SymbolPaints; sizeOfAll(x1, y1, x2, y2); - Components = &DocComps; - Wires = &DocWires; - Nodes = &DocNodes; - Diagrams = &DocDiags; - Paintings = &DocPaints; + a_Components = &a_DocComps; + a_Wires = &a_DocWires; + a_Nodes = &a_DocNodes; + a_Diagrams = &a_DocDiags; + a_Paintings = &a_DocPaints; } x1 += 40; y2 += 20; @@ -1742,14 +1760,14 @@ int Schematic::adjustPortNumbers() Painting *pp; // delete all port names in symbol - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) if (pp->Name == ".PortSym ") ((PortSymbol *) pp)->nameStr = ""; QString Str; int countPort = 0; - QFileInfo Info(DataDisplay); + QFileInfo Info(a_DataDisplay); QString Suffix = Info.suffix(); // handle VHDL file symbol @@ -1759,13 +1777,13 @@ int Schematic::adjustPortNumbers() int Number; // get ports from VHDL file - QFileInfo Info(DocName); - QString Name = Info.path() + QDir::separator() + DataDisplay; + QFileInfo Info(a_DocName); + QString Name = Info.path() + QDir::separator() + a_DataDisplay; // obtain VHDL information either from open text document or the // file directly VHDL_File_Info VInfo; - TextDoc *d = (TextDoc *) App->findDoc(Name); + TextDoc *d = (TextDoc *) a_App->findDoc(Name); if (d) VInfo = VHDL_File_Info(d->document()->toPlainText()); else @@ -1774,7 +1792,7 @@ int Schematic::adjustPortNumbers() if (!VInfo.PortNames.isEmpty()) Names = VInfo.PortNames.split(",", qucs::SkipEmptyParts); - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) if (pp->Name == ".ID ") { ID_Text *id = (ID_Text *) pp; id->Prefix = VInfo.EntityName.toUpper(); @@ -1801,7 +1819,7 @@ int Schematic::adjustPortNumbers() Str = QString::number(Number); // search for matching port symbol - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) if (pp->Name == ".PortSym ") if (((PortSymbol *) pp)->numberStr == Str) break; @@ -1809,7 +1827,7 @@ int Schematic::adjustPortNumbers() if (pp) ((PortSymbol *) pp)->nameStr = *it; else { - SymbolPaints.append(new PortSymbol(x1, y2, Str, *it)); + a_SymbolPaints.append(new PortSymbol(x1, y2, Str, *it)); y2 += 40; } } @@ -1821,13 +1839,13 @@ int Schematic::adjustPortNumbers() int Number; // get ports from Verilog-HDL file - QFileInfo Info(DocName); - QString Name = Info.path() + QDir::separator() + DataDisplay; + QFileInfo Info(a_DocName); + QString Name = Info.path() + QDir::separator() + a_DataDisplay; // obtain Verilog-HDL information either from open text document or the // file directly Verilog_File_Info VInfo; - TextDoc *d = (TextDoc *) App->findDoc(Name); + TextDoc *d = (TextDoc *) a_App->findDoc(Name); if (d) VInfo = Verilog_File_Info(d->document()->toPlainText()); else @@ -1835,7 +1853,7 @@ int Schematic::adjustPortNumbers() if (!VInfo.PortNames.isEmpty()) Names = VInfo.PortNames.split(",", qucs::SkipEmptyParts); - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) if (pp->Name == ".ID ") { ID_Text *id = (ID_Text *) pp; id->Prefix = VInfo.ModuleName.toUpper(); @@ -1847,7 +1865,7 @@ int Schematic::adjustPortNumbers() Str = QString::number(Number); // search for matching port symbol - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) if (pp->Name == ".PortSym ") if (((PortSymbol *) pp)->numberStr == Str) break; @@ -1855,7 +1873,7 @@ int Schematic::adjustPortNumbers() if (pp) ((PortSymbol *) pp)->nameStr = *it; else { - SymbolPaints.append(new PortSymbol(x1, y2, Str, *it)); + a_SymbolPaints.append(new PortSymbol(x1, y2, Str, *it)); y2 += 40; } } @@ -1867,13 +1885,13 @@ int Schematic::adjustPortNumbers() int Number; // get ports from Verilog-A file - QFileInfo Info(DocName); - QString Name = Info.path() + QDir::separator() + DataDisplay; + QFileInfo Info(a_DocName); + QString Name = Info.path() + QDir::separator() + a_DataDisplay; // obtain Verilog-A information either from open text document or the // file directly VerilogA_File_Info VInfo; - TextDoc *d = (TextDoc *) App->findDoc(Name); + TextDoc *d = (TextDoc *) a_App->findDoc(Name); if (d) VInfo = VerilogA_File_Info(d->toPlainText()); else @@ -1882,7 +1900,7 @@ int Schematic::adjustPortNumbers() if (!VInfo.PortNames.isEmpty()) Names = VInfo.PortNames.split(",", qucs::SkipEmptyParts); - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) if (pp->Name == ".ID ") { ID_Text *id = (ID_Text *) pp; id->Prefix = VInfo.ModuleName.toUpper(); @@ -1894,7 +1912,7 @@ int Schematic::adjustPortNumbers() Str = QString::number(Number); // search for matching port symbol - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) if (pp->Name == ".PortSym ") if (((PortSymbol *) pp)->numberStr == Str) break; @@ -1902,7 +1920,7 @@ int Schematic::adjustPortNumbers() if (pp) ((PortSymbol *) pp)->nameStr = *it; else { - SymbolPaints.append(new PortSymbol(x1, y2, Str, *it)); + a_SymbolPaints.append(new PortSymbol(x1, y2, Str, *it)); y2 += 40; } } @@ -1910,13 +1928,13 @@ int Schematic::adjustPortNumbers() // handle schematic symbol else { // go through all components in a schematic - for (Component *pc = DocComps.first(); pc != 0; pc = DocComps.next()) { + for (Component *pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) { if (pc->Model == "Port") { countPort++; Str = pc->Props.front()->Value; // search for matching port symbol - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) { + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) { if (pp->Name == ".PortSym ") { if (((PortSymbol *) pp)->numberStr == Str) break; @@ -1926,7 +1944,7 @@ int Schematic::adjustPortNumbers() if (pp) { ((PortSymbol *) pp)->nameStr = pc->Name; } else { - SymbolPaints.append(new PortSymbol(x1, y2, Str, pc->Name)); + a_SymbolPaints.append(new PortSymbol(x1, y2, Str, pc->Name)); y2 += 40; } } @@ -1934,14 +1952,14 @@ int Schematic::adjustPortNumbers() } // delete not accounted port symbols - for (pp = SymbolPaints.first(); pp != 0;) { + for (pp = a_SymbolPaints.first(); pp != 0;) { if (pp->Name == ".PortSym ") if (((PortSymbol *) pp)->nameStr.isEmpty()) { - SymbolPaints.remove(); - pp = SymbolPaints.current(); + a_SymbolPaints.remove(); + pp = a_SymbolPaints.current(); continue; } - pp = SymbolPaints.next(); + pp = a_SymbolPaints.next(); } return countPort; @@ -1953,7 +1971,7 @@ int Schematic::orderSymbolPorts() int countPorts = 0; QSet port_numbers, existing_numbers, free_numbers; int max_port_number = 0; - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) { + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) { if (pp->Name == ".PortSym ") { countPorts++; QString numstr = ((PortSymbol *) pp)->numberStr; @@ -1974,7 +1992,7 @@ int Schematic::orderSymbolPorts() free_numbers = port_numbers - existing_numbers; // Assign new numbers only if port number is empty; Preserve ports order. - for (pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) { + for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) { if (pp->Name == ".PortSym ") { QString numstr = ((PortSymbol *) pp)->numberStr; if (numstr == "0") { @@ -1991,18 +2009,18 @@ int Schematic::orderSymbolPorts() // --------------------------------------------------- bool Schematic::undo() { - if (symbolMode) { - if (undoSymbolIdx == 0) { + if (a_symbolMode) { + if (a_undoSymbolIdx == 0) { return false; } - rebuildSymbol(undoSymbol.at(--undoSymbolIdx)); + rebuildSymbol(a_undoSymbol.at(--a_undoSymbolIdx)); - emit signalUndoState(undoSymbolIdx != 0); - emit signalRedoState(undoSymbolIdx != undoSymbol.size() - 1); + emit signalUndoState(a_undoSymbolIdx != 0); + emit signalRedoState(a_undoSymbolIdx != a_undoSymbol.size() - 1); - if (undoSymbol.at(undoSymbolIdx)->at(1) == 'i' - && undoAction.at(undoActionIdx)->at(1) == 'i') { + if (a_undoSymbol.at(a_undoSymbolIdx)->at(1) == 'i' + && a_undoAction.at(a_undoActionIdx)->at(1) == 'i') { setChanged(false, false); return true; } @@ -2012,21 +2030,21 @@ bool Schematic::undo() } // ...... for schematic edit mode ....... - if (undoActionIdx == 0) { + if (a_undoActionIdx == 0) { return false; } - rebuild(undoAction.at(--undoActionIdx)); + rebuild(a_undoAction.at(--a_undoActionIdx)); reloadGraphs(); // load recent simulation data - emit signalUndoState(undoActionIdx != 0); - emit signalRedoState(undoActionIdx != undoAction.size() - 1); + emit signalUndoState(a_undoActionIdx != 0); + emit signalRedoState(a_undoActionIdx != a_undoAction.size() - 1); - if (undoAction.at(undoActionIdx)->at(1) == 'i') { - if (undoSymbol.isEmpty()) { + if (a_undoAction.at(a_undoActionIdx)->at(1) == 'i') { + if (a_undoSymbol.isEmpty()) { setChanged(false, false); return true; - } else if (undoSymbol.at(undoSymbolIdx)->at(1) == 'i') { + } else if (a_undoSymbol.at(a_undoSymbolIdx)->at(1) == 'i') { setChanged(false, false); return true; } @@ -2039,19 +2057,19 @@ bool Schematic::undo() // --------------------------------------------------- bool Schematic::redo() { - if (symbolMode) { - if (undoSymbolIdx == undoSymbol.size() - 1) { + if (a_symbolMode) { + if (a_undoSymbolIdx == a_undoSymbol.size() - 1) { return false; } - rebuildSymbol(undoSymbol.at(++undoSymbolIdx)); + rebuildSymbol(a_undoSymbol.at(++a_undoSymbolIdx)); adjustPortNumbers(); // set port names - emit signalUndoState(undoSymbolIdx != 0); - emit signalRedoState(undoSymbolIdx != undoSymbol.size() - 1); + emit signalUndoState(a_undoSymbolIdx != 0); + emit signalRedoState(a_undoSymbolIdx != a_undoSymbol.size() - 1); - if (undoSymbol.at(undoSymbolIdx)->at(1) == 'i' - && undoAction.at(undoActionIdx)->at(1) == 'i') { + if (a_undoSymbol.at(a_undoSymbolIdx)->at(1) == 'i' + && a_undoAction.at(a_undoActionIdx)->at(1) == 'i') { setChanged(false, false); return true; } @@ -2062,21 +2080,21 @@ bool Schematic::redo() // // ...... for schematic edit mode ....... - if (undoActionIdx == undoAction.size() - 1) { + if (a_undoActionIdx == a_undoAction.size() - 1) { return false; } - rebuild(undoAction.at(++undoActionIdx)); + rebuild(a_undoAction.at(++a_undoActionIdx)); reloadGraphs(); // load recent simulation data - emit signalUndoState(undoActionIdx != 0); - emit signalRedoState(undoActionIdx != undoAction.size() - 1); + emit signalUndoState(a_undoActionIdx != 0); + emit signalRedoState(a_undoActionIdx != a_undoAction.size() - 1); - if (undoAction.at(undoActionIdx)->at(1) == 'i') { - if (undoSymbol.isEmpty()) { + if (a_undoAction.at(a_undoActionIdx)->at(1) == 'i') { + if (a_undoSymbol.isEmpty()) { setChanged(false, false); return true; - } else if (undoSymbol.at(undoSymbolIdx)->at(1) == 'i') { + } else if (a_undoSymbol.at(a_undoSymbolIdx)->at(1) == 'i') { setChanged(false, false); return true; } @@ -2096,8 +2114,8 @@ bool Schematic::elementsOnGrid() Q3PtrList LabelCache; // test all components - Components->setAutoDelete(false); - for (Component *pc = Components->last(); pc != nullptr; pc = Components->prev()) + a_Components->setAutoDelete(false); + for (Component *pc = a_Components->last(); pc != nullptr; pc = a_Components->prev()) if (pc->isSelected) { // rescue non-selected node labels for (Port *pp : pc->Ports) @@ -2110,11 +2128,11 @@ bool Schematic::elementsOnGrid() x = pc->cx; y = pc->cy; - No = Components->at(); + No = a_Components->at(); deleteComp(pc); setOnGrid(pc->cx, pc->cy); insertRawComponent(pc); - Components->at(No); // restore current list position + a_Components->at(No); // restore current list position pc->isSelected = false; count = true; @@ -2127,11 +2145,11 @@ bool Schematic::elementsOnGrid() } LabelCache.clear(); } - Components->setAutoDelete(true); + a_Components->setAutoDelete(true); - Wires->setAutoDelete(false); + a_Wires->setAutoDelete(false); // test all wires and wire labels - for (Wire *pw = Wires->last(); pw != 0; pw = Wires->prev()) { + for (Wire *pw = a_Wires->last(); pw != 0; pw = a_Wires->prev()) { pl = pw->Label; pw->Label = nullptr; @@ -2150,12 +2168,12 @@ bool Schematic::elementsOnGrid() } } - No = Wires->at(); + No = a_Wires->at(); deleteWire(pw); setOnGrid(pw->x1, pw->y1); setOnGrid(pw->x2, pw->y2); insertWire(pw); - Wires->at(No); // restore current list position + a_Wires->at(No); // restore current list position pw->isSelected = false; count = true; if (pl) @@ -2176,10 +2194,10 @@ bool Schematic::elementsOnGrid() } } } - Wires->setAutoDelete(true); + a_Wires->setAutoDelete(true); // test all node labels - for (Node *pn = Nodes->first(); pn != 0; pn = Nodes->next()) + for (Node *pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) if (pn->Label) if (pn->Label->isSelected) { setOnGrid(pn->Label->x1, pn->Label->y1); @@ -2188,7 +2206,7 @@ bool Schematic::elementsOnGrid() } // test all diagrams - for (Diagram *pd = Diagrams->last(); pd != 0; pd = Diagrams->prev()) { + for (Diagram *pd = a_Diagrams->last(); pd != 0; pd = a_Diagrams->prev()) { if (pd->isSelected) { setOnGrid(pd->cx, pd->cy); pd->isSelected = false; @@ -2210,7 +2228,7 @@ bool Schematic::elementsOnGrid() } // test all paintings - for (Painting *pa = Paintings->last(); pa != 0; pa = Paintings->prev()) + for (Painting *pa = a_Paintings->last(); pa != 0; pa = a_Paintings->prev()) if (pa->isSelected) { setOnGrid(pa->cx, pa->cy); pa->isSelected = false; @@ -2225,42 +2243,42 @@ bool Schematic::elementsOnGrid() // --------------------------------------------------- void Schematic::switchPaintMode() { - symbolMode = !symbolMode; // change mode + a_symbolMode = !a_symbolMode; // change mode int tmp, t2; float temp; - temp = Scale; - Scale = tmpScale; - tmpScale = temp; + temp = a_Scale; + a_Scale = a_tmpScale; + a_tmpScale = temp; tmp = contentsX(); t2 = contentsY(); - setContentsPos(tmpPosX, tmpPosY); - tmpPosX = tmp; - tmpPosY = t2; - tmp = ViewX1; - ViewX1 = tmpViewX1; - tmpViewX1 = tmp; - tmp = ViewY1; - ViewY1 = tmpViewY1; - tmpViewY1 = tmp; - tmp = ViewX2; - ViewX2 = tmpViewX2; - tmpViewX2 = tmp; - tmp = ViewY2; - ViewY2 = tmpViewY2; - tmpViewY2 = tmp; - tmp = UsedX1; - UsedX1 = tmpUsedX1; - tmpUsedX1 = tmp; - tmp = UsedY1; - UsedY1 = tmpUsedY1; - tmpUsedY1 = tmp; - tmp = UsedX2; - UsedX2 = tmpUsedX2; - tmpUsedX2 = tmp; - tmp = UsedY2; - UsedY2 = tmpUsedY2; - tmpUsedY2 = tmp; + setContentsPos(a_tmpPosX, a_tmpPosY); + a_tmpPosX = tmp; + a_tmpPosY = t2; + tmp = a_ViewX1; + a_ViewX1 = a_tmpViewX1; + a_tmpViewX1 = tmp; + tmp = a_ViewY1; + a_ViewY1 = a_tmpViewY1; + a_tmpViewY1 = tmp; + tmp = a_ViewX2; + a_ViewX2 = a_tmpViewX2; + a_tmpViewX2 = tmp; + tmp = a_ViewY2; + a_ViewY2 = a_tmpViewY2; + a_tmpViewY2 = tmp; + tmp = a_UsedX1; + a_UsedX1 = a_tmpUsedX1; + a_tmpUsedX1 = tmp; + tmp = a_UsedY1; + a_UsedY1 = a_tmpUsedY1; + a_tmpUsedY1 = tmp; + tmp = a_UsedX2; + a_UsedX2 = a_tmpUsedX2; + a_tmpUsedX2 = tmp; + tmp = a_UsedY2; + a_UsedY2 = a_tmpUsedY2; + a_tmpUsedY2 = tmp; } // ********************************************************************* @@ -2270,7 +2288,7 @@ void Schematic::switchPaintMode() // ********************************************************************* void Schematic::contentsWheelEvent(QWheelEvent *Event) { - App->editText->setHidden(true); // disable edit of component property + a_App->editText->setHidden(true); // disable edit of component property // A mouse wheel angle delta of a single step is typically 120, // but other devices may produce various values. For example, @@ -2335,7 +2353,7 @@ void Schematic::scrollUp(int step) // located, the smaller its y-coordinate and vice versa. Keep this in mind // while reading the code below. - const int stepInModel = static_cast(std::round(step/Scale)); + const int stepInModel = static_cast(std::round(step/a_Scale)); const QPoint viewportTopLeft = viewportRect().topLeft(); // A point currently displayed in top left corner @@ -2351,11 +2369,11 @@ void Schematic::scrollUp(int step) // Cut off a bit of unused model space from its bottom side. const auto b = modelBounds.bottom() - stepInModel; - if (b > UsedY2) { + if (b > a_UsedY2) { modelBounds.setBottom(b); } - renderModel(Scale, modelBounds, mtl, viewportTopLeft); + renderModel(a_Scale, modelBounds, mtl, viewportTopLeft); } // Scrolls the visible area downwards and enlarges or reduces the view @@ -2368,7 +2386,7 @@ void Schematic::scrollDown(int step) // located, the bigger its y-coordinate and vice versa. Keep this in mind // while reading the code below. - const int stepInModel = static_cast(std::round(step/Scale)); + const int stepInModel = static_cast(std::round(step/a_Scale)); const QPoint viewportBottomLeft = viewportRect().bottomLeft(); // A point currently displayed in bottom left corner @@ -2384,12 +2402,12 @@ void Schematic::scrollDown(int step) // Cut off a bit of unused model space from its top side. const auto t = modelBounds.top() + stepInModel; - if (t < UsedY1) { + if (t < a_UsedY1) { modelBounds.setTop(t); } // Render model in its new size and position point in the top left corner of viewport - renderModel(Scale, modelBounds, mbl, viewportBottomLeft); + renderModel(a_Scale, modelBounds, mbl, viewportBottomLeft); } // Scrolls the visible area to the left and enlarges or reduces the view @@ -2402,7 +2420,7 @@ void Schematic::scrollLeft(int step) // located, the smaller its x-coordinate and vice versa. Keep this in mind // while reading the code below. - const int stepInModel = static_cast(std::round(step/Scale)); + const int stepInModel = static_cast(std::round(step/a_Scale)); const QPoint viewportTopLeft = viewportRect().topLeft(); // A point currently displayed in top left corner @@ -2418,11 +2436,11 @@ void Schematic::scrollLeft(int step) // Cut off a bit of unused model space from its right side. const auto r = modelBounds.right() - stepInModel; - if (r > UsedX2) { + if (r > a_UsedX2) { modelBounds.setRight(r); } - renderModel(Scale, modelBounds, mtl, viewportTopLeft); + renderModel(a_Scale, modelBounds, mtl, viewportTopLeft); } // Scrolls the visible area to the right and enlarges or reduces the @@ -2435,7 +2453,7 @@ void Schematic::scrollRight(int step) // located, the bigger its x-coordinate and vice versa. Keep this in mind // while reading the code below. - const int stepInModel = static_cast(std::round(step/Scale)); + const int stepInModel = static_cast(std::round(step/a_Scale)); const QPoint viewportTopRight = viewportRect().topRight(); // A point currently displayed in top right corner @@ -2451,18 +2469,18 @@ void Schematic::scrollRight(int step) // Cut off a bit of unused model space from its left side. const auto l = modelBounds.left() + stepInModel; - if (l < UsedX1) { + if (l < a_UsedX1) { modelBounds.setLeft(l); } - renderModel(Scale, modelBounds, mtr, viewportTopRight); + renderModel(a_Scale, modelBounds, mtr, viewportTopRight); } // ----------------------------------------------------------- // Is called if the scroll arrow of the ScrollBar is pressed. void Schematic::slotScrollUp() { - App->editText->setHidden(true); // disable edit of component property + a_App->editText->setHidden(true); // disable edit of component property scrollUp(verticalScrollBar()->singleStep()); } @@ -2470,7 +2488,7 @@ void Schematic::slotScrollUp() // Is called if the scroll arrow of the ScrollBar is pressed. void Schematic::slotScrollDown() { - App->editText->setHidden(true); // disable edit of component property + a_App->editText->setHidden(true); // disable edit of component property scrollDown(verticalScrollBar()->singleStep()); } @@ -2478,7 +2496,7 @@ void Schematic::slotScrollDown() // Is called if the scroll arrow of the ScrollBar is pressed. void Schematic::slotScrollLeft() { - App->editText->setHidden(true); // disable edit of component property + a_App->editText->setHidden(true); // disable edit of component property scrollLeft(horizontalScrollBar()->singleStep()); } @@ -2486,7 +2504,7 @@ void Schematic::slotScrollLeft() // Is called if the scroll arrow of the ScrollBar is pressed. void Schematic::slotScrollRight() { - App->editText->setHidden(true); // disable edit of component property + a_App->editText->setHidden(true); // disable edit of component property scrollRight(horizontalScrollBar()->singleStep()); } @@ -2499,7 +2517,7 @@ void Schematic::slotScrollRight() // Is called if an object is dropped (after drag'n drop). void Schematic::contentsDropEvent(QDropEvent *Event) { - if (dragIsOkay) { + if (a_dragIsOkay) { QList urls = Event->mimeData()->urls(); if (urls.isEmpty()) { return; @@ -2507,15 +2525,15 @@ void Schematic::contentsDropEvent(QDropEvent *Event) // do not close untitled document to avoid segfault QucsDoc *d = QucsMain->getDoc(0); - bool changed = d->DocChanged; - d->DocChanged = true; + bool changed = d->getDocChanged(); + d->setDocChanged(true); // URI: file:/home/linuxuser/Desktop/example.sch for (QUrl url : urls) { - App->gotoPage(QDir::toNativeSeparators(url.toLocalFile())); + a_App->gotoPage(QDir::toNativeSeparators(url.toLocalFile())); } - d->DocChanged = changed; + d->setDocChanged(changed); return; } @@ -2530,10 +2548,10 @@ void Schematic::contentsDropEvent(QDropEvent *Event) QMouseEvent e(QEvent::MouseButtonPress, ev_pos, mapToGlobal(ev_pos), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); - App->view->MPressElement(this, &e, inModel.x(), inModel.y()); + a_App->view->MPressElement(this, &e, inModel.x(), inModel.y()); - delete App->view->selElem; - App->view->selElem = nullptr; // no component selected + delete a_App->view->selElem; + a_App->view->selElem = nullptr; // no component selected if (formerAction) { formerAction->setChecked(true); @@ -2547,11 +2565,11 @@ void Schematic::contentsDragEnterEvent(QDragEnterEvent *Event) { //FIXME: the function of drag library component seems not working? formerAction = nullptr; - dragIsOkay = false; + a_dragIsOkay = false; // file dragged in ? if (Event->mimeData()->hasUrls()) { - dragIsOkay = true; + a_dragIsOkay = true; Event->accept(); return; } @@ -2561,8 +2579,8 @@ void Schematic::contentsDragEnterEvent(QDragEnterEvent *Event) QString s = Event->mimeData()->text(); if (s.left(15) == "QucsComponent:<") { s = s.mid(14); - App->view->selElem = getComponentFromName(s); - if (App->view->selElem) { + a_App->view->selElem = getComponentFromName(s); + if (a_App->view->selElem) { Event->accept(); return; } @@ -2576,12 +2594,12 @@ void Schematic::contentsDragEnterEvent(QDragEnterEvent *Event) // drag component from listview //if(Event->provides("application/x-qabstractitemmodeldatalist")) { if (Event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) { - QListWidgetItem *Item = App->CompComps->currentItem(); + QListWidgetItem *Item = a_App->CompComps->currentItem(); if (Item) { - formerAction = App->activeAction; - App->slotSelectComponent(Item); // also sets drawn=false - App->MouseMoveAction = 0; - App->MousePressAction = 0; + formerAction = a_App->activeAction; + a_App->slotSelectComponent(Item); // also sets drawn=false + a_App->MouseMoveAction = 0; + a_App->MousePressAction = 0; Event->accept(); return; @@ -2600,7 +2618,7 @@ void Schematic::contentsDragLeaveEvent(QDragLeaveEvent *) } void Schematic::contentsNativeGestureZoomEvent( QNativeGestureEvent* Event) { - App->editText->setHidden(true); // disable edit of component property + a_App->editText->setHidden(true); // disable edit of component property const auto factor = 1.0 + Event->value(); #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) @@ -2614,8 +2632,8 @@ void Schematic::contentsNativeGestureZoomEvent( QNativeGestureEvent* Event) { // --------------------------------------------------- void Schematic::contentsDragMoveEvent(QDragMoveEvent *Event) { - if (!dragIsOkay) { - if (App->view->selElem == 0) { + if (!a_dragIsOkay) { + if (a_App->view->selElem == 0) { Event->ignore(); return; } @@ -2632,7 +2650,7 @@ void Schematic::contentsDragMoveEvent(QDragMoveEvent *Event) #else QMouseEvent e(QEvent::MouseMove, Event->pos(), Qt::NoButton, Qt::NoButton, Qt::NoModifier); #endif - App->view->MMoveElement(this, &e); + a_App->view->MMoveElement(this, &e); } Event->accept(); @@ -2640,12 +2658,12 @@ void Schematic::contentsDragMoveEvent(QDragMoveEvent *Event) bool Schematic::checkDplAndDatNames() { - QFileInfo Info(DocName); - if (!DocName.isEmpty() && DataSet.size() > 4 && DataDisplay.size() > 4) { + QFileInfo Info(a_DocName); + if (!a_DocName.isEmpty() && a_DataSet.size() > 4 && a_DataDisplay.size() > 4) { QString base = Info.completeBaseName(); - QString base_dat = DataSet; + QString base_dat = a_DataSet; base_dat.chop(4); - QString base_dpl = DataDisplay; + QString base_dpl = a_DataDisplay; base_dpl.chop(4); if (base != base_dat || base != base_dpl) { QString msg = QObject::tr( @@ -2654,16 +2672,16 @@ bool Schematic::checkDplAndDatNames() "instead of using File->SaveAs. Correct dataset and display names " "automatically?\n\n"); msg += QString(QObject::tr("Schematic file: ")) + base + ".sch\n"; - msg += QString(QObject::tr("Dataset file: ")) + DataSet + "\n"; - msg += QString(QObject::tr("Display file: ")) + DataDisplay + "\n"; + msg += QString(QObject::tr("Dataset file: ")) + a_DataSet + "\n"; + msg += QString(QObject::tr("Display file: ")) + a_DataDisplay + "\n"; auto r = QMessageBox::information(this, QObject::tr("Open document"), msg, QMessageBox::Yes, QMessageBox::No); if (r == QMessageBox::Yes) { - DataSet = base + ".dat"; - DataDisplay = base + ".dpl"; + a_DataSet = base + ".dat"; + a_DataDisplay = base + ".dpl"; return true; } } diff --git a/qucs/schematic.h b/qucs/schematic.h index 2e3668fb..66b91aac 100644 --- a/qucs/schematic.h +++ b/qucs/schematic.h @@ -76,6 +76,7 @@ typedef QMap SubMap; class Schematic : public Q3ScrollView, public QucsDoc { Q_OBJECT + public: Schematic(QucsApp*, const QString&); ~Schematic(); @@ -191,22 +192,57 @@ class Schematic : public Q3ScrollView, public QucsDoc { 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 *Wires, DocWires; - Q3PtrList *Nodes, DocNodes; - Q3PtrList *Diagrams, DocDiags; - Q3PtrList *Paintings, DocPaints; - Q3PtrList *Components, DocComps; + Q3PtrList *a_Wires; + Q3PtrList a_DocWires; + Q3PtrList* a_Nodes; + Q3PtrList a_DocNodes; + Q3PtrList* a_Diagrams; + Q3PtrList a_DocDiags; + Q3PtrList* a_Paintings; + Q3PtrList a_DocPaints; + Q3PtrList* a_Components; + Q3PtrList a_DocComps; + + Q3PtrList a_SymbolPaints; // symbol definition for subcircuit - Q3PtrList SymbolPaints; // symbol definition for subcircuit +private: + QList a_PostedPaintEvents; - QList PostedPaintEvents; - bool symbolMode; // true if in symbol painting mode - bool isSymbolOnly; + 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 @@ class Schematic : public Q3ScrollView, public QucsDoc { // 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; - - int undoActionIdx; - QVector undoAction; - int undoSymbolIdx; - QVector 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); } + 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 a_undoActionIdx; + QVector a_undoAction; + int a_undoSymbolIdx; + QVector a_undoSymbol; // undo stack for circuit symbol signals: void signalCursorPosChanged(int, int, QString); @@ -267,27 +310,30 @@ protected slots: // 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 @@ protected slots: 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 @@ protected slots: 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 diff --git a/qucs/schematic_element.cpp b/qucs/schematic_element.cpp index 37764d3b..e1992555 100644 --- a/qucs/schematic_element.cpp +++ b/qucs/schematic_element.cpp @@ -59,7 +59,7 @@ Node* Schematic::insertNode(int x, int y, Element *e) { Node *pn; // check if new node lies upon existing node - for(pn = Nodes->first(); pn != 0; pn = Nodes->next()) // check every node + for(pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) // check every node if(pn->cx == x) if(pn->cy == y) { pn->connect(e); @@ -69,13 +69,13 @@ Node* Schematic::insertNode(int x, int y, Element *e) if(pn == 0) // create new node, if no existing one lies at this position { pn = new Node(x, y); - Nodes->append(pn); + a_Nodes->append(pn); pn->connect(e); // connect schematic node to component node } else return pn; // return, if node is not new // check if the new node lies upon an existing wire - for(Wire *pw = Wires->first(); pw != 0; pw = Wires->next()) + for(Wire *pw = a_Wires->first(); pw != 0; pw = a_Wires->next()) { if(pw->x1 == x) { @@ -100,7 +100,7 @@ Node* Schematic::insertNode(int x, int y, Element *e) // --------------------------------------------------- Node* Schematic::selectedNode(int x, int y) { - for(Node *pn = Nodes->first(); pn != 0; pn = Nodes->next()) // test nodes + for(Node *pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) // test nodes if(pn->getSelected(x, y)) return pn; @@ -121,7 +121,7 @@ int Schematic::insertWireNode1(Wire *w) { Node *pn; // check if new node lies upon an existing node - for(pn = Nodes->first(); pn != 0; pn = Nodes->next()) // check every node + for(pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) // check every node if(pn->cx == w->x1) if(pn->cy == w->y1) break; if(pn != 0) @@ -134,7 +134,7 @@ int Schematic::insertWireNode1(Wire *w) // check if the new node lies upon an existing wire - for(Wire *ptr2 = Wires->first(); ptr2 != 0; ptr2 = Wires->next()) + for(Wire *ptr2 = a_Wires->first(); ptr2 != 0; ptr2 = a_Wires->next()) { if(ptr2->x1 == w->x1) { @@ -163,8 +163,8 @@ int Schematic::insertWireNode1(Wire *w) } ptr2->Port1->disconnect(ptr2); // two -> one wire ptr2->Port1->connect(w); - Nodes->removeRef(ptr2->Port2); - Wires->removeRef(ptr2); + a_Nodes->removeRef(ptr2->Port2); + a_Wires->removeRef(ptr2); return 2; } else @@ -204,8 +204,8 @@ int Schematic::insertWireNode1(Wire *w) } ptr2->Port1->disconnect(ptr2); // two -> one wire ptr2->Port1->connect(w); - Nodes->removeRef(ptr2->Port2); - Wires->removeRef(ptr2); + a_Nodes->removeRef(ptr2->Port2); + a_Wires->removeRef(ptr2); return 2; } else @@ -221,7 +221,7 @@ int Schematic::insertWireNode1(Wire *w) else continue; pn = new Node(w->x1, w->y1); // create new node - Nodes->append(pn); + a_Nodes->append(pn); pn->connect(w); // connect schematic node to the new wire w->Port1 = pn; @@ -231,7 +231,7 @@ int Schematic::insertWireNode1(Wire *w) } pn = new Node(w->x1, w->y1); // create new node - Nodes->append(pn); + a_Nodes->append(pn); pn->connect(w); // connect schematic node to the new wire w->Port1 = pn; return 1; @@ -271,10 +271,10 @@ bool Schematic::connectHWires1(Wire *w) } w->x1 = pw->x1; w->Port1 = pw->Port1; // new wire lengthens an existing one - Nodes->removeRef(n); + a_Nodes->removeRef(n); w->Port1->disconnect(pw); w->Port1->connect(w); - Wires->removeRef(pw); + a_Wires->removeRef(pw); return true; } if(pw->x2 >= w->x2) // new wire lies within an existing one ? @@ -292,8 +292,8 @@ bool Schematic::connectHWires1(Wire *w) w->Label->pOwner = w; } pw->Port1->disconnect(pw); - Nodes->removeRef(pw->Port2); - Wires->removeRef(pw); + a_Nodes->removeRef(pw->Port2); + a_Wires->removeRef(pw); return true; } w->x1 = pw->x2; // shorten new wire according to an existing one @@ -340,10 +340,10 @@ bool Schematic::connectVWires1(Wire *w) } w->y1 = pw->y1; w->Port1 = pw->Port1; // new wire lengthens an existing one - Nodes->removeRef(n); + a_Nodes->removeRef(n); w->Port1->disconnect(pw); w->Port1->connect(w); - Wires->removeRef(pw); + a_Wires->removeRef(pw); return true; } if(pw->y2 >= w->y2) // new wire lies complete within an existing one ? @@ -361,8 +361,8 @@ bool Schematic::connectVWires1(Wire *w) w->Label->pOwner = w; } pw->Port1->disconnect(pw); - Nodes->removeRef(pw->Port2); - Wires->removeRef(pw); + a_Nodes->removeRef(pw->Port2); + a_Wires->removeRef(pw); return true; } w->y1 = pw->y2; // shorten new wire according to an existing one @@ -383,7 +383,7 @@ int Schematic::insertWireNode2(Wire *w) { Node *pn; // check if new node lies upon an existing node - for(pn = Nodes->first(); pn != 0; pn = Nodes->next()) // check every node + for(pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) // check every node if(pn->cx == w->x2) if(pn->cy == w->y2) break; if(pn != 0) @@ -396,7 +396,7 @@ int Schematic::insertWireNode2(Wire *w) // check if the new node lies upon an existing wire - for(Wire *ptr2 = Wires->first(); ptr2 != 0; ptr2 = Wires->next()) + for(Wire *ptr2 = a_Wires->first(); ptr2 != 0; ptr2 = a_Wires->next()) { if(ptr2->x1 == w->x2) { @@ -419,8 +419,8 @@ int Schematic::insertWireNode2(Wire *w) w->Port2 = ptr2->Port2; ptr2->Port2->disconnect(ptr2); // two -> one wire ptr2->Port2->connect(w); - Nodes->removeRef(ptr2->Port1); - Wires->removeRef(ptr2); + a_Nodes->removeRef(ptr2->Port1); + a_Wires->removeRef(ptr2); return 2; } else @@ -453,8 +453,8 @@ int Schematic::insertWireNode2(Wire *w) w->Port2 = ptr2->Port2; ptr2->Port2->disconnect(ptr2); // two -> one wire ptr2->Port2->connect(w); - Nodes->removeRef(ptr2->Port1); - Wires->removeRef(ptr2); + a_Nodes->removeRef(ptr2->Port1); + a_Wires->removeRef(ptr2); return 2; } else @@ -469,7 +469,7 @@ int Schematic::insertWireNode2(Wire *w) else continue; pn = new Node(w->x2, w->y2); // create new node - Nodes->append(pn); + a_Nodes->append(pn); pn->connect(w); // connect schematic node to the new wire w->Port2 = pn; @@ -479,7 +479,7 @@ int Schematic::insertWireNode2(Wire *w) } pn = new Node(w->x2, w->y2); // create new node - Nodes->append(pn); + a_Nodes->append(pn); pn->connect(w); // connect schematic node to the new wire w->Port2 = pn; return 1; @@ -513,10 +513,10 @@ bool Schematic::connectHWires2(Wire *w) } w->x2 = pw->x2; w->Port2 = pw->Port2; // new wire lengthens an existing one - Nodes->removeRef(n); + a_Nodes->removeRef(n); w->Port2->disconnect(pw); w->Port2->connect(w); - Wires->removeRef(pw); + a_Wires->removeRef(pw); return true; } // (if new wire lies complete within an existing one, was already @@ -531,8 +531,8 @@ bool Schematic::connectHWires2(Wire *w) w->Label->pOwner = w; } pw->Port2->disconnect(pw); - Nodes->removeRef(pw->Port1); - Wires->removeRef(pw); + a_Nodes->removeRef(pw->Port1); + a_Wires->removeRef(pw); return true; } w->x2 = pw->x1; // shorten new wire according to an existing one @@ -573,10 +573,10 @@ bool Schematic::connectVWires2(Wire *w) } w->y2 = pw->y2; w->Port2 = pw->Port2; // new wire lengthens an existing one - Nodes->removeRef(n); + a_Nodes->removeRef(n); w->Port2->disconnect(pw); w->Port2->connect(w); - Wires->removeRef(pw); + a_Wires->removeRef(pw); return true; } // (if new wire lies complete within an existing one, was already @@ -591,8 +591,8 @@ bool Schematic::connectVWires2(Wire *w) w->Label->pOwner = w; } pw->Port2->disconnect(pw); - Nodes->removeRef(pw->Port1); - Wires->removeRef(pw); + a_Nodes->removeRef(pw->Port1); + a_Wires->removeRef(pw); return true; } w->y2 = pw->y1; // shorten new wire according to an existing one @@ -656,7 +656,7 @@ int Schematic::insertWire(Wire *w) // change node 1 and 2 if(con > 255) con = ((con >> 1) & 1) | ((con << 1) & 2); - Wires->append(w); // add wire to the schematic + a_Wires->append(w); // add wire to the schematic @@ -668,19 +668,19 @@ int Schematic::insertWire(Wire *w) // ................................................................ // Check if the new line covers existing nodes. // In order to also check new appearing wires -> use "for"-loop - for(pw = Wires->current(); pw != 0; pw = Wires->next()) - for(pn = Nodes->first(); pn != 0; ) // check every node + for(pw = a_Wires->current(); pw != 0; pw = a_Wires->next()) + for(pn = a_Nodes->first(); pn != 0; ) // check every node { if(pn->cx == pw->x1) { if(pn->cy <= pw->y1) { - pn = Nodes->next(); + pn = a_Nodes->next(); continue; } if(pn->cy >= pw->y2) { - pn = Nodes->next(); + pn = a_Nodes->next(); continue; } } @@ -688,18 +688,18 @@ int Schematic::insertWire(Wire *w) { if(pn->cx <= pw->x1) { - pn = Nodes->next(); + pn = a_Nodes->next(); continue; } if(pn->cx >= pw->x2) { - pn = Nodes->next(); + pn = a_Nodes->next(); continue; } } else { - pn = Nodes->next(); + pn = a_Nodes->next(); continue; } @@ -720,7 +720,7 @@ int Schematic::insertWire(Wire *w) n2 = pn2->conn_count(); if(n1 == 1) { - Nodes->removeRef(pn); // delete node 1 if open + a_Nodes->removeRef(pn); // delete node 1 if open pn2->disconnect(nw); // remove connection pn = pn2; } @@ -728,7 +728,7 @@ int Schematic::insertWire(Wire *w) if(n2 == 1) { pn->disconnect(nw); // remove connection - Nodes->removeRef(pn2); // delete node 2 if open + a_Nodes->removeRef(pn2); // delete node 2 if open pn2 = pn; } @@ -739,8 +739,8 @@ int Schematic::insertWire(Wire *w) pw->Label = nw->Label; pw->Label->pOwner = pw; } - Wires->removeRef(nw); // delete wire - Wires->findRef(pw); // set back to current wire + a_Wires->removeRef(nw); // delete wire + a_Wires->findRef(pw); // set back to current wire } break; } @@ -751,8 +751,8 @@ int Schematic::insertWire(Wire *w) { nw = new Wire(pw->x1, pw->y1, pn->cx, pn->cy, pw->Port1, pn); pn->connect(nw); - Wires->append(nw); - Wires->findRef(pw); + a_Wires->append(nw); + a_Wires->findRef(pw); pw->Port1->connect(nw); } pw->Port1->disconnect(pw); @@ -761,10 +761,10 @@ int Schematic::insertWire(Wire *w) pw->Port1 = pn2; pn2->connect(pw); - pn = Nodes->next(); + pn = a_Nodes->next(); } - if (Wires->containsRef (w)) // if two wire lines with different labels ... + if (a_Wires->containsRef (w)) // if two wire lines with different labels ... oneLabel(w->Port1); // ... are connected, delete one label return con | 0x0200; // sent also end flag } @@ -791,7 +791,7 @@ void Schematic::selectWireLine(Element *pe, Node *pn, bool ctrl) // --------------------------------------------------- Wire* Schematic::selectedWire(int x, int y) { - for(Wire *pw = Wires->first(); pw != 0; pw = Wires->next()) + for(Wire *pw = a_Wires->first(); pw != 0; pw = a_Wires->next()) if(pw->getSelected(x, y)) return pw; @@ -813,7 +813,7 @@ Wire* Schematic::splitWire(Wire *pw, Node *pn) pn->connect(pw); pn->connect(newWire); newWire->Port2->disconnect(pw); - Wires->append(newWire); + a_Wires->append(newWire); if(pw->Label) if((pw->Label->cx > pn->cx) || (pw->Label->cy > pn->cy)) @@ -861,10 +861,10 @@ bool Schematic::oneTwoWires(Node *n) e1->x2 = e2->x2; e1->y2 = e2->y2; e1->Port2 = e2->Port2; - Nodes->removeRef(n); // delete node (is auto delete) + a_Nodes->removeRef(n); // delete node (is auto delete) e1->Port2->disconnect(e2); e1->Port2->connect(e1); - Wires->removeRef(e2); + a_Wires->removeRef(e2); return true; } return false; @@ -877,7 +877,7 @@ void Schematic::deleteWire(Wire *w) if(w->Port1->conn_count() == 1) { if(w->Port1->Label) delete w->Port1->Label; - Nodes->removeRef(w->Port1); // delete node 1 if open + a_Nodes->removeRef(w->Port1); // delete node 1 if open } else { @@ -889,7 +889,7 @@ void Schematic::deleteWire(Wire *w) if(w->Port2->conn_count() == 1) { if(w->Port2->Label) delete w->Port2->Label; - Nodes->removeRef(w->Port2); // delete node 2 if open + a_Nodes->removeRef(w->Port2); // delete node 2 if open } else { @@ -903,7 +903,7 @@ void Schematic::deleteWire(Wire *w) delete w->Label; w->Label = 0; } - Wires->removeRef(w); + a_Wires->removeRef(w); } // --------------------------------------------------- @@ -914,7 +914,7 @@ int Schematic::copyWires(int& x1, int& y1, int& x2, int& y2, Node *pn; Wire *pw; WireLabel *pl; - for(pw = Wires->first(); pw != 0; ) // find bounds of all selected wires + for(pw = a_Wires->first(); pw != 0; ) // find bounds of all selected wires if(pw->isSelected) { if(pw->x1 < x1) x1 = pw->x1; @@ -953,9 +953,9 @@ int Schematic::copyWires(int& x1, int& y1, int& x2, int& y2, pw->Label = 0; deleteWire(pw); pw->Label = pl; // restore wire label - pw = Wires->current(); + pw = a_Wires->current(); } - else pw = Wires->next(); + else pw = a_Wires->next(); return count; } @@ -970,7 +970,7 @@ int Schematic::copyWires(int& x1, int& y1, int& x2, int& y2, Marker* Schematic::setMarker(int x, int y) { // only diagrams ... - for(Diagram *pd = Diagrams->last(); pd != 0; pd = Diagrams->prev()){ + for(Diagram *pd = a_Diagrams->last(); pd != 0; pd = a_Diagrams->prev()){ if(Marker* m=pd->setMarker(x,y)){ setChanged(true, true); return m; @@ -1033,7 +1033,7 @@ Element* Schematic::selectElement(float fX, float fY, bool flag, int *index) WireLabel *pl = 0; // test all nodes and their labels - for(Node *pn = Nodes->last(); pn != 0; pn = Nodes->prev()) + for(Node *pn = a_Nodes->last(); pn != 0; pn = a_Nodes->prev()) { if(!flag) { @@ -1087,7 +1087,7 @@ Element* Schematic::selectElement(float fX, float fY, bool flag, int *index) } // test all wires and wire labels - for(Wire *pw = Wires->last(); pw != 0; pw = Wires->prev()) + for(Wire *pw = a_Wires->last(); pw != 0; pw = a_Wires->prev()) { if(pw->getSelected(x, y)) { @@ -1141,7 +1141,7 @@ Element* Schematic::selectElement(float fX, float fY, bool flag, int *index) } // test all components - for(Component *pc = Components->last(); pc != 0; pc = Components->prev()) + for(Component *pc = a_Components->last(); pc != 0; pc = a_Components->prev()) { if(pc->getSelected(x, y)) { @@ -1177,9 +1177,9 @@ Element* Schematic::selectElement(float fX, float fY, bool flag, int *index) } } - const double Corr = 5.0 / Scale; // size of line select and area for resizing + const double Corr = 5.0 / a_Scale; // size of line select and area for resizing // test all diagrams - for(Diagram *pd = Diagrams->last(); pd != 0; pd = Diagrams->prev()) + for(Diagram *pd = a_Diagrams->last(); pd != 0; pd = a_Diagrams->prev()) { for (Graph *pg : pd->Graphs) @@ -1298,7 +1298,7 @@ Element* Schematic::selectElement(float fX, float fY, bool flag, int *index) } // test all paintings - for(Painting *pp = Paintings->last(); pp != 0; pp = Paintings->prev()) + for(Painting *pp = a_Paintings->last(); pp != 0; pp = a_Paintings->prev()) { if(pp->isSelected) { @@ -1345,7 +1345,7 @@ void Schematic::highlightWireLabels () WireLabel *pltestouter = 0; // First set highlighting for all wire and nodes labels to false - for(Wire *pwouter = Wires->last(); pwouter != 0; pwouter = Wires->prev()) + for(Wire *pwouter = a_Wires->last(); pwouter != 0; pwouter = a_Wires->prev()) { pltestouter = pwouter->Label; // test any label associated with the wire if (pltestouter) @@ -1354,7 +1354,7 @@ void Schematic::highlightWireLabels () } } - for(Node *pnouter = Nodes->last(); pnouter != 0; pnouter = Nodes->prev()) + for(Node *pnouter = a_Nodes->last(); pnouter != 0; pnouter = a_Nodes->prev()) { pltestouter = pnouter->Label; // test any label associated with the node if (pltestouter) @@ -1362,10 +1362,10 @@ void Schematic::highlightWireLabels () pltestouter->setHighlighted (false); } } - + // Then test every wire's label to see if we need to highlight it // and matching labels on wires and nodes - Q3PtrListIterator itwouter(*Wires); + Q3PtrListIterator itwouter(*a_Wires); Wire *pwouter; while ((pwouter = itwouter.current()) != 0) { @@ -1378,7 +1378,7 @@ void Schematic::highlightWireLabels () { bool hiLightOuter = false; // Search for matching labels on wires - Q3PtrListIterator itwinner(*Wires); + Q3PtrListIterator itwinner(*a_Wires); Wire *pwinner; while ((pwinner = itwinner.current()) != 0) { @@ -1399,7 +1399,7 @@ void Schematic::highlightWireLabels () } } // Search for matching labels on nodes - Q3PtrListIterator itninner(*Nodes); + Q3PtrListIterator itninner(*a_Nodes); Node *pninner; while ((pninner = itninner.current()) != 0) { @@ -1423,7 +1423,7 @@ void Schematic::highlightWireLabels () // Same as above but for nodes labels: // test every node label to see if we need to highlight it // and matching labels on wires and nodes - Q3PtrListIterator itnouter(*Nodes); + Q3PtrListIterator itnouter(*a_Nodes); Node *pnouter; while ((pnouter = itnouter.current()) != 0) { @@ -1436,7 +1436,7 @@ void Schematic::highlightWireLabels () { bool hiLightOuter = false; // Search for matching labels on wires - Q3PtrListIterator itwinner(*Wires); + Q3PtrListIterator itwinner(*a_Wires); Wire *pwinner; while ((pwinner = itwinner.current()) != 0) { @@ -1453,7 +1453,7 @@ void Schematic::highlightWireLabels () } } // Search for matching labels on nodes - Q3PtrListIterator itninner(*Nodes); + Q3PtrListIterator itninner(*a_Nodes); Node *pninner; while ((pninner = itninner.current()) != 0) { @@ -1485,22 +1485,22 @@ void Schematic::highlightWireLabels () void Schematic::deselectElements(Element *e) const { // test all components - for(Component *pc = Components->first(); pc != 0; pc = Components->next()) + for(Component *pc = a_Components->first(); pc != 0; pc = a_Components->next()) if(e != pc) pc->isSelected = false; // test all wires - for(Wire *pw = Wires->first(); pw != 0; pw = Wires->next()) + for(Wire *pw = a_Wires->first(); pw != 0; pw = a_Wires->next()) { if(e != pw) pw->isSelected = false; if(pw->Label) if(pw->Label != e) pw->Label->isSelected = false; } // test all node labels - for(Node *pn = Nodes->first(); pn != 0; pn = Nodes->next()) + for(Node *pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) if(pn->Label) if(pn->Label != e) pn->Label->isSelected = false; // test all diagrams - for(Diagram *pd = Diagrams->first(); pd != 0; pd = Diagrams->next()) + for(Diagram *pd = a_Diagrams->first(); pd != 0; pd = a_Diagrams->next()) { if(e != pd) pd->isSelected = false; @@ -1517,7 +1517,7 @@ void Schematic::deselectElements(Element *e) const } // test all paintings - for(Painting *pp = Paintings->first(); pp != 0; pp = Paintings->next()) + for(Painting *pp = a_Paintings->first(); pp != 0; pp = a_Paintings->next()) if(e != pp) pp->isSelected = false; } @@ -1541,7 +1541,7 @@ int Schematic::selectElements(const QRect& selection_rect, bool append, bool ent return e->isSelected; }; - for (Component *component : *Components) { + for (Component *component : *a_Components) { component->Bounding(left, top, right, bottom); if (select_element(component, QRect{left, top, right - left, bottom - top})) { @@ -1550,7 +1550,7 @@ int Schematic::selectElements(const QRect& selection_rect, bool append, bool ent } - for (Wire* wire : *Wires) + for (Wire* wire : *a_Wires) { if (select_element(wire, QRect{wire->x1, wire->y1, wire->x2 - wire->x1, wire->y2 - wire->y1})) { selected_count++; @@ -1558,7 +1558,7 @@ int Schematic::selectElements(const QRect& selection_rect, bool append, bool ent } WireLabel *label = nullptr; - for (Wire* wire : *Wires) { + for (Wire* wire : *a_Wires) { if (wire->Label) { label = wire->Label; label->getLabelBounding(left,top,right,bottom); @@ -1569,7 +1569,7 @@ int Schematic::selectElements(const QRect& selection_rect, bool append, bool ent } } - for (Node *node : *Nodes) { + for (Node *node : *a_Nodes) { label = node->Label; if (label) { label->getLabelBounding(left,top,right,bottom); @@ -1580,7 +1580,7 @@ int Schematic::selectElements(const QRect& selection_rect, bool append, bool ent } } - for (Diagram *diagram : *Diagrams) { + for (Diagram *diagram : *a_Diagrams) { for (Graph *graph: diagram->Graphs) { if (graph->isSelected &= append) { selected_count++; @@ -1602,7 +1602,7 @@ int Schematic::selectElements(const QRect& selection_rect, bool append, bool ent } } - for (Painting *painting : *Paintings) { + for (Painting *painting : *a_Paintings) { painting->Bounding(left, top, right, bottom); if (select_element(painting, QRect{left, top, right - left, bottom - top})) { @@ -1617,7 +1617,7 @@ int Schematic::selectElements(const QRect& selection_rect, bool append, bool ent // Selects all markers. void Schematic::selectMarkers() const { - for(Diagram *pd = Diagrams->first(); pd != 0; pd = Diagrams->next()) + for(Diagram *pd = a_Diagrams->first(); pd != 0; pd = a_Diagrams->next()) for (Graph *pg : pd->Graphs) for (Marker *pm : pg->Markers) pm->isSelected = true; @@ -1676,7 +1676,7 @@ void Schematic::newMovingWires(Q3PtrList *p, Node *pn, int pos) const pw->Port1->State |= 16+4; pw->Port2->disconnect(pw); // remove connection 2 pw->Port2->State |= 16+4; - Wires->take(Wires->findRef(pw)); + a_Wires->take(a_Wires->findRef(pw)); if(pw->isHorizontal()) mask = 2; @@ -1724,7 +1724,7 @@ void Schematic::newMovingWires(Q3PtrList *p, Node *pn, int pos) const pw2->Port1->State |= 16+4; pw2->Port2->disconnect(pw2); // remove connection 2 pw2->Port2->State |= 16+4; - Wires->take(Wires->findRef(pw2)); + a_Wires->take(a_Wires->findRef(pw2)); if(pw2->Port1 != pn2) { @@ -1765,7 +1765,7 @@ int Schematic::copySelectedElements(Q3PtrList *p) // test all components ********************************* // Insert components before wires in order to prevent short-cut removal. - for(pc = Components->first(); pc != nullptr; ) + for(pc = a_Components->first(); pc != nullptr; ) if(pc->isSelected) { p->append(pc); @@ -1778,13 +1778,13 @@ int Schematic::copySelectedElements(Q3PtrList *p) pp->Connection->State = 4; } - Components->take(); // take component out of the document - pc = Components->current(); + a_Components->take(); // take component out of the document + pc = a_Components->current(); } - else pc = Components->next(); + else pc = a_Components->next(); // test all wires and wire labels *********************** - for(pw = Wires->first(); pw != nullptr; ) + for(pw = a_Wires->first(); pw != nullptr; ) { if(pw->Label) if(pw->Label->isSelected) p->append(pw->Label); @@ -1797,10 +1797,10 @@ int Schematic::copySelectedElements(Q3PtrList *p) pw->Port1->State = 4; pw->Port2->disconnect(pw); // remove connection 2 pw->Port2->State = 4; - Wires->take(); - pw = Wires->current(); + a_Wires->take(); + pw = a_Wires->current(); } - else pw = Wires->next(); + else pw = a_Wires->next(); } // .............................................. @@ -1832,13 +1832,13 @@ int Schematic::copySelectedElements(Q3PtrList *p) // .............................................. // delete the unused nodes - for(pn = Nodes->first(); pn!=0; ) + for(pn = a_Nodes->first(); pn!=0; ) { if(pn->State & 8) if(pn->conn_count() == 2) if(oneTwoWires(pn)) // if possible, connect two wires to one { - pn = Nodes->current(); + pn = a_Nodes->current(); continue; } @@ -1854,40 +1854,40 @@ int Schematic::copySelectedElements(Q3PtrList *p) else if(pn->State & 2) pn->Label->Type = isVMovingLabel; p->append(pn->Label); // do not forget the node labels } - Nodes->remove(); - pn = Nodes->current(); + a_Nodes->remove(); + pn = a_Nodes->current(); continue; } pn->State = 0; - pn = Nodes->next(); + pn = a_Nodes->next(); } // test all node labels // do this last to avoid double copying - for(pn = Nodes->first(); pn != 0; pn = Nodes->next()) + for(pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) if(pn->Label) if(pn->Label->isSelected) p->append(pn->Label); // test all paintings ********************************** - for(Painting *ppa = Paintings->first(); ppa != 0; ) + for(Painting *ppa = a_Paintings->first(); ppa != 0; ) if(ppa->isSelected) { p->append(ppa); - Paintings->take(); - ppa = Paintings->current(); + a_Paintings->take(); + ppa = a_Paintings->current(); } - else ppa = Paintings->next(); + else ppa = a_Paintings->next(); count = 0; // count markers now // test all diagrams ********************************** - for(pd = Diagrams->first(); pd != 0; ) + for(pd = a_Diagrams->first(); pd != 0; ) if(pd->isSelected) { p->append(pd); - Diagrams->take(); - pd = Diagrams->current(); + a_Diagrams->take(); + pd = a_Diagrams->current(); } else { @@ -1906,7 +1906,7 @@ int Schematic::copySelectedElements(Q3PtrList *p) } } - pd = Diagrams->next(); + pd = a_Diagrams->next(); } return count; @@ -1935,8 +1935,8 @@ int Schematic::copyElements(int& x1, int& y1, int& x2, int& y2, QList *ElementCache) { int bx1, by1, bx2, by2; - Wires->setAutoDelete(false); - Components->setAutoDelete(false); + a_Wires->setAutoDelete(false); + a_Components->setAutoDelete(false); x1=INT_MAX; y1=INT_MAX; @@ -1946,11 +1946,11 @@ int Schematic::copyElements(int& x1, int& y1, int& x2, int& y2, int number = copyComponents(x1, y1, x2, y2, ElementCache); number += copyWires(x1, y1, x2, y2, ElementCache); - Wires->setAutoDelete(true); - Components->setAutoDelete(true); + a_Wires->setAutoDelete(true); + a_Components->setAutoDelete(true); // find upper most selected diagram - for(Diagram *pd = Diagrams->last(); pd != 0; pd = Diagrams->prev()) + for(Diagram *pd = a_Diagrams->last(); pd != 0; pd = a_Diagrams->prev()) if(pd->isSelected) { pd->Bounding(bx1, by1, bx2, by2); @@ -1962,7 +1962,7 @@ int Schematic::copyElements(int& x1, int& y1, int& x2, int& y2, number++; } // find upper most selected painting - for(Painting *pp = Paintings->last(); pp != 0; pp = Paintings->prev()) + for(Painting *pp = a_Paintings->last(); pp != 0; pp = a_Paintings->prev()) if(pp->isSelected) { pp->Bounding(bx1, by1, bx2, by2); @@ -1983,17 +1983,17 @@ bool Schematic::deleteElements() { bool sel = false; - Component *pc = Components->first(); + Component *pc = a_Components->first(); while(pc != 0) // all selected component if(pc->isSelected) { deleteComp(pc); - pc = Components->current(); + pc = a_Components->current(); sel = true; } - else pc = Components->next(); + else pc = a_Components->next(); - Wire *pw = Wires->first(); + Wire *pw = a_Wires->first(); while(pw != 0) // all selected wires and their labels { if(pw->Label) @@ -2007,14 +2007,14 @@ bool Schematic::deleteElements() if(pw->isSelected) { deleteWire(pw); - pw = Wires->current(); + pw = a_Wires->current(); sel = true; } - else pw = Wires->next(); + else pw = a_Wires->next(); } // all selected labels on nodes *************************** - for(Node *pn = Nodes->first(); pn != 0; pn = Nodes->next()) + for(Node *pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) if(pn->Label) if(pn->Label->isSelected) { @@ -2023,12 +2023,12 @@ bool Schematic::deleteElements() sel = true; } - Diagram *pd = Diagrams->first(); + Diagram *pd = a_Diagrams->first(); while(pd != 0) // test all diagrams if(pd->isSelected) { - Diagrams->remove(); - pd = Diagrams->current(); + a_Diagrams->remove(); + pd = a_Diagrams->current(); sel = true; } else @@ -2064,11 +2064,11 @@ bool Schematic::deleteElements() if(wasGraphDeleted) pd->recalcGraphData(); // update diagram (resize etc.) - pd = Diagrams->next(); + pd = a_Diagrams->next(); } //else - Painting *pp = Paintings->first(); + Painting *pp = a_Paintings->first(); while(pp != 0) // test all paintings { if(pp->isSelected) { @@ -2077,22 +2077,22 @@ bool Schematic::deleteElements() // have a corresponding port in schematic, its nameStr is empty. // If it's not empty, then invocation of Schematic::adjustPortNumbers // must have found a pairing port in schematic. - if (pp->Name.trimmed() == ".PortSym" && isSymbolOnly) { + if (pp->Name.trimmed() == ".PortSym" && a_isSymbolOnly) { sel = true; - Paintings->remove(); - pp = Paintings->current(); + a_Paintings->remove(); + pp = a_Paintings->current(); continue; } if(pp->Name.at(0) != '.') // do not delete "PortSym", "ID_text" { sel = true; - Paintings->remove(); - pp = Paintings->current(); + a_Paintings->remove(); + pp = a_Paintings->current(); continue; } } - pp = Paintings->next(); + pp = a_Paintings->next(); } if(sel) @@ -2482,9 +2482,9 @@ void Schematic::setComponentNumber(Component *c) int n = 1; QString s = pp->Value; QString cSign = c->Model; - Component *pc =Components->first(); + Component *pc =a_Components->first(); // First look, if the port number already exists. - for(; pc != 0; pc = Components->next()){ + for(; pc != 0; pc = a_Components->next()){ if(pc->Model == cSign){ if(pc->Props.front()->Value == s) {break;} } @@ -2496,8 +2496,8 @@ void Schematic::setComponentNumber(Component *c) { s = QString::number(n); // look for existing ports and their numbers - pc = Components->first(); - for(; pc != 0; pc = Components->next()){ + pc = a_Components->first(); + for(; pc != 0; pc = a_Components->next()){ if(pc->Model == cSign){ if(pc->Props.front()->Value == s) {break;} } @@ -2563,7 +2563,7 @@ void Schematic::insertRawComponent(Component *c, bool noOptimize) { // connect every node of component to corresponding schematic node insertComponentNodes(c, noOptimize); - Components->append(c); + a_Components->append(c); // a ground symbol erases an existing label on the wire line if(c->Model == "GND") @@ -2670,7 +2670,7 @@ void Schematic::insertComponent(Component *c) { // determines the name by looking for names with the same // prefix and increment the number - for(Component *pc = Components->first(); pc != 0; pc = Components->next()) + for(Component *pc = a_Components->first(); pc != 0; pc = a_Components->next()) if(pc->Name.left(len) == c->Name) { s = pc->Name.right(pc->Name.length()-len); @@ -2681,7 +2681,7 @@ void Schematic::insertComponent(Component *c) } setComponentNumber(c); // important for power sources and subcircuit ports - Components->append(c); + a_Components->append(c); } // --------------------------------------------------- @@ -2700,7 +2700,7 @@ void Schematic::activateCompsWithinRect(int x1, int y1, int x2, int y2) y2 = cy2; - for(Component *pc = Components->first(); pc != 0; pc = Components->next()) + for(Component *pc = a_Components->first(); pc != 0; pc = a_Components->next()) { pc->Bounding(cx1, cy1, cx2, cy2); if(cx1 >= x1) if(cx2 <= x2) if(cy1 >= y1) if(cy2 <= y2) @@ -2731,7 +2731,7 @@ void Schematic::activateCompsWithinRect(int x1, int y1, int x2, int y2) bool Schematic::activateSpecifiedComponent(int x, int y) { int x1, y1, x2, y2, a; - for(Component *pc = Components->first(); pc != 0; pc = Components->next()) + for(Component *pc = a_Components->first(); pc != 0; pc = a_Components->next()) { pc->Bounding(x1, y1, x2, y2); if(x >= x1) if(x <= x2) if(y >= y1) if(y <= y2) @@ -2763,7 +2763,7 @@ bool Schematic::activateSelectedComponents() { int a; bool sel = false; - for(Component *pc = Components->first(); pc != 0; pc = Components->next()) + for(Component *pc = a_Components->first(); pc != 0; pc = a_Components->next()) if(pc->isSelected) { a = pc->isActive - 1; @@ -2808,7 +2808,7 @@ void Schematic::setCompPorts(Component *pc) pl->cx = pp->x + pc->cx; pl->cy = pp->y + pc->cy; } - Nodes->removeRef(pp->Connection); + a_Nodes->removeRef(pp->Connection); break; case 2: oneTwoWires(pp->Connection); // try to connect two wires to one @@ -2831,7 +2831,7 @@ void Schematic::setCompPorts(Component *pc) Component* Schematic::selectCompText(int x_, int y_, int& w, int& h) const { int a, b, dx, dy; - for(Component *pc = Components->first(); pc != 0; pc = Components->next()) + for(Component *pc = a_Components->first(); pc != 0; pc = a_Components->next()) { a = pc->cx + pc->tx; if(x_ < a) continue; @@ -2855,7 +2855,7 @@ Component* Schematic::searchSelSubcircuit() { Component *sub=0; // test all components - for(Component *pc = Components->first(); pc != 0; pc = Components->next()) + for(Component *pc = a_Components->first(); pc != 0; pc = a_Components->next()) { if(!pc->isSelected) continue; if(pc->Model != "Sub") @@ -2872,7 +2872,7 @@ Component* Schematic::searchSelSubcircuit() Component* Schematic::selectedComponent(int x, int y) { // test all components - for(Component *pc = Components->first(); pc != 0; pc = Components->next()) + for(Component *pc = a_Components->first(); pc != 0; pc = a_Components->next()) if(pc->getSelected(x, y)) return pc; @@ -2889,7 +2889,7 @@ void Schematic::deleteComp(Component *c) { case 1 : delete pn->Connection->Label; - Nodes->removeRef(pn->Connection); // delete open nodes + a_Nodes->removeRef(pn->Connection); // delete open nodes pn->Connection = 0; // (auto-delete) break; case 3 : @@ -2901,12 +2901,12 @@ void Schematic::deleteComp(Component *c) break; } emit signalComponentDeleted(c); - Components->removeRef(c); // delete component + a_Components->removeRef(c); // delete component } Component *Schematic::getComponentByName(const QString& compname) const { - for(Component *pc = Components->first(); pc != nullptr; pc = Components->next()) { + for(Component *pc = a_Components->first(); pc != nullptr; pc = a_Components->next()) { if (pc->Name.toLower() == compname.toLower()) { return pc; } @@ -2921,7 +2921,7 @@ int Schematic::copyComponents(int& x1, int& y1, int& x2, int& y2, Component *pc; int bx1, by1, bx2, by2, count=0; // find bounds of all selected components - for(pc = Components->first(); pc != 0; ) + for(pc = a_Components->first(); pc != 0; ) { if(pc->isSelected) { @@ -2950,10 +2950,10 @@ int Schematic::copyComponents(int& x1, int& y1, int& x2, int& y2, } deleteComp(pc); - pc = Components->current(); + pc = a_Components->current(); continue; } - pc = Components->next(); + pc = a_Components->next(); } return count; } @@ -2964,7 +2964,7 @@ void Schematic::copyComponents2(int& x1, int& y1, int& x2, int& y2, { Component *pc; // find bounds of all selected components - for(pc = Components->first(); pc != 0; ) + for(pc = a_Components->first(); pc != 0; ) { if(pc->isSelected) { @@ -2988,10 +2988,10 @@ void Schematic::copyComponents2(int& x1, int& y1, int& x2, int& y2, } deleteComp(pc); - pc = Components->current(); + pc = a_Components->current(); continue; } - pc = Components->next(); + pc = a_Components->next(); } } @@ -3012,7 +3012,7 @@ void Schematic::oneLabel(Node *n1) bool named=false; // wire line already named ? Q3PtrList Cons; - for(pn = Nodes->first(); pn!=0; pn = Nodes->next()) + for(pn = a_Nodes->first(); pn!=0; pn = a_Nodes->next()) pn->y1 = 0; // mark all nodes as not checked Cons.append(n1); @@ -3085,7 +3085,7 @@ int Schematic::placeNodeLabel(WireLabel *pl) int y = pl->cy; // check if new node lies upon an existing node - for(pn = Nodes->first(); pn != 0; pn = Nodes->next()) + for(pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) if(pn->cx == x) if(pn->cy == y) break; if(!pn) return -1; @@ -3118,7 +3118,7 @@ Element* Schematic::getWireLabel(Node *pn_) Node *pn, *pNode; Q3PtrList Cons; - for(pn = Nodes->first(); pn!=0; pn = Nodes->next()) + for(pn = a_Nodes->first(); pn!=0; pn = a_Nodes->next()) pn->y1 = 0; // mark all nodes as not checked Cons.append(pn_); @@ -3170,7 +3170,7 @@ void Schematic::insertNodeLabel(WireLabel *pl) Node *pn = new Node(pl->cx, pl->cy); - Nodes->append(pn); + a_Nodes->append(pn); pn->Label = pl; pl->Type = isNodeLabel; @@ -3183,7 +3183,7 @@ void Schematic::copyLabels(int& x1, int& y1, int& x2, int& y2, { WireLabel *pl; // find bounds of all selected wires - for(Wire *pw = Wires->first(); pw != 0; pw = Wires->next()) + for(Wire *pw = a_Wires->first(); pw != 0; pw = a_Wires->next()) { pl = pw->Label; if(pl) if(pl->isSelected) @@ -3196,7 +3196,7 @@ void Schematic::copyLabels(int& x1, int& y1, int& x2, int& y2, } } - for(Node *pn = Nodes->first(); pn != 0; pn = Nodes->next()) + for(Node *pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) { pl = pn->Label; if(pl) if(pl->isSelected) @@ -3221,9 +3221,9 @@ void Schematic::copyLabels(int& x1, int& y1, int& x2, int& y2, Painting* Schematic::selectedPainting(float fX, float fY) { - float Corr = 5.0 / Scale; // size of line select + float Corr = 5.0 / a_Scale; // size of line select - for(Painting *pp = Paintings->first(); pp != 0; pp = Paintings->next()) + for(Painting *pp = a_Paintings->first(); pp != 0; pp = a_Paintings->next()) if(pp->getSelected(fX, fY, Corr)) return pp; @@ -3237,7 +3237,7 @@ void Schematic::copyPaintings(int& x1, int& y1, int& x2, int& y2, Painting *pp; int bx1, by1, bx2, by2; // find boundings of all selected paintings - for(pp = Paintings->first(); pp != 0; ) + for(pp = a_Paintings->first(); pp != 0; ) if(pp->isSelected) { pp->Bounding(bx1, by1, bx2, by2); @@ -3247,10 +3247,10 @@ void Schematic::copyPaintings(int& x1, int& y1, int& x2, int& y2, if(by2 > y2) y2 = by2; ElementCache->append(pp); - Paintings->take(); - pp = Paintings->current(); + a_Paintings->take(); + pp = a_Paintings->current(); } - else pp = Paintings->next(); + else pp = a_Paintings->next(); } // vim:ts=8:sw=2:noet diff --git a/qucs/schematic_file.cpp b/qucs/schematic_file.cpp index 732e0346..e730a8d4 100644 --- a/qucs/schematic_file.cpp +++ b/qucs/schematic_file.cpp @@ -76,34 +76,34 @@ QString Schematic::createClipboardFile() // Build element document. s += "\n"; - for(pc = Components->first(); pc != 0; pc = Components->next()) + for(pc = a_Components->first(); pc != 0; pc = a_Components->next()) if(pc->isSelected) { s += pc->save()+"\n"; z++; } s += "\n"; s += "\n"; - for(pw = Wires->first(); pw != 0; pw = Wires->next()) + for(pw = a_Wires->first(); pw != 0; pw = a_Wires->next()) if(pw->isSelected) { z++; if(pw->Label) if(!pw->Label->isSelected) { - s += pw->save().section('"', 0, 0)+"\"\" 0 0 0>\n"; - continue; + s += pw->save().section('"', 0, 0)+"\"\" 0 0 0>\n"; + continue; } s += pw->save()+"\n"; } - for(Node *pn = Nodes->first(); pn != 0; pn = Nodes->next()) + for(Node *pn = a_Nodes->first(); pn != 0; pn = a_Nodes->next()) if(pn->Label) if(pn->Label->isSelected) { s += pn->Label->save()+"\n"; z++; } s += "\n"; s += "\n"; - for(pd = Diagrams->first(); pd != 0; pd = Diagrams->next()) + for(pd = a_Diagrams->first(); pd != 0; pd = a_Diagrams->next()) if(pd->isSelected) { s += pd->save()+"\n"; z++; } s += "\n"; s += "\n"; - for(pp = Paintings->first(); pp != 0; pp = Paintings->next()) + for(pp = a_Paintings->first(); pp != 0; pp = a_Paintings->next()) if(pp->isSelected) if(pp->Name.at(0) != '.') { // subcircuit specific -> do not copy s += "<"+pp->save()+">\n"; z++; } @@ -125,7 +125,7 @@ bool Schematic::loadIntoNothing(QTextStream *stream) } QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\n'Painting' field is not closed!")); + QObject::tr("Format Error:\n'Painting' field is not closed!")); return false; } @@ -148,7 +148,7 @@ bool Schematic::pasteFromClipboard(QTextStream *stream, Q3PtrList *pe) } // read content in symbol edit mode ************************* - if(symbolMode) { + if(a_symbolMode) { while(!stream->atEnd()) { Line = stream->readLine(); if(Line == "") { @@ -164,7 +164,7 @@ bool Schematic::pasteFromClipboard(QTextStream *stream, Q3PtrList *pe) if(!loadPaintings(stream, (Q3PtrList*)pe)) return false; } else { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Clipboard Format Error:\nUnknown field!")); + QObject::tr("Clipboard Format Error:\nUnknown field!")); return false; } } @@ -188,7 +188,7 @@ bool Schematic::pasteFromClipboard(QTextStream *stream, Q3PtrList *pe) if(!loadPaintings(stream, (Q3PtrList*)pe)) return false; } else { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Clipboard Format Error:\nUnknown field!")); + QObject::tr("Clipboard Format Error:\nUnknown field!")); return false; } } @@ -199,13 +199,13 @@ bool Schematic::pasteFromClipboard(QTextStream *stream, Q3PtrList *pe) // ------------------------------------------------------------- int Schematic::saveSymbolCpp (void) { - QFileInfo info (DocName); - QString cppfile = info.absolutePath () + QDir::separator() + DataSet; + QFileInfo info (a_DocName); + QString cppfile = info.absolutePath () + QDir::separator() + a_DataSet; QFile file (cppfile); if (!file.open (QIODevice::WriteOnly)) { QMessageBox::critical (0, QObject::tr("Error"), - QObject::tr("Cannot save C++ file \"%1\"!").arg(cppfile)); + QObject::tr("Cannot save C++ file \"%1\"!").arg(cppfile)); return -1; } @@ -221,11 +221,11 @@ int Schematic::saveSymbolCpp (void) Painting * pp; stream << " // symbol drawing code\n"; - for (pp = SymbolPaints.first (); pp != 0; pp = SymbolPaints.next ()) { + for (pp = a_SymbolPaints.first (); pp != 0; pp = a_SymbolPaints.next ()) { if (pp->Name == ".ID ") continue; if (pp->Name == ".PortSym ") { if (((PortSymbol*)pp)->numberStr.toInt() > maxNum) - maxNum = ((PortSymbol*)pp)->numberStr.toInt(); + maxNum = ((PortSymbol*)pp)->numberStr.toInt(); x1 = ((PortSymbol*)pp)->cx; y1 = ((PortSymbol*)pp)->cy; if (x1 < xmin) xmin = x1; @@ -244,19 +244,21 @@ int Schematic::saveSymbolCpp (void) stream << "\n // terminal definitions\n"; for (int i = 1; i <= maxNum; i++) { - for (pp = SymbolPaints.first (); pp != 0; pp = SymbolPaints.next ()) { - if (pp->Name == ".PortSym ") - if (((PortSymbol*)pp)->numberStr.toInt() == i) - stream << " " << pp->saveCpp () << "\n"; + for (pp = a_SymbolPaints.first (); pp != 0; pp = a_SymbolPaints.next ()) { + if (pp->Name == ".PortSym ") { + if (((PortSymbol*)pp)->numberStr.toInt() == i) { + stream << " " << pp->saveCpp () << "\n"; + } + } } } stream << "\n // symbol boundings\n" - << " x1 = " << xmin << "; " << " y1 = " << ymin << ";\n" - << " x2 = " << xmax << "; " << " y2 = " << ymax << ";\n"; + << " x1 = " << xmin << "; " << " y1 = " << ymin << ";\n" + << " x2 = " << xmax << "; " << " y2 = " << ymax << ";\n"; stream << "\n // property text position\n"; - for (pp = SymbolPaints.first (); pp != 0; pp = SymbolPaints.next ()) + for (pp = a_SymbolPaints.first (); pp != 0; pp = a_SymbolPaints.next ()) if (pp->Name == ".ID ") stream << " " << pp->saveCpp () << "\n"; @@ -266,7 +268,7 @@ int Schematic::saveSymbolCpp (void) int Schematic::savePropsJSON() { - QFileInfo info (DocName); + QFileInfo info (a_DocName); QString jsonfile = info.absolutePath () + QDir::separator() + info.baseName() + "_props.json"; QString vafilename = info.absolutePath () + QDir::separator() @@ -471,7 +473,7 @@ int Schematic::savePropsJSON() // save symbol paintings in JSON format int Schematic::saveSymbolJSON() { - QFileInfo info (DocName); + QFileInfo info (a_DocName); QString jsonfile = info.absolutePath () + QDir::separator() + info.baseName() + "_sym.json"; @@ -501,11 +503,11 @@ int Schematic::saveSymbolJSON() stream << "\"paintings\" : [\n"; // symbol drawing code" - for (pp = SymbolPaints.first (); pp != 0; pp = SymbolPaints.next ()) { + for (pp = a_SymbolPaints.first (); pp != 0; pp = a_SymbolPaints.next ()) { if (pp->Name == ".ID ") continue; if (pp->Name == ".PortSym ") { if (((PortSymbol*)pp)->numberStr.toInt() > maxNum) - maxNum = ((PortSymbol*)pp)->numberStr.toInt(); + maxNum = ((PortSymbol*)pp)->numberStr.toInt(); x1 = ((PortSymbol*)pp)->cx; y1 = ((PortSymbol*)pp)->cy; if (x1 < xmin) xmin = x1; @@ -525,10 +527,12 @@ int Schematic::saveSymbolJSON() // terminal definitions //stream << "terminal \n"; for (int i = 1; i <= maxNum; i++) { - for (pp = SymbolPaints.first (); pp != 0; pp = SymbolPaints.next ()) { - if (pp->Name == ".PortSym ") - if (((PortSymbol*)pp)->numberStr.toInt() == i) - stream << " " << pp->saveJSON () << "\n"; + for (pp = a_SymbolPaints.first (); pp != 0; pp = a_SymbolPaints.next ()) { + if (pp->Name == ".PortSym ") { + if (((PortSymbol*)pp)->numberStr.toInt() == i) { + stream << " " << pp->saveJSON () << "\n"; + } + } } } @@ -540,7 +544,7 @@ int Schematic::saveSymbolJSON() << " \"x2\" : " << xmax << ",\n" << " \"y2\" : " << ymax << ",\n"; // property text position - for (pp = SymbolPaints.first (); pp != 0; pp = SymbolPaints.next ()) + for (pp = a_SymbolPaints.first (); pp != 0; pp = a_SymbolPaints.next ()) if (pp->Name == ".ID ") stream << " " << pp->saveJSON () << "\n"; @@ -556,10 +560,10 @@ int Schematic::saveSymbolJSON() // Returns the number of subcircuit ports. int Schematic::saveDocument() { - QFile file(DocName); + QFile file(a_DocName); if(!file.open(QIODevice::WriteOnly)) { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Cannot save document!")); + QObject::tr("Cannot save document!")); return -1; } @@ -569,9 +573,9 @@ int Schematic::saveDocument() // Special case of saving a file when we want to save *only* // the symbol defintion (i.e. to create a "symbol file") - if (DocName.endsWith(".sym")) { + if (a_DocName.endsWith(".sym")) { stream << "\n"; - for(auto* pp : SymbolPaints) { + for(auto* pp : a_SymbolPaints) { stream << " <" << pp->save() << ">\n"; } stream << "\n"; @@ -580,63 +584,63 @@ int Schematic::saveDocument() } stream << "\n"; - if(symbolMode) { - stream << " \n"; + if(a_symbolMode) { + stream << " \n"; } else { - stream << " \n"; + stream << " \n"; } - stream << " \n"; - stream << " \n"; - stream << " \n"; - stream << " \n"; - stream << " \n"; - stream << " \n"; - stream << " \n"; + stream << " \n"; + stream << " \n"; + stream << " \n"; + stream << " \n"; + stream << " \n"; + stream << " \n"; + stream << " \n"; QString t; - misc::convert2ASCII(t = Frame_Text0); + misc::convert2ASCII(t = a_Frame_Text0); stream << " \n"; - misc::convert2ASCII(t = Frame_Text1); + misc::convert2ASCII(t = a_Frame_Text1); stream << " \n"; - misc::convert2ASCII(t = Frame_Text2); + misc::convert2ASCII(t = a_Frame_Text2); stream << " \n"; - misc::convert2ASCII(t = Frame_Text3); + misc::convert2ASCII(t = a_Frame_Text3); stream << " \n"; stream << "\n"; Painting *pp; stream << "\n"; // save all paintings for symbol - for(pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) + for(pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) stream << " <" << pp->save() << ">\n"; stream << "\n"; stream << "\n"; // save all components - for(Component *pc = DocComps.first(); pc != 0; pc = DocComps.next()) + for(Component *pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) stream << " " << pc->save() << "\n"; stream << "\n"; stream << "\n"; // save all wires - for(Wire *pw = DocWires.first(); pw != 0; pw = DocWires.next()) + for(Wire *pw = a_DocWires.first(); pw != 0; pw = a_DocWires.next()) stream << " " << pw->save() << "\n"; // save all labeled nodes as wires - for(Node *pn = DocNodes.first(); pn != 0; pn = DocNodes.next()) + for(Node *pn = a_DocNodes.first(); pn != 0; pn = a_DocNodes.next()) if(pn->Label) stream << " " << pn->Label->save() << "\n"; stream << "\n"; stream << "\n"; // save all diagrams - for(Diagram *pd = DocDiags.first(); pd != 0; pd = DocDiags.next()) + for(Diagram *pd = a_DocDiags.first(); pd != 0; pd = a_DocDiags.next()) stream << " " << pd->save() << "\n"; stream << "\n"; stream << "\n"; // save all paintings - for(pp = DocPaints.first(); pp != 0; pp = DocPaints.next()) + for(pp = a_DocPaints.first(); pp != 0; pp = a_DocPaints.next()) stream << " <" << pp->save() << ">\n"; stream << "\n"; @@ -645,7 +649,7 @@ int Schematic::saveDocument() // additionally save symbol C++ code if in a symbol drawing and the // associated file is a Verilog-A file if (fileSuffix () == "sym") { - if (fileSuffix (DataDisplay) == "va") { + if (fileSuffix (a_DataDisplay) == "va") { saveSymbolCpp (); saveSymbolJSON (); if (QucsSettings.DefaultSimulator == spicecompat::simNgspice) { @@ -767,54 +771,56 @@ bool Schematic::loadProperties(QTextStream *stream) if(Line.at(0) != '<') { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\nWrong property field limiter!")); + QObject::tr("Format Error:\nWrong property field limiter!")); return false; } if(Line.at(Line.length()-1) != '>') { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\nWrong property field limiter!")); + QObject::tr("Format Error:\nWrong property field limiter!")); return false; } Line = Line.mid(1, Line.length()-2); // cut off start and end character cstr = Line.section('=',0,0); // property type nstr = Line.section('=',1,1); // property value - if(cstr == "View") { - ViewX1 = nstr.section(',',0,0).toInt(&ok); if(ok) { - ViewY1 = nstr.section(',',1,1).toInt(&ok); if(ok) { - ViewX2 = nstr.section(',',2,2).toInt(&ok); if(ok) { - ViewY2 = nstr.section(',',3,3).toInt(&ok); if(ok) { - Scale = nstr.section(',',4,4).toDouble(&ok); if(ok) { - tmpViewX1 = nstr.section(',',5,5).toInt(&ok); if(ok) - tmpViewY1 = nstr.section(',',6,6).toInt(&ok); }}}}} } + if(cstr == "View") { + a_ViewX1 = nstr.section(',',0,0).toInt(&ok); if(ok) { + a_ViewY1 = nstr.section(',',1,1).toInt(&ok); if(ok) { + a_ViewX2 = nstr.section(',',2,2).toInt(&ok); if(ok) { + a_ViewY2 = nstr.section(',',3,3).toInt(&ok); if(ok) { + a_Scale = nstr.section(',',4,4).toDouble(&ok); if(ok) { + a_tmpViewX1 = nstr.section(',',5,5).toInt(&ok); if(ok) + a_tmpViewY1 = nstr.section(',',6,6).toInt(&ok); }}}}} + } else if(cstr == "Grid") { - GridX = nstr.section(',',0,0).toInt(&ok); if(ok) { - GridY = nstr.section(',',1,1).toInt(&ok); if(ok) { - if(nstr.section(',',2,2).toInt(&ok) == 0) GridOn = false; - else GridOn = true; }} } - else if(cstr == "DataSet") DataSet = nstr; - else if(cstr == "DataDisplay") DataDisplay = nstr; + a_GridX = nstr.section(',',0,0).toInt(&ok); if(ok) { + a_GridY = nstr.section(',',1,1).toInt(&ok); if(ok) { + if(nstr.section(',',2,2).toInt(&ok) == 0) a_GridOn = false; + else a_GridOn = true; }} + } + else if(cstr == "DataSet") a_DataSet = nstr; + else if(cstr == "DataDisplay") a_DataDisplay = nstr; else if(cstr == "OpenDisplay") - if(nstr.toInt(&ok) == 0) SimOpenDpl = false; - else SimOpenDpl = true; - else if(cstr == "Script") Script = nstr; + if(nstr.toInt(&ok) == 0) a_SimOpenDpl = false; + else a_SimOpenDpl = true; + else if(cstr == "Script") a_Script = nstr; else if(cstr == "RunScript") - if(nstr.toInt(&ok) == 0) SimRunScript = false; - else SimRunScript = true; + if(nstr.toInt(&ok) == 0) a_SimRunScript = false; + else a_SimRunScript = true; else if(cstr == "showFrame") - showFrame = nstr.at(0).toLatin1() - '0'; - else if(cstr == "FrameText0") misc::convert2Unicode(Frame_Text0 = nstr); - else if(cstr == "FrameText1") misc::convert2Unicode(Frame_Text1 = nstr); - else if(cstr == "FrameText2") misc::convert2Unicode(Frame_Text2 = nstr); - else if(cstr == "FrameText3") misc::convert2Unicode(Frame_Text3 = nstr); + a_showFrame = nstr.at(0).toLatin1() - '0'; + else if(cstr == "FrameText0") misc::convert2Unicode(a_Frame_Text0 = nstr); + else if(cstr == "FrameText1") misc::convert2Unicode(a_Frame_Text1 = nstr); + else if(cstr == "FrameText2") misc::convert2Unicode(a_Frame_Text2 = nstr); + else if(cstr == "FrameText3") misc::convert2Unicode(a_Frame_Text3 = nstr); else { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\nUnknown property: ")+cstr); + QObject::tr("Format Error:\nUnknown property: ")+cstr); return false; } if(!ok) { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\nNumber expected in property field!")); + QObject::tr("Format Error:\nNumber expected in property field!")); return false; } } @@ -836,20 +842,20 @@ void Schematic::simpleInsertComponent(Component *c) y = pp->y+c->cy; // check if new node lies upon existing node - for(pn = DocNodes.first(); pn != 0; pn = DocNodes.next()) + for(pn = a_DocNodes.first(); pn != 0; pn = a_DocNodes.next()) if(pn->cx == x) if(pn->cy == y) { - if (!pn->DType.isEmpty()) { - pp->Type = pn->DType; - } - if (!pp->Type.isEmpty()) { - pn->DType = pp->Type; - } - break; + if (!pn->DType.isEmpty()) { + pp->Type = pn->DType; + } + if (!pp->Type.isEmpty()) { + pn->DType = pp->Type; + } + break; } if(pn == nullptr) { // create new node, if no existing one lies at this position pn = new Node(x, y); - DocNodes.append(pn); + a_DocNodes.append(pn); } pn->connect(c); // connect schematic node to component node if (!pp->Type.isEmpty()) { @@ -859,7 +865,7 @@ void Schematic::simpleInsertComponent(Component *c) pp->Connection = pn; // connect component node to schematic node } - DocComps.append(c); + a_DocComps.append(c); } // ------------------------------------------------------------- @@ -898,12 +904,12 @@ void Schematic::simpleInsertWire(Wire *pw) { Node *pn; // check if first wire node lies upon existing node - for(pn = DocNodes.first(); pn != 0; pn = DocNodes.next()) + for(pn = a_DocNodes.first(); pn != 0; pn = a_DocNodes.next()) if(pn->cx == pw->x1) if(pn->cy == pw->y1) break; if(!pn) { // create new node, if no existing one lies at this position pn = new Node(pw->x1, pw->y1); - DocNodes.append(pn); + a_DocNodes.append(pn); } if(pw->x1 == pw->x2) if(pw->y1 == pw->y2) { @@ -919,17 +925,17 @@ void Schematic::simpleInsertWire(Wire *pw) pw->Port1 = pn; // check if second wire node lies upon existing node - for(pn = DocNodes.first(); pn != 0; pn = DocNodes.next()) + for(pn = a_DocNodes.first(); pn != 0; pn = a_DocNodes.next()) if(pn->cx == pw->x2) if(pn->cy == pw->y2) break; if(!pn) { // create new node, if no existing one lies at this position pn = new Node(pw->x2, pw->y2); - DocNodes.append(pn); + a_DocNodes.append(pn); } pn->connect(pw); // connect schematic node to component node pw->Port2 = pn; - DocWires.append(pw); + a_DocWires.append(pw); } // ------------------------------------------------------------- @@ -947,16 +953,16 @@ bool Schematic::loadWires(QTextStream *stream, Q3PtrList *List) w = new Wire(0,0,0,0, (Node*)4,(Node*)4); if(!w->load(Line)) { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\nWrong 'wire' line format!")); + QObject::tr("Format Error:\nWrong 'wire' line format!")); delete w; return false; } if(List) { if(w->x1 == w->x2) if(w->y1 == w->y2) if(w->Label) { - w->Label->Type = isMovingLabel; - List->append(w->Label); - delete w; - continue; + w->Label->Type = isMovingLabel; + List->append(w->Label); + delete w; + continue; } List->append(w); if(w->Label) List->append(w->Label); @@ -965,7 +971,7 @@ bool Schematic::loadWires(QTextStream *stream, Q3PtrList *List) } QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\n'Wire' field is not closed!")); + QObject::tr("Format Error:\n'Wire' field is not closed!")); return false; } @@ -994,13 +1000,13 @@ bool Schematic::loadDiagrams(QTextStream *stream, Q3PtrList *List) else if(cstr == "load(Line, stream)) { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\nWrong 'diagram' line format!")); + QObject::tr("Format Error:\nWrong 'diagram' line format!")); delete d; return false; } @@ -1008,7 +1014,7 @@ bool Schematic::loadDiagrams(QTextStream *stream, Q3PtrList *List) } QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\n'Diagram' field is not closed!")); + QObject::tr("Format Error:\n'Diagram' field is not closed!")); return false; } @@ -1027,7 +1033,7 @@ bool Schematic::loadPaintings(QTextStream *stream, Q3PtrList *List) if(Line.isEmpty()) continue; if( (Line.at(0) != '<') || (Line.at(Line.length()-1) != '>')) { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\nWrong 'painting' line delimiter!")); + QObject::tr("Format Error:\nWrong 'painting' line delimiter!")); return false; } Line = Line.mid(1, Line.length()-2); // cut off start and end character @@ -1043,13 +1049,13 @@ bool Schematic::loadPaintings(QTextStream *stream, Q3PtrList *List) else if(cstr == "Ellipse") p = new qucs::Ellipse(); else { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\nUnknown painting!")); + QObject::tr("Format Error:\nUnknown painting!")); return false; } if(!p->load(Line)) { QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\nWrong 'painting' line format!")); + QObject::tr("Format Error:\nWrong 'painting' line format!")); delete p; return false; } @@ -1057,7 +1063,7 @@ bool Schematic::loadPaintings(QTextStream *stream, Q3PtrList *List) } QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Format Error:\n'Painting' field is not closed!")); + QObject::tr("Format Error:\n'Painting' field is not closed!")); return false; } @@ -1067,20 +1073,20 @@ bool Schematic::loadPaintings(QTextStream *stream, Q3PtrList *List) */ bool Schematic::loadDocument() { - QFile file(DocName); + QFile file(a_DocName); if(!file.open(QIODevice::ReadOnly)) { /// \todo implement unified error/warning handling GUI and CLI if (QucsMain != nullptr) QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("Cannot load document: ")+DocName); + QObject::tr("Cannot load document: ")+a_DocName); else qCritical() << "Schematic::loadDocument:" - << QObject::tr("Cannot load document: ")+DocName; + << QObject::tr("Cannot load document: ")+a_DocName; return false; } // Keep reference to source file (the schematic file) - setFileInfo(DocName); + setFileInfo(a_DocName); QString Line; QTextStream stream(&file); @@ -1098,7 +1104,7 @@ bool Schematic::loadDocument() if(Line.left(16) != "") { - if(!loadPaintings(&stream, &SymbolPaints)) { + if(!loadPaintings(&stream, &a_SymbolPaints)) { file.close(); return false; } @@ -1145,14 +1151,14 @@ bool Schematic::loadDocument() if(!loadWires(&stream)) { file.close(); return false; } } else if(Line == "") { - if(!loadDiagrams(&stream, &DocDiags)) { file.close(); return false; } } + if(!loadDiagrams(&stream, &a_DocDiags)) { file.close(); return false; } } else if(Line == "") { - if(!loadPaintings(&stream, &DocPaints)) { file.close(); return false; } } + if(!loadPaintings(&stream, &a_DocPaints)) { file.close(); return false; } } else { qDebug() << Line; QMessageBox::critical(0, QObject::tr("Error"), - QObject::tr("File Format Error:\nUnknown field!")); + QObject::tr("File Format Error:\nUnknown field!")); file.close(); return false; } @@ -1175,22 +1181,22 @@ QString Schematic::createUndoString(char Op) // Build element document. QString s = " \n"; s.replace(0,1,Op); - for(pc = DocComps.first(); pc != 0; pc = DocComps.next()) + for(pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) s += pc->save()+"\n"; s += "\n"; // short end flag - for(pw = DocWires.first(); pw != 0; pw = DocWires.next()) + for(pw = a_DocWires.first(); pw != 0; pw = a_DocWires.next()) s += pw->save()+"\n"; // save all labeled nodes as wires - for(Node *pn = DocNodes.first(); pn != 0; pn = DocNodes.next()) + for(Node *pn = a_DocNodes.first(); pn != 0; pn = a_DocNodes.next()) if(pn->Label) s += pn->Label->save()+"\n"; s += "\n"; - for(pd = DocDiags.first(); pd != 0; pd = DocDiags.next()) + for(pd = a_DocDiags.first(); pd != 0; pd = a_DocDiags.next()) s += pd->save()+"\n"; s += "\n"; - for(pp = DocPaints.first(); pp != 0; pp = DocPaints.next()) + for(pp = a_DocPaints.first(); pp != 0; pp = a_DocPaints.next()) s += "<"+pp->save()+">\n"; s += "\n"; @@ -1210,7 +1216,7 @@ QString Schematic::createSymbolUndoString(char Op) s += "\n"; // short end flag for wires s += "\n"; // short end flag for diagrams - for(pp = SymbolPaints.first(); pp != 0; pp = SymbolPaints.next()) + for(pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next()) s += "<"+pp->save()+">\n"; s += "\n"; @@ -1222,11 +1228,11 @@ QString Schematic::createSymbolUndoString(char Op) // Used for "undo" function. bool Schematic::rebuild(QString *s) { - DocWires.clear(); // delete whole document - DocNodes.clear(); - DocComps.clear(); - DocDiags.clear(); - DocPaints.clear(); + a_DocWires.clear(); // delete whole document + a_DocNodes.clear(); + a_DocComps.clear(); + a_DocDiags.clear(); + a_DocPaints.clear(); QString Line; QTextStream stream(s, QIODevice::ReadOnly); @@ -1235,8 +1241,8 @@ bool Schematic::rebuild(QString *s) // read content ************************* if(!loadComponents(&stream)) return false; if(!loadWires(&stream)) return false; - if(!loadDiagrams(&stream, &DocDiags)) return false; - if(!loadPaintings(&stream, &DocPaints)) return false; + if(!loadDiagrams(&stream, &a_DocDiags)) return false; + if(!loadPaintings(&stream, &a_DocPaints)) return false; return true; } @@ -1245,7 +1251,7 @@ bool Schematic::rebuild(QString *s) // Same as "rebuild(QString *s)" but for symbol edit mode. bool Schematic::rebuildSymbol(QString *s) { - SymbolPaints.clear(); // delete whole document + a_SymbolPaints.clear(); // delete whole document QString Line; QTextStream stream(s, QIODevice::ReadOnly); @@ -1255,7 +1261,7 @@ bool Schematic::rebuildSymbol(QString *s) Line = stream.readLine(); // skip components Line = stream.readLine(); // skip wires Line = stream.readLine(); // skip diagrams - if(!loadPaintings(&stream, &SymbolPaints)) return false; + if(!loadPaintings(&stream, &a_SymbolPaints)) return false; return true; } @@ -1268,7 +1274,7 @@ bool Schematic::rebuildSymbol(QString *s) // *************************************************************** void Schematic::createNodeSet(QStringList& Collect, int& countInit, - Conductor *pw, Node *p1) + Conductor *pw, Node *p1) { if(pw->Label) if(!pw->Label->initValue.isEmpty()) @@ -1278,27 +1284,27 @@ void Schematic::createNodeSet(QStringList& Collect, int& countInit, // --------------------------------------------------- void Schematic::throughAllNodes(bool User, QStringList& Collect, - int& countInit) + int& countInit) { Node *pn; int z=0; - for(pn = DocNodes.first(); pn != 0; pn = DocNodes.next()) { + for(pn = a_DocNodes.first(); pn != 0; pn = a_DocNodes.next()) { if(pn->Name.isEmpty() == User) { continue; // already named ? } if(!User) { - if(isAnalog) - pn->Name = "_net"; + if(a_isAnalog) + pn->Name = "_net"; else - pn->Name = "net_net"; // VHDL names must not begin with '_' + pn->Name = "net_net"; // VHDL names must not begin with '_' pn->Name += QString::number(z++); // create numbered node name } else if(pn->State) { continue; // already worked on } - if(isAnalog) createNodeSet(Collect, countInit, pn, pn); + if(a_isAnalog) createNodeSet(Collect, countInit, pn, pn); pn->State = 1; propagateNode(Collect, countInit, pn); @@ -1377,10 +1383,10 @@ void Schematic::collectDigitalSignals(void) { Node *pn; - for(pn = DocNodes.first(); pn != 0; pn = DocNodes.next()) { - DigMap::Iterator it = Signals.find(pn->Name); - if(it == Signals.end()) { // avoid redeclaration of signal - Signals.insert(pn->Name, DigSignal(pn->Name, pn->DType)); + for(pn = a_DocNodes.first(); pn != 0; pn = a_DocNodes.next()) { + DigMap::Iterator it = a_Signals.find(pn->Name); + if(it == a_Signals.end()) { // avoid redeclaration of signal + a_Signals.insert(pn->Name, DigSignal(pn->Name, pn->DType)); } else if (!pn->DType.isEmpty()) { it.value().Type = pn->DType; } @@ -1390,7 +1396,7 @@ void Schematic::collectDigitalSignals(void) // --------------------------------------------------- // Propagates the given node to connected component ports. void Schematic::propagateNode(QStringList& Collect, - int& countInit, Node *pn) + int& countInit, Node *pn) { bool setName=false; Q3PtrList Cons; @@ -1401,28 +1407,28 @@ void Schematic::propagateNode(QStringList& Collect, for(p2 = Cons.first(); p2 != 0; p2 = Cons.next()) for(auto* pe : *p2) if(pe->Type == isWire) { - pw = (Wire*)pe; - if(p2 != pw->Port1) { - if(pw->Port1->Name.isEmpty()) { - pw->Port1->Name = pn->Name; - pw->Port1->State = 1; - Cons.append(pw->Port1); - setName = true; - } - } - else { - if(pw->Port2->Name.isEmpty()) { - pw->Port2->Name = pn->Name; - pw->Port2->State = 1; - Cons.append(pw->Port2); - setName = true; - } - } - if(setName) { - Cons.findRef(p2); // back to current Connection - if (isAnalog) createNodeSet(Collect, countInit, pw, pn); - setName = false; - } + pw = (Wire*)pe; + if(p2 != pw->Port1) { + if(pw->Port1->Name.isEmpty()) { + pw->Port1->Name = pn->Name; + pw->Port1->State = 1; + Cons.append(pw->Port1); + setName = true; + } + } + else { + if(pw->Port2->Name.isEmpty()) { + pw->Port2->Name = pn->Name; + pw->Port2->State = 1; + Cons.append(pw->Port2); + setName = true; + } + } + if(setName) { + Cons.findRef(p2); // back to current Connection + if (a_isAnalog) createNodeSet(Collect, countInit, pw, pn); + setName = false; + } } Cons.clear(); } @@ -1447,14 +1453,14 @@ bool Schematic::throughAllComps(QTextStream *stream, int& countInit, QString s; // give the ground nodes the name "gnd", and insert subcircuits etc. - Q3PtrListIterator it(DocComps); + Q3PtrListIterator it(a_DocComps); Component *pc; while((pc = it.current()) != 0) { ++it; if(pc->isActive != COMP_IS_ACTIVE) continue; // check analog/digital typed components - if(isAnalog) { + if(a_isAnalog) { if((pc->Type & isAnalogComponent) == 0) { ErrText->appendPlainText(QObject::tr("ERROR: Component \"%1\" has no analog model.").arg(pc->Name)); return false; @@ -1515,10 +1521,10 @@ bool Schematic::throughAllComps(QTextStream *stream, int& countInit, qCritical() << "Schematic::throughAllComps" << message; return false; } - d->DocName = s; - d->isVerilog = isVerilog; - d->isAnalog = isAnalog; - d->creatingLib = creatingLib; + d->a_DocName = s; + d->a_isVerilog = a_isVerilog; + d->a_isAnalog = a_isAnalog; + d->a_creatingLib = a_creatingLib; r = d->createSubNetlist(stream, countInit, Collect, ErrText, NumPorts); if (r) { @@ -1526,12 +1532,12 @@ bool Schematic::throughAllComps(QTextStream *stream, int& countInit, // save in/out signal types of subcircuit for (Port *pp : pc->Ports) { - //if(i>=d->PortTypes.count())break; - pp->Type = d->PortTypes[i]; + //if(i>=d->a_PortTypes.count())break; + pp->Type = d->a_PortTypes[i]; pp->Connection->DType = pp->Type; i++; } - sub.PortTypes = d->PortTypes; + sub.PortTypes = d->a_PortTypes; FileList.insert(f,sub); //FileList.replace(f, sub); } @@ -1544,11 +1550,11 @@ bool Schematic::throughAllComps(QTextStream *stream, int& countInit, } // if(pc->Model == "Sub") if(LibComp* lib = dynamic_cast(pc)) { - if(creatingLib) { - ErrText->appendPlainText( - QObject::tr("WARNING: Skipping library component \"%1\"."). - arg(pc->Name)); - continue; + if(a_creatingLib) { + ErrText->appendPlainText( + QObject::tr("WARNING: Skipping library component \"%1\"."). + arg(pc->Name)); + continue; } QString scfile = pc->getSubcircuitFile(); s = scfile + "/" + pc->Props.at(1)->Value; @@ -1557,22 +1563,21 @@ bool Schematic::throughAllComps(QTextStream *stream, int& countInit, continue; // insert each library subcircuit just one time FileList.insert(s, SubFile("LIB", s)); - - unsigned whatisit = isAnalog?1:(isVerilog?4:2); - if(isAnalog) { + unsigned whatisit = a_isAnalog?1:(a_isVerilog?4:2); + if(a_isAnalog) { if (QucsSettings.DefaultSimulator!=spicecompat::simQucsator) { if (QucsSettings.DefaultSimulator==spicecompat::simXyce) whatisit = 16; else whatisit = 8; } else whatisit = 1; - } - r = lib->createSubNetlist(stream, Collect, whatisit); + } + r = lib->createSubNetlist(stream, Collect, whatisit); if(!r) { - ErrText->appendPlainText( - QObject::tr("ERROR: \"%1\": Cannot load library component \"%2\" from \"%3\""). - arg(pc->Name, pc->Props.at(1)->Value, scfile)); - return false; + ErrText->appendPlainText( + QObject::tr("ERROR: \"%1\": Cannot load library component \"%2\" from \"%3\""). + arg(pc->Name, pc->Props.at(1)->Value, scfile)); + return false; } continue; } @@ -1624,15 +1629,15 @@ bool Schematic::throughAllComps(QTextStream *stream, int& countInit, // handle digital file subcircuits if(pc->Model == "VHDL" || pc->Model == "Verilog") { - if(isVerilog && pc->Model == "VHDL") - continue; - if(!isVerilog && pc->Model == "Verilog") - continue; + if(a_isVerilog && pc->Model == "VHDL") + continue; + if(!a_isVerilog && pc->Model == "Verilog") + continue; s = pc->Props.front()->Value; if(s.isEmpty()) { ErrText->appendPlainText(QObject::tr("ERROR: No file name in %1 component \"%2\"."). - arg(pc->Model). - arg(pc->Name)); + arg(pc->Model). + arg(pc->Name)); return false; } QString f = pc->getSubcircuitFile(); @@ -1643,20 +1648,20 @@ bool Schematic::throughAllComps(QTextStream *stream, int& countInit, FileList.insert(f, SubFile(s, f)); if(pc->Model == "VHDL") { - VHDL_File *vf = (VHDL_File*)pc; - r = vf->createSubNetlist(stream); - ErrText->appendPlainText(vf->getErrorText()); - if(!r) { - return false; - } + VHDL_File *vf = (VHDL_File*)pc; + r = vf->createSubNetlist(stream); + ErrText->appendPlainText(vf->getErrorText()); + if(!r) { + return false; + } } if(pc->Model == "Verilog") { - Verilog_File *vf = (Verilog_File*)pc; - r = vf->createSubNetlist(stream); - ErrText->appendPlainText(vf->getErrorText()); - if(!r) { - return false; - } + Verilog_File *vf = (Verilog_File*)pc; + r = vf->createSubNetlist(stream); + ErrText->appendPlainText(vf->getErrorText()); + if(!r) { + return false; + } } continue; } @@ -1672,10 +1677,10 @@ bool Schematic::giveNodeNames(QTextStream *stream, int& countInit, QStringList& Collect, QPlainTextEdit *ErrText, int NumPorts) { // delete the node names - for(Node *pn = DocNodes.first(); pn != 0; pn = DocNodes.next()) { + for(Node *pn = a_DocNodes.first(); pn != 0; pn = a_DocNodes.next()) { pn->State = 0; if(pn->Label) { - if(isAnalog) + if(a_isAnalog) pn->Name = pn->Label->Name; else pn->Name = "net" + pn->Label->Name; @@ -1684,9 +1689,9 @@ bool Schematic::giveNodeNames(QTextStream *stream, int& countInit, } // set the wire names to the connected node - for(Wire *pw = DocWires.first(); pw != 0; pw = DocWires.next()) + for(Wire *pw = a_DocWires.first(); pw != 0; pw = a_DocWires.next()) if(pw->Label != 0) { - if(isAnalog) + if(a_isAnalog) pw->Port1->Name = pw->Label->Name; else // avoid to use reserved VHDL words pw->Port1->Name = "net" + pw->Label->Name; @@ -1704,7 +1709,7 @@ bool Schematic::giveNodeNames(QTextStream *stream, int& countInit, // give names to the remaining (unnamed) nodes throughAllNodes(false, Collect, countInit); - if(!isAnalog) // collect all node names for VHDL signal declaration + if(!a_isAnalog) // collect all node names for VHDL signal declaration collectDigitalSignals(); return true; @@ -1712,25 +1717,25 @@ bool Schematic::giveNodeNames(QTextStream *stream, int& countInit, // --------------------------------------------------- bool Schematic::createLibNetlist(QTextStream *stream, QPlainTextEdit *ErrText, - int NumPorts) + int NumPorts) { int countInit = 0; QStringList Collect; Collect.clear(); FileList.clear(); - Signals.clear(); + a_Signals.clear(); // Apply node names and collect subcircuits and file include - creatingLib = true; + a_creatingLib = true; if(!giveNodeNames(stream, countInit, Collect, ErrText, NumPorts)) { - creatingLib = false; + a_creatingLib = false; return false; } - creatingLib = false; + a_creatingLib = false; // Marking start of actual top-level subcircuit QString c; - if(!isAnalog) { - if (isVerilog) + if(!a_isAnalog) { + if (a_isVerilog) c = "///"; else c = "---"; @@ -1741,7 +1746,7 @@ bool Schematic::createLibNetlist(QTextStream *stream, QPlainTextEdit *ErrText, // Emit subcircuit components createSubNetlistPlain(stream, ErrText, NumPorts); - Signals.clear(); // was filled in "giveNodeNames()" + a_Signals.clear(); // was filled in "giveNodeNames()" return true; } @@ -1768,8 +1773,8 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe // probably creating a library currently QTextStream * tstream = stream; QFile ofile; - if(creatingLib) { - QString f = misc::properAbsFileName(DocName) + ".lst"; + if(a_creatingLib) { + QString f = misc::properAbsFileName(a_DocName) + ".lst"; ofile.setFileName(f); if(!ofile.open(QIODevice::WriteOnly)) { ErrText->appendPlainText(tr("ERROR: Cannot create library file \"%s\".").arg(f)); @@ -1780,11 +1785,11 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe // collect subcircuit ports and sort their node names into // "SubcircuitPortNames" - PortTypes.clear(); - for(pc = DocComps.first(); pc != 0; pc = DocComps.next()) { + a_PortTypes.clear(); + for(pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) { if(pc->Model.at(0) == '.') { // no simulations in subcircuits ErrText->appendPlainText( - QObject::tr("WARNING: Ignore simulation component in subcircuit \"%1\".").arg(DocName)+"\n"); + QObject::tr("WARNING: Ignore simulation component in subcircuit \"%1\".").arg(a_DocName)+"\n"); continue; } else if(pc->Model == "Port") { @@ -1801,15 +1806,15 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe it_type++; } (*it_name) = pc->Ports.first()->Connection->Name; - DigMap::Iterator it = Signals.find(*it_name); - if(it!=Signals.end()) + DigMap::Iterator it = a_Signals.find(*it_name); + if(it!=a_Signals.end()) (*it_type) = it.value().Type; // propagate type to port symbol pc->Ports.first()->Connection->DType = *it_type; - if(!isAnalog) { - if (isVerilog) { - Signals.remove(*it_name); // remove node name + if(!a_isAnalog) { + if (a_isVerilog) { + a_Signals.remove(*it_name); // remove node name switch(pc->Props.at(1)->Value.at(0).toLatin1()) { case 'a': InOutPorts.append(*it_name); @@ -1823,13 +1828,13 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe } else { // remove node name of output port - Signals.remove(*it_name); + a_Signals.remove(*it_name); switch(pc->Props.at(1)->Value.at(0).toLatin1()) { case 'a': (*it_name) += " : inout"; // attribute "analog" is "inout" break; case 'o': // output ports need workaround - Signals.insert(*it_name, DigSignal(*it_name, *it_type)); + a_Signals.insert(*it_name, DigSignal(*it_name, *it_type)); (*it_name) = "net_out" + (*it_name); (*it_name) += " : " + pc->Props.at(1)->Value; break; @@ -1851,13 +1856,13 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe it_name = SubcircuitPortNames.erase(it_name); it_type = SubcircuitPortTypes.erase(it_type); } else { - PortTypes.append(*it_type); + a_PortTypes.append(*it_type); it_name++; it_type++; } } - QString f = misc::properFileName(DocName); + QString f = misc::properFileName(a_DocName); QString Type = misc::properName(f); Painting *pi; @@ -1866,10 +1871,10 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe if (QucsSettings.DefaultSimulator == spicecompat::simQucsator) { - if(isAnalog) { + if(a_isAnalog) { // ..... analog subcircuit ................................... (*tstream) << "\n.Def:" << Type << " " << SubcircuitPortNames.join(" "); - for(pi = SymbolPaints.first(); pi != 0; pi = SymbolPaints.next()) + for(pi = a_SymbolPaints.first(); pi != 0; pi = a_SymbolPaints.next()) if(pi->Name == ".ID ") { ID_Text *pid = (ID_Text*)pi; QList::const_iterator it; @@ -1882,14 +1887,14 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe (*tstream) << '\n'; // write all components with node names into netlist file - for(pc = DocComps.first(); pc != 0; pc = DocComps.next()) + for(pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) (*tstream) << pc->getNetlist(); (*tstream) << ".Def:End\n"; } else { - if (isVerilog) { + if (a_isVerilog) { // ..... digital subcircuit ................................... (*tstream) << "\nmodule Sub_" << Type << " (" << SubcircuitPortNames.join(", ") << ");\n"; @@ -1903,8 +1908,8 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe (*tstream) << " inout " << InOutPorts.join(", ") << ";\n"; // subcircuit connections - if(!Signals.isEmpty()) { - QList values = Signals.values(); + if(!a_Signals.isEmpty()) { + QList values = a_Signals.values(); QList::const_iterator it; for (it = values.constBegin(); it != values.constEnd(); ++it) { (*tstream) << " wire " << (*it).Name << ";\n"; @@ -1913,7 +1918,7 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe (*tstream) << "\n"; // subcircuit parameters - for(pi = SymbolPaints.first(); pi != 0; pi = SymbolPaints.next()) + for(pi = a_SymbolPaints.first(); pi != 0; pi = a_SymbolPaints.next()) if(pi->Name == ".ID ") { QList::const_iterator it; ID_Text *pid = (ID_Text*)pi; @@ -1927,17 +1932,17 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe } // write all equations into netlist file - for(pc = DocComps.first(); pc != 0; pc = DocComps.next()) { + for(pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) { if(pc->Model == "Eqn") { (*tstream) << pc->get_Verilog_Code(NumPorts); } } - if(Signals.find("gnd") != Signals.end()) + if(a_Signals.find("gnd") != a_Signals.end()) (*tstream) << " assign gnd = 0;\n"; // should appear only once // write all components into netlist file - for(pc = DocComps.first(); pc != 0; pc = DocComps.next()) { + for(pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) { if(pc->Model != "Eqn") { s = pc->get_Verilog_Code(NumPorts); if(s.length()>0 && s.at(0) == '\xA7') { //section symbol @@ -1955,7 +1960,7 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe << " port (" << SubcircuitPortNames.join(";\n ") << ");\n"; - for(pi = SymbolPaints.first(); pi != 0; pi = SymbolPaints.next()) + for(pi = a_SymbolPaints.first(); pi != 0; pi = a_SymbolPaints.next()) if(pi->Name == ".ID ") { ID_Text *pid = (ID_Text*)pi; QList::const_iterator it; @@ -1977,8 +1982,8 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe << "architecture Arch_Sub_" << Type << " of Sub_" << Type << " is\n"; - if(!Signals.isEmpty()) { - QList values = Signals.values(); + if(!a_Signals.isEmpty()) { + QList values = a_Signals.values(); QList::const_iterator it; for (it = values.constBegin(); it != values.constEnd(); ++it) { (*tstream) << " signal " << (*it).Name << " : " @@ -1988,7 +1993,7 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe } // write all equations into netlist file - for(pc = DocComps.first(); pc != 0; pc = DocComps.next()) { + for(pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) { if(pc->Model == "Eqn") { ErrText->insertPlainText( QObject::tr("WARNING: Equations in \"%1\" are 'time' typed."). @@ -1999,11 +2004,11 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe (*tstream) << "begin\n"; - if(Signals.find("gnd") != Signals.end()) + if(a_Signals.find("gnd") != a_Signals.end()) (*tstream) << " gnd <= '0';\n"; // should appear only once // write all components into netlist file - for(pc = DocComps.first(); pc != 0; pc = DocComps.next()) { + for(pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) { if(pc->Model != "Eqn") { s = pc->get_VHDL_Code(NumPorts); if(s.length()>0 && s.at(0) == '\xA7') { //section symbol @@ -2021,7 +2026,7 @@ void Schematic::createSubNetlistPlain(QTextStream *stream, QPlainTextEdit *ErrTe // close file - if(creatingLib) { + if(a_creatingLib) { ofile.close(); delete tstream; } @@ -2055,7 +2060,7 @@ bool Schematic::createSubNetlist(QTextStream *stream, int& countInit, if (!kern->checkSchematic(err_lst)) { QString s = QStringLiteral("Subcircuit %1 contains SPICE-incompatible components.\n" "Check these components: %2 \n") - .arg(this->DocName).arg(err_lst.join("; ")); + .arg(this->a_DocName).arg(err_lst.join("; ")); ErrText->insertPlainText(s); return false; } @@ -2065,7 +2070,7 @@ bool Schematic::createSubNetlist(QTextStream *stream, int& countInit, } - Signals.clear(); // was filled in "giveNodeNames()" + a_Signals.clear(); // was filled in "giveNodeNames()" return true; } @@ -2073,7 +2078,7 @@ bool Schematic::createSubNetlist(QTextStream *stream, int& countInit, // Detect simulation domain (analog/digital) by looking at component types. bool Schematic::isDigitalCircuit() { - for(Component *pc = DocComps.first(); pc != 0; pc = DocComps.next()) { + for(Component *pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) { if(pc->isActive == COMP_IS_OPEN) continue; if(pc->Model.at(0) == '.' && pc->Model == ".Digi") { return true; // Verilog simulation detected @@ -2087,15 +2092,15 @@ bool Schematic::isDigitalCircuit() int Schematic::prepareNetlist(QTextStream& stream, QStringList& Collect, QPlainTextEdit *ErrText) { - if(showBias > 0) showBias = -1; // do not show DC bias anymore + if(a_showBias > 0) a_showBias = -1; // do not show DC bias anymore - isVerilog = false; - isAnalog = true; + a_isVerilog = false; + a_isAnalog = true; bool isTruthTable = false; int allTypes = 0, NumPorts = 0; // Detect simulation domain (analog/digital) by looking at component types. - for(Component *pc = DocComps.first(); pc != 0; pc = DocComps.next()) { + for(Component *pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) { if(pc->isActive == COMP_IS_OPEN) continue; if(pc->Model.at(0) == '.') { if(pc->Model == ".Digi") { @@ -2106,10 +2111,10 @@ int Schematic::prepareNetlist(QTextStream& stream, QStringList& Collect, } if(pc->Props.front()->Value != "TimeList") isTruthTable = true; - if(pc->Props.back()->Value != "VHDL") - isVerilog = true; + if(pc->Props.back()->Value != "VHDL") + a_isVerilog = true; allTypes |= isDigitalComponent; - isAnalog = false; + a_isAnalog = false; } else allTypes |= isAnalogComponent; if((allTypes & isComponent) == isComponent) { @@ -2126,7 +2131,7 @@ int Schematic::prepareNetlist(QTextStream& stream, QStringList& Collect, // If no simulation exists, assume analog simulation. There may // be a simulation within a SPICE file. Otherwise Qucsator will // output an error. - isAnalog = true; + a_isAnalog = true; allTypes |= isAnalogComponent; NumPorts = -1; } @@ -2141,7 +2146,7 @@ int Schematic::prepareNetlist(QTextStream& stream, QStringList& Collect, } else { NumPorts = -1; - isAnalog = true; + a_isAnalog = true; } // first line is documentation @@ -2152,17 +2157,17 @@ int Schematic::prepareNetlist(QTextStream& stream, QStringList& Collect, } else { stream << '#'; } - } else if (isVerilog) { + } else if (a_isVerilog) { stream << "//"; } else { stream << "--"; } if (has_header) { - stream << " Qucs " << PACKAGE_VERSION << " " << DocName << "\n"; + stream << " Qucs " << PACKAGE_VERSION << " " << a_DocName << "\n"; } // set timescale property for verilog schematics - if (isVerilog) { + if (a_isVerilog) { stream << "\n`timescale 1ps/100fs\n"; } @@ -2177,11 +2182,11 @@ int Schematic::prepareNetlist(QTextStream& stream, QStringList& Collect, return NumPorts; } - if (!isVerilog) { + if (!a_isVerilog) { stream << VHDL_LIBRARIES; stream << "entity TestBench is\n" - << "end entity;\n" - << "use work.all;\n"; + << "end entity;\n" + << "use work.all;\n"; } return NumPorts; } @@ -2190,9 +2195,9 @@ int Schematic::prepareNetlist(QTextStream& stream, QStringList& Collect, // Write the beginning of digital netlist to the text stream 'stream'. void Schematic::beginNetlistDigital(QTextStream& stream) { - if (isVerilog) { + if (a_isVerilog) { stream << "module TestBench ();\n"; - QList values = Signals.values(); + QList values = a_Signals.values(); QList::const_iterator it; for (it = values.constBegin(); it != values.constEnd(); ++it) { stream << " wire " << (*it).Name << ";\n"; @@ -2200,18 +2205,18 @@ void Schematic::beginNetlistDigital(QTextStream& stream) stream << "\n"; } else { stream << "architecture Arch_TestBench of TestBench is\n"; - QList values = Signals.values(); + QList values = a_Signals.values(); QList::const_iterator it; for (it = values.constBegin(); it != values.constEnd(); ++it) { stream << " signal " << (*it).Name << " : " - << ((*it).Type.isEmpty() ? - VHDL_SIGNAL_TYPE : (*it).Type) << ";\n"; + << ((*it).Type.isEmpty() ? + VHDL_SIGNAL_TYPE : (*it).Type) << ";\n"; } stream << "begin\n"; } - if(Signals.find("gnd") != Signals.end()) { - if (isVerilog) { + if(a_Signals.find("gnd") != a_Signals.end()) { + if (a_isVerilog) { stream << " assign gnd = 0;\n"; } else { stream << " gnd <= '0';\n"; // should appear only once @@ -2223,7 +2228,7 @@ void Schematic::beginNetlistDigital(QTextStream& stream) // Write the end of digital netlist to the text stream 'stream'. void Schematic::endNetlistDigital(QTextStream& stream) { - if (isVerilog) { + if (a_isVerilog) { } else { stream << "end architecture;\n"; } @@ -2233,38 +2238,38 @@ void Schematic::endNetlistDigital(QTextStream& stream) // write all components with node names into the netlist file QString Schematic::createNetlist(QTextStream& stream, int NumPorts) { - if(!isAnalog) { + if(!a_isAnalog) { beginNetlistDigital(stream); } - Signals.clear(); // was filled in "giveNodeNames()" + a_Signals.clear(); // was filled in "giveNodeNames()" FileList.clear(); QString s, Time; - for(Component *pc = DocComps.first(); pc != 0; pc = DocComps.next()) { - if(isAnalog) { + for(Component *pc = a_DocComps.first(); pc != 0; pc = a_DocComps.next()) { + if(a_isAnalog) { s = pc->getNetlist(); } else { if(pc->Model == ".Digi" && pc->isActive) { // simulation component ? if(NumPorts > 0) { // truth table simulation ? - if (isVerilog) - Time = QString::number((1 << NumPorts)); - else - Time = QString::number((1 << NumPorts) - 1) + " ns"; + if (a_isVerilog) + Time = QString::number((1 << NumPorts)); + else + Time = QString::number((1 << NumPorts) - 1) + " ns"; } else { Time = pc->Props.at(1)->Value; - if (isVerilog) { - if(!misc::Verilog_Time(Time, pc->Name)) return Time; - } else { - if(!misc::VHDL_Time(Time, pc->Name)) return Time; // wrong time format - } + if (a_isVerilog) { + if(!misc::Verilog_Time(Time, pc->Name)) return Time; + } else { + if(!misc::VHDL_Time(Time, pc->Name)) return Time; // wrong time format + } } } - if (isVerilog) { - s = pc->get_Verilog_Code(NumPorts); + if (a_isVerilog) { + s = pc->get_Verilog_Code(NumPorts); } else { - s = pc->get_VHDL_Code(NumPorts); + s = pc->get_VHDL_Code(NumPorts); } if (s.length()>0 && s.at(0) == '\xA7'){ return s; // return error @@ -2273,7 +2278,7 @@ QString Schematic::createNetlist(QTextStream& stream, int NumPorts) stream << s; } - if(!isAnalog) { + if(!a_isAnalog) { endNetlistDigital(stream); } @@ -2283,12 +2288,12 @@ QString Schematic::createNetlist(QTextStream& stream, int NumPorts) void Schematic::clearSignalsAndFileList() { - Signals.clear(); // was filled in "giveNodeNames()" + a_Signals.clear(); // was filled in "giveNodeNames()" FileList.clear(); } void Schematic::clearSignals() { - Signals.clear(); + a_Signals.clear(); } // vim:ts=8:sw=2:noet diff --git a/qucs/schematic_render.cpp b/qucs/schematic_render.cpp index 32b5f4aa..194df490 100644 --- a/qucs/schematic_render.cpp +++ b/qucs/schematic_render.cpp @@ -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: - // * = + // * = // // 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(std::round(newModel.width() * Scale)), - static_cast(std::round(newModel.height() * Scale))); + a_Scale = newScale; + resizeContents(static_cast(std::round(newModel.width() * a_Scale)), + static_cast(std::round(newModel.height() * a_Scale))); auto contentTopLeft = modelToContents(vpTopLeftOnModelPlane); setContentsPos(contentTopLeft.x(), contentTopLeft.y()); viewport()->update(); - return Scale; -} \ No newline at end of file + return a_Scale; +} diff --git a/qucs/textdoc.cpp b/qucs/textdoc.cpp index 554f2097..c20ed2fe 100644 --- a/qucs/textdoc.cpp +++ b/qucs/textdoc.cpp @@ -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 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()); }