Transistor Type modification in AnalogicViewer

This commit is contained in:
Christophe Alexandre 2008-07-22 14:29:23 +00:00
parent 102c9c91d3
commit b8d6b2fb9f
2 changed files with 20 additions and 3 deletions

View File

@ -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();
}
}

View File

@ -18,6 +18,7 @@ class AnalogicViewer : public QMainWindow {
private slots:
void lvalueChanged(int value);
void wvalueChanged(int value);
void transistorTypeChanged(int value);
private:
AnalogicViewer();