From 0e0b42f6194bd32dd702e0de68b3bada23378259 Mon Sep 17 00:00:00 2001 From: Christophe Alexandre Date: Tue, 22 Jul 2008 14:54:42 +0000 Subject: [PATCH] CapacitorViewer and TransistorViewer --- chamsin/src/tests/CMakeLists.txt | 11 ++-- .../{AnalogicTest.cpp => CapacitorTest.cpp} | 7 +-- chamsin/src/tests/CapacitorViewer.h | 29 ++++++++++ chamsin/src/tests/TransistorTest.cpp | 57 +++++++++++++++++++ ...nalogicViewer.cpp => TransistorViewer.cpp} | 11 ++-- .../{AnalogicViewer.h => TransistorViewer.h} | 12 ++-- 6 files changed, 107 insertions(+), 20 deletions(-) rename chamsin/src/tests/{AnalogicTest.cpp => CapacitorTest.cpp} (84%) create mode 100644 chamsin/src/tests/CapacitorViewer.h create mode 100644 chamsin/src/tests/TransistorTest.cpp rename chamsin/src/tests/{AnalogicViewer.cpp => TransistorViewer.cpp} (90%) rename chamsin/src/tests/{AnalogicViewer.h => TransistorViewer.h} (65%) diff --git a/chamsin/src/tests/CMakeLists.txt b/chamsin/src/tests/CMakeLists.txt index 81e24db9..728cdfd2 100644 --- a/chamsin/src/tests/CMakeLists.txt +++ b/chamsin/src/tests/CMakeLists.txt @@ -1,13 +1,16 @@ 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} ${CORIOLIS_INCLUDE_DIR} ${CHAMSIN_SOURCE_DIR}/src/technology ${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) diff --git a/chamsin/src/tests/AnalogicTest.cpp b/chamsin/src/tests/CapacitorTest.cpp similarity index 84% rename from chamsin/src/tests/AnalogicTest.cpp rename to chamsin/src/tests/CapacitorTest.cpp index c6903941..411cc974 100644 --- a/chamsin/src/tests/AnalogicTest.cpp +++ b/chamsin/src/tests/CapacitorTest.cpp @@ -13,7 +13,7 @@ using namespace Hurricane; #include "AEnv.h" #include "ATechnology.h" #include "Transistor.h" -#include "AnalogicViewer.h" +#include "CapacitorViewer.h" int main(int argc, char* argv[]) { @@ -22,9 +22,8 @@ int main(int argc, char* argv[]) { QApplication* qa = new QApplication(argc, argv); - cout << "simple analogic test" << endl; 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); } AEnv::create(argv[1], argv[2], argv[3], argv[4]); @@ -37,7 +36,7 @@ int main(int argc, char* argv[]) { exit(56); } - AnalogicViewer* viewer = new AnalogicViewer(userLibrary); + CapacitorViewer* viewer = new CapacitorViewer(userLibrary); viewer->show(); diff --git a/chamsin/src/tests/CapacitorViewer.h b/chamsin/src/tests/CapacitorViewer.h new file mode 100644 index 00000000..7320a588 --- /dev/null +++ b/chamsin/src/tests/CapacitorViewer.h @@ -0,0 +1,29 @@ +#ifndef _CAPACITORVIEWER_H +#define _CAPACITORVIEWER_H + +#include + +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 */ diff --git a/chamsin/src/tests/TransistorTest.cpp b/chamsin/src/tests/TransistorTest.cpp new file mode 100644 index 00000000..fa60672a --- /dev/null +++ b/chamsin/src/tests/TransistorTest.cpp @@ -0,0 +1,57 @@ +#include + +#include + +#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; +} diff --git a/chamsin/src/tests/AnalogicViewer.cpp b/chamsin/src/tests/TransistorViewer.cpp similarity index 90% rename from chamsin/src/tests/AnalogicViewer.cpp rename to chamsin/src/tests/TransistorViewer.cpp index 27398a8e..48f1625a 100644 --- a/chamsin/src/tests/AnalogicViewer.cpp +++ b/chamsin/src/tests/TransistorViewer.cpp @@ -8,10 +8,10 @@ #include "AEnv.h" #include "ATechnology.h" -#include "AnalogicViewer.h" +#include "TransistorViewer.h" -AnalogicViewer::AnalogicViewer(Library* library) { +TransistorViewer::TransistorViewer(Library* library) { ATechnology* aTechnology = AEnv::getATechnology(); if (!aTechnology) { @@ -27,7 +27,6 @@ AnalogicViewer::AnalogicViewer(Library* library) { _transistor->setType(Transistor::Type::NMOS); _transistor->setL(transistorMinL); _transistor->setW(transistorMinW); - //_transistor->createLayout(); _cellWidget = new CellWidget; _cellWidget->setCell(_transistor); _cellWidget->fitToContents(); @@ -63,17 +62,17 @@ AnalogicViewer::AnalogicViewer(Library* library) { connect(choiceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(transistorTypeChanged(int))); } -void AnalogicViewer::wvalueChanged(int value) { +void TransistorViewer::wvalueChanged(int value) { _transistor->setW(value); _cellWidget->redraw(); } -void AnalogicViewer::lvalueChanged(int value) { +void TransistorViewer::lvalueChanged(int value) { _transistor->setL(value); _cellWidget->redraw(); } -void AnalogicViewer::transistorTypeChanged(int value) { +void TransistorViewer::transistorTypeChanged(int value) { if (value == 0) { _transistor->setType(Transistor::Type::NMOS); _cellWidget->redraw(); diff --git a/chamsin/src/tests/AnalogicViewer.h b/chamsin/src/tests/TransistorViewer.h similarity index 65% rename from chamsin/src/tests/AnalogicViewer.h rename to chamsin/src/tests/TransistorViewer.h index abb8cd81..4076d49a 100644 --- a/chamsin/src/tests/AnalogicViewer.h +++ b/chamsin/src/tests/TransistorViewer.h @@ -1,5 +1,5 @@ -#ifndef _ANALOGICVIEWER_H -#define _ANALOGICVIEWER_H +#ifndef _TRANSISTORVIEWER_H +#define _TRANSISTORVIEWER_H #include @@ -11,20 +11,20 @@ using namespace Hurricane; class Transistor; -class AnalogicViewer : public QMainWindow { +class TransistorViewer : public QMainWindow { Q_OBJECT public: - AnalogicViewer(Library* library); + TransistorViewer(Library* library); private slots: void lvalueChanged(int value); void wvalueChanged(int value); void transistorTypeChanged(int value); private: - AnalogicViewer(); + TransistorViewer(); CellWidget* _cellWidget; Transistor* _transistor; }; -#endif /* _ANALOGICVIEWER_H */ +#endif /* _TRANSISTORVIEWER_H */