diff --git a/hurricane/CMakeLists.txt b/hurricane/CMakeLists.txt index 116a590d..95f52215 100644 --- a/hurricane/CMakeLists.txt +++ b/hurricane/CMakeLists.txt @@ -41,6 +41,7 @@ FIND_PACKAGE(BISON REQUIRED) FIND_PACKAGE(FLEX REQUIRED) FIND_PACKAGE(PythonLibs REQUIRED) FIND_PACKAGE(PythonSitePackages REQUIRED) +FIND_PACKAGE(VLSISAPD REQUIRED) IF(BUILD_DOC) FIND_PACKAGE(Doxygen) ENDIF(BUILD_DOC) diff --git a/hurricane/src/hurricane/DbU.cpp b/hurricane/src/hurricane/DbU.cpp index de300d8d..87ea004c 100644 --- a/hurricane/src/hurricane/DbU.cpp +++ b/hurricane/src/hurricane/DbU.cpp @@ -299,6 +299,52 @@ namespace Hurricane { } + string DbU::getValueString ( double u, int mode ) + { + char buffer[1024]; + char unitPower = 'u'; + char unitSymbol = '\0'; + + if ( _stringMode == Grid ) { + unitPower = 'g'; + snprintf ( buffer, 1024, "%.1f", getGrid(u) ); + } else if ( _stringMode == Symbolic ) { + unitPower = 'l'; + snprintf ( buffer, 1024, "%.1f", getLambda(u) ); + } else if ( _stringMode == Physical ) { + unitSymbol = 'm'; + switch ( _stringModeUnitPower ) { + case Pico: unitPower = 'p'; break; + case Nano: unitPower = 'n'; break; + case Micro: unitPower = 'u'; break; + case Milli: unitPower = 'm'; break; + case Unity: unitPower = 'U'; break; + case Kilo: unitPower = 'k'; break; + default: unitPower = '?'; break; + } + snprintf ( buffer, 1024, "%.3f", getPhysical(u,_stringModeUnitPower) ); + } else { + if ( _stringMode != Db ) + cerr << "[ERROR] Unknown Unit representation mode: " << _stringMode << endl; + + snprintf ( buffer, 1024, "%f", u ); + } + + size_t length = strlen(buffer) - 1; + if ( mode & SmartTruncate ) { + for ( ; length > 0 ; length-- ) { + if ( buffer[length] == '.' ) { length--; break; } + if ( buffer[length] != '0' ) break; + } + } + buffer[++length] = unitPower; + if ( unitSymbol ) buffer[++length] = unitSymbol; + buffer[++length] = '\0'; + + return buffer; + } + + Record* DbU::getValueRecord ( const DbU::Unit* u ) { Record* record = new Record(getValueString(*u)); diff --git a/hurricane/src/hurricane/hurricane/DbU.h b/hurricane/src/hurricane/hurricane/DbU.h index b5a1e2c1..812b03f3 100644 --- a/hurricane/src/hurricane/hurricane/DbU.h +++ b/hurricane/src/hurricane/hurricane/DbU.h @@ -103,9 +103,13 @@ namespace Hurricane { // Conversions. static inline long getDb ( Unit u ); static inline double getGrid ( Unit u ); + static inline double getGrid ( double u ); static inline double getLambda ( Unit u ); + static inline double getLambda ( double u ); static inline double getPhysical ( Unit u, UnitPower p ); + static inline double getPhysical ( double u, UnitPower p ); static string getValueString ( Unit u, int mode=SmartTruncate ); + static string getValueString ( double u, int mode=SmartTruncate ); static Record* getValueRecord ( const Unit* u ); static Slot* getValueSlot ( const string& name, const Unit* u ); static void setStringMode ( unsigned int mode, UnitPower p=Nano ); @@ -134,8 +138,11 @@ namespace Hurricane { inline DbU::Unit DbU::lambda ( double value ) { return grid(value*_gridsPerLambda); } inline long DbU::getDb ( DbU::Unit u ) { return u; } inline double DbU::getGrid ( DbU::Unit u ) { return _resolution*(double)u; } + inline double DbU::getGrid ( double u ) { return _resolution*u; } inline double DbU::getLambda ( DbU::Unit u ) { return getGrid(u)/_gridsPerLambda; } + inline double DbU::getLambda ( double u ) { return getGrid(u)/_gridsPerLambda; } inline double DbU::getPhysical ( DbU::Unit u, UnitPower p ) { return (_physicalsPerGrid*_resolution*(double)u)/getUnitPower(p); } + inline double DbU::getPhysical ( double u, UnitPower p ) { return (_physicalsPerGrid*_resolution*u)/getUnitPower(p); } inline void DbU::setRealSnapGridStep ( DbU::Unit step ) { _realSnapGridStep = step; } inline void DbU::setSymbolicSnapGridStep ( DbU::Unit step ) { _symbolicSnapGridStep = step; } inline DbU::Unit DbU::getOnPhysicalGrid ( DbU::Unit u, SnapMode mode ) { return getOnCustomGrid(u, grid(1), mode); } diff --git a/hurricane/src/viewer/CMakeLists.txt b/hurricane/src/viewer/CMakeLists.txt index 98445b33..48a08b5b 100644 --- a/hurricane/src/viewer/CMakeLists.txt +++ b/hurricane/src/viewer/CMakeLists.txt @@ -3,7 +3,9 @@ include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane ${HURRICANE_SOURCE_DIR}/src/viewer - ${Boost_INCLUDE_DIRS} ) + ${CONFIGURATION_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} + ) set ( mocincludes hurricane/viewer/HApplication.h hurricane/viewer/PaletteItem.h @@ -113,7 +115,8 @@ add_library ( viewer ${cpps} ${MOC_SRCS} ${RCC_SRCS} ) target_link_libraries ( viewer hurricane + ${CONFIGURATION_LIBRARIES} ${QT_LIBRARIES} -# ${Boost_LIBRARIES} + ${Boost_LIBRARIES} ) install ( TARGETS viewer DESTINATION lib${LIB_SUFFIX} ) diff --git a/hurricane/src/viewer/CellViewer.cpp b/hurricane/src/viewer/CellViewer.cpp index 33c3699f..053f2304 100644 --- a/hurricane/src/viewer/CellViewer.cpp +++ b/hurricane/src/viewer/CellViewer.cpp @@ -100,8 +100,6 @@ namespace Hurricane { } - - void CellViewer::createActions () { if ( _openAction ) return; diff --git a/hurricane/src/viewer/ControllerWidget.cpp b/hurricane/src/viewer/ControllerWidget.cpp index 4f0547f0..21c648c2 100644 --- a/hurricane/src/viewer/ControllerWidget.cpp +++ b/hurricane/src/viewer/ControllerWidget.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include #include @@ -44,6 +46,8 @@ namespace Hurricane { + using Cfg::Configuration; + // ------------------------------------------------------------------- // Class : "Hurricane::ControllerTab". @@ -436,16 +440,16 @@ namespace Hurricane { TabSettings::TabSettings ( QWidget* parent ) - : ControllerTab(parent) - , _settings(new QTabWidget()) + : ControllerTab (parent) + , _configuration(Configuration::get()->buildWidget()) { setContentsMargins ( 5, 0, 5, 5 ); - _settings->setObjectName ( "controller.tabSettings.settings" ); + _configuration->setObjectName ( "controller.tabSettings.settings" ); QVBoxLayout* vLayout = new QVBoxLayout (); vLayout->setContentsMargins ( 0, 0, 0, 0 ); - vLayout->addWidget ( _settings ); + vLayout->addWidget ( _configuration ); setLayout ( vLayout ); } @@ -454,6 +458,21 @@ namespace Hurricane { { } + // TabSettings::TabSettings ( QWidget* parent ) + // : ControllerTab(parent) + // , _settings(new QTabWidget()) + // { + // setContentsMargins ( 5, 0, 5, 5 ); + + // _settings->setObjectName ( "controller.tabSettings.settings" ); + + // QVBoxLayout* vLayout = new QVBoxLayout (); + // vLayout->setContentsMargins ( 0, 0, 0, 0 ); + // vLayout->addWidget ( _settings ); + // setLayout ( vLayout ); + // } + + // ------------------------------------------------------------------- // Class : "Hurricane::ControllerWidget". diff --git a/hurricane/src/viewer/hurricane/viewer/ControllerWidget.h b/hurricane/src/viewer/hurricane/viewer/ControllerWidget.h index 3e4aa3af..09e1a01e 100644 --- a/hurricane/src/viewer/hurricane/viewer/ControllerWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/ControllerWidget.h @@ -31,11 +31,16 @@ class QCheckBox; class QComboBox; +namespace Cfg { + class ConfigurationWidget; +} + #include "hurricane/Occurrence.h" namespace Hurricane { + using Cfg::ConfigurationWidget; class Record; class Net; @@ -233,21 +238,34 @@ namespace Hurricane { class TabSettings : public ControllerTab { Q_OBJECT; - public: - TabSettings ( QWidget* parent=NULL ); - inline QTabWidget* getSettings (); - inline int addSetting ( QWidget* page, const QString& label ); + TabSettings ( QWidget* parent=NULL ); + inline ConfigurationWidget* getSettings (); public slots: - void setCellWidget ( CellWidget* ); - - protected: - QTabWidget* _settings; + void setCellWidget ( CellWidget* ); + private: + ConfigurationWidget* _configuration; + }; - inline QTabWidget* TabSettings::getSettings () { return _settings; } - inline int TabSettings::addSetting ( QWidget* page, const QString& label ) { return _settings->addTab(page,label); } + // class TabSettings : public ControllerTab { + // Q_OBJECT; + + // public: + // TabSettings ( QWidget* parent=NULL ); + // inline QTabWidget* getSettings (); + // inline int addSetting ( QWidget* page, const QString& label ); + // public slots: + // void setCellWidget ( CellWidget* ); + + // protected: + // QTabWidget* _settings; + // }; + + + // inline QTabWidget* TabSettings::getSettings () { return _settings; } + // inline int TabSettings::addSetting ( QWidget* page, const QString& label ) { return _settings->addTab(page,label); } // ------------------------------------------------------------------- @@ -268,7 +286,7 @@ namespace Hurricane { inline InspectorWidget* getInspectorWidget (); inline TabSettings* getSettings (); void setCellWidget ( CellWidget* ); - inline int addSetting ( QWidget* page, const QString& label ); + //inline int addSetting ( QWidget* page, const QString& label ); public slots: void cellPreModificate (); void cellPostModificate (); @@ -296,7 +314,7 @@ namespace Hurricane { inline SelectionWidget* ControllerWidget::getSelection () { return _tabSelection->getSelection(); } inline InspectorWidget* ControllerWidget::getInspectorWidget () { return _tabInspector->getInspectorWidget(); } inline TabSettings* ControllerWidget::getSettings () { return _tabSettings; } - inline int ControllerWidget::addSetting ( QWidget* page, const QString& label ) { return _tabSettings->addSetting(page,label); } +//inline int ControllerWidget::addSetting ( QWidget* page, const QString& label ) { return _tabSettings->addSetting(page,label); } } // End of Hurricane namespace.