diff --git a/chamsin/src/tests/AnalogicViewer.cpp b/chamsin/src/tests/AnalogicViewer.cpp index baa24c18..27398a8e 100644 --- a/chamsin/src/tests/AnalogicViewer.cpp +++ b/chamsin/src/tests/AnalogicViewer.cpp @@ -10,6 +10,7 @@ #include "AnalogicViewer.h" + AnalogicViewer::AnalogicViewer(Library* library) { ATechnology* aTechnology = AEnv::getATechnology(); @@ -23,11 +24,10 @@ AnalogicViewer::AnalogicViewer(Library* library) { DbU::Unit transistorMaxW = aTechnology->getPhysicalRule("transistorMaxW")->getValue(); _transistor = Transistor::create(library, Name("TEST")); + _transistor->setType(Transistor::Type::NMOS); _transistor->setL(transistorMinL); _transistor->setW(transistorMinW); - _transistor->setType(Transistor::Type::NMOS); - - _transistor->updateLayout(); + //_transistor->createLayout(); _cellWidget = new CellWidget; _cellWidget->setCell(_transistor); _cellWidget->fitToContents(); @@ -40,11 +40,16 @@ AnalogicViewer::AnalogicViewer(Library* library) { lSlider->setRange(transistorMinL, 4 * transistorMinL); lSlider->setPageStep(DbU::grid(1)); lSlider->setSliderPosition(transistorMinL); + QStringList choices; + choices << "NMOS" << "PMOS"; + QComboBox* choiceBox = new QComboBox; + choiceBox->addItems(choices); QWidget* slidersWidget = new QWidget; QGridLayout* layout = new QGridLayout; layout->addWidget(wSlider, 0, 0); layout->addWidget(lSlider, 1, 0); + layout->addWidget(choiceBox, 2, 0); slidersWidget->setLayout(layout); QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this); @@ -55,6 +60,7 @@ AnalogicViewer::AnalogicViewer(Library* library) { connect(wSlider, SIGNAL(valueChanged(int)), this, SLOT(wvalueChanged(int))); connect(lSlider, SIGNAL(valueChanged(int)), this, SLOT(lvalueChanged(int))); + connect(choiceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(transistorTypeChanged(int))); } void AnalogicViewer::wvalueChanged(int value) { @@ -66,3 +72,13 @@ void AnalogicViewer::lvalueChanged(int value) { _transistor->setL(value); _cellWidget->redraw(); } + +void AnalogicViewer::transistorTypeChanged(int value) { + if (value == 0) { + _transistor->setType(Transistor::Type::NMOS); + _cellWidget->redraw(); + } else if (value == 1) { + _transistor->setType(Transistor::Type::PMOS); + _cellWidget->redraw(); + } +} diff --git a/chamsin/src/tests/AnalogicViewer.h b/chamsin/src/tests/AnalogicViewer.h index 3bf9975a..abb8cd81 100644 --- a/chamsin/src/tests/AnalogicViewer.h +++ b/chamsin/src/tests/AnalogicViewer.h @@ -18,6 +18,7 @@ class AnalogicViewer : public QMainWindow { private slots: void lvalueChanged(int value); void wvalueChanged(int value); + void transistorTypeChanged(int value); private: AnalogicViewer();