CapacitorViewer and TransistorViewer

This commit is contained in:
Christophe Alexandre 2008-07-22 14:54:42 +00:00
parent b8d6b2fb9f
commit 0e0b42f619
6 changed files with 107 additions and 20 deletions

View File

@ -1,13 +1,16 @@
include(${QT_USE_FILE}) include(${QT_USE_FILE})
qt4_wrap_cpp(MOC_SRCS AnalogicViewer.h) qt4_wrap_cpp(MOC_TRANSISTOR TransistorViewer.h)
qt4_wrap_cpp(MOC_CAPACITOR CapacitorViewer.h)
include_directories(${HURRICANE_INCLUDE_DIR} ${HURRICANE_GRAPHICAL_INCLUDE_DIR} include_directories(${HURRICANE_INCLUDE_DIR} ${HURRICANE_GRAPHICAL_INCLUDE_DIR}
${CORIOLIS_INCLUDE_DIR} ${CHAMSIN_SOURCE_DIR}/src/technology ${CORIOLIS_INCLUDE_DIR} ${CHAMSIN_SOURCE_DIR}/src/technology
${CHAMSIN_SOURCE_DIR}/src/analogic ${CHAMSIN_SOURCE_DIR}/src/device) ${CHAMSIN_SOURCE_DIR}/src/analogic ${CHAMSIN_SOURCE_DIR}/src/device)
add_executable(atest AnalogicViewer.cpp ${MOC_SRCS} AnalogicTest.cpp) add_executable(transview TransistorViewer.cpp ${MOC_TRANSISTOR} TransistorTest.cpp)
add_executable(capview CapacitorViewer.cpp ${MOC_CAPACITOR} CapacitorTest.cpp)
target_link_libraries(atest atechnology analogic ${HURRICANE_LIBRARIES} ${HURRICANE_GRAPHICAL_LIBRARIES} ${QT_LIBRARIES}) target_link_libraries(transview atechnology analogic ${HURRICANE_LIBRARIES} ${HURRICANE_GRAPHICAL_LIBRARIES} ${QT_LIBRARIES})
target_link_libraries(capview atechnology analogic ${HURRICANE_LIBRARIES} ${HURRICANE_GRAPHICAL_LIBRARIES} ${QT_LIBRARIES})
install(TARGETS atest DESTINATION /bin) install(TARGETS transview capview DESTINATION /bin)

View File

@ -13,7 +13,7 @@ using namespace Hurricane;
#include "AEnv.h" #include "AEnv.h"
#include "ATechnology.h" #include "ATechnology.h"
#include "Transistor.h" #include "Transistor.h"
#include "AnalogicViewer.h" #include "CapacitorViewer.h"
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@ -22,9 +22,8 @@ int main(int argc, char* argv[]) {
QApplication* qa = new QApplication(argc, argv); QApplication* qa = new QApplication(argc, argv);
cout << "simple analogic test" << endl;
if (argc != 5) { if (argc != 5) {
cerr << "atest symbtechno.xml s2rtechno.xml graphic.xml anatechno.xml"; cerr << "capview symbtechno.xml s2rtechno.xml graphic.xml anatechno.xml";
exit(56); exit(56);
} }
AEnv::create(argv[1], argv[2], argv[3], argv[4]); AEnv::create(argv[1], argv[2], argv[3], argv[4]);
@ -37,7 +36,7 @@ int main(int argc, char* argv[]) {
exit(56); exit(56);
} }
AnalogicViewer* viewer = new AnalogicViewer(userLibrary); CapacitorViewer* viewer = new CapacitorViewer(userLibrary);
viewer->show(); viewer->show();

View File

@ -0,0 +1,29 @@
#ifndef _CAPACITORVIEWER_H
#define _CAPACITORVIEWER_H
#include <QMainWindow>
namespace Hurricane {
class Library;
class CellWidget;
}
using namespace Hurricane;
class Capacitor;
class CapacitorViewer : public QMainWindow {
Q_OBJECT
public:
CapacitorViewer(Library* library);
private slots:
void lvalueChanged(int value);
void wvalueChanged(int value);
private:
CapacitorViewer();
CellWidget* _cellWidget;
Capacitor* _capacitor;
};
#endif /* _CAPACITORVIEWER_H */

View File

@ -0,0 +1,57 @@
#include <iostream>
#include <QApplication>
#include "hurricane/Warning.h"
#include "hurricane/Error.h"
#include "hurricane/DataBase.h"
#include "hurricane/Library.h"
#include "hurricane/viewer/CellViewer.h"
using namespace Hurricane;
#include "AEnv.h"
#include "ATechnology.h"
#include "Transistor.h"
#include "TransistorViewer.h"
int main(int argc, char* argv[]) {
int returnCode;
try {
QApplication* qa = new QApplication(argc, argv);
if (argc != 5) {
cerr << "transview symbtechno.xml s2rtechno.xml graphic.xml anatechno.xml";
exit(56);
}
AEnv::create(argv[1], argv[2], argv[3], argv[4]);
DataBase* db = DataBase::getDB();
Library* rootLibrary = db->getRootLibrary();
Library* userLibrary = Library::create(rootLibrary, Name("USER"));
ATechnology* aTechnology = AEnv::getATechnology();
if (!aTechnology) {
exit(56);
}
TransistorViewer* viewer = new TransistorViewer(userLibrary);
viewer->show();
returnCode = qa->exec();
delete viewer;
delete qa;
} catch (Hurricane::Warning& w) {
cerr << w.what() << endl;
} catch (Hurricane::Error& e) {
cerr << e.what() << endl;
exit (1);
} catch (...) {
cout << "Abnormal termination\n" << endl;
exit(2);
}
return returnCode;
}

View File

@ -8,10 +8,10 @@
#include "AEnv.h" #include "AEnv.h"
#include "ATechnology.h" #include "ATechnology.h"
#include "AnalogicViewer.h" #include "TransistorViewer.h"
AnalogicViewer::AnalogicViewer(Library* library) { TransistorViewer::TransistorViewer(Library* library) {
ATechnology* aTechnology = AEnv::getATechnology(); ATechnology* aTechnology = AEnv::getATechnology();
if (!aTechnology) { if (!aTechnology) {
@ -27,7 +27,6 @@ AnalogicViewer::AnalogicViewer(Library* library) {
_transistor->setType(Transistor::Type::NMOS); _transistor->setType(Transistor::Type::NMOS);
_transistor->setL(transistorMinL); _transistor->setL(transistorMinL);
_transistor->setW(transistorMinW); _transistor->setW(transistorMinW);
//_transistor->createLayout();
_cellWidget = new CellWidget; _cellWidget = new CellWidget;
_cellWidget->setCell(_transistor); _cellWidget->setCell(_transistor);
_cellWidget->fitToContents(); _cellWidget->fitToContents();
@ -63,17 +62,17 @@ AnalogicViewer::AnalogicViewer(Library* library) {
connect(choiceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(transistorTypeChanged(int))); connect(choiceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(transistorTypeChanged(int)));
} }
void AnalogicViewer::wvalueChanged(int value) { void TransistorViewer::wvalueChanged(int value) {
_transistor->setW(value); _transistor->setW(value);
_cellWidget->redraw(); _cellWidget->redraw();
} }
void AnalogicViewer::lvalueChanged(int value) { void TransistorViewer::lvalueChanged(int value) {
_transistor->setL(value); _transistor->setL(value);
_cellWidget->redraw(); _cellWidget->redraw();
} }
void AnalogicViewer::transistorTypeChanged(int value) { void TransistorViewer::transistorTypeChanged(int value) {
if (value == 0) { if (value == 0) {
_transistor->setType(Transistor::Type::NMOS); _transistor->setType(Transistor::Type::NMOS);
_cellWidget->redraw(); _cellWidget->redraw();

View File

@ -1,5 +1,5 @@
#ifndef _ANALOGICVIEWER_H #ifndef _TRANSISTORVIEWER_H
#define _ANALOGICVIEWER_H #define _TRANSISTORVIEWER_H
#include <QMainWindow> #include <QMainWindow>
@ -11,20 +11,20 @@ using namespace Hurricane;
class Transistor; class Transistor;
class AnalogicViewer : public QMainWindow { class TransistorViewer : public QMainWindow {
Q_OBJECT Q_OBJECT
public: public:
AnalogicViewer(Library* library); TransistorViewer(Library* library);
private slots: private slots:
void lvalueChanged(int value); void lvalueChanged(int value);
void wvalueChanged(int value); void wvalueChanged(int value);
void transistorTypeChanged(int value); void transistorTypeChanged(int value);
private: private:
AnalogicViewer(); TransistorViewer();
CellWidget* _cellWidget; CellWidget* _cellWidget;
Transistor* _transistor; Transistor* _transistor;
}; };
#endif /* _ANALOGICVIEWER_H */ #endif /* _TRANSISTORVIEWER_H */