* ./hurricane/src/viewer:

- Change: The tab settings of the controller now refers to the XML
        configuration widget.
This commit is contained in:
Jean-Paul Chaput 2010-06-18 14:01:08 +00:00
parent 8d46e014ab
commit 72418edb16
7 changed files with 112 additions and 20 deletions

View File

@ -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)

View File

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

View File

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

View File

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

View File

@ -100,8 +100,6 @@ namespace Hurricane {
}
void CellViewer::createActions ()
{
if ( _openAction ) return;

View File

@ -29,6 +29,8 @@
#include <QVBoxLayout>
#include <QCheckBox>
#include <QComboBox>
#include <vlsisapd/configuration/Configuration.h>
#include <vlsisapd/configuration/ConfigurationWidget.h>
#include <hurricane/DataBase.h>
#include <hurricane/Cell.h>
#include <hurricane/viewer/Graphics.h>
@ -44,6 +46,8 @@
namespace Hurricane {
using Cfg::Configuration;
// -------------------------------------------------------------------
// Class : "Hurricane::ControllerTab".
@ -437,15 +441,15 @@ namespace Hurricane {
TabSettings::TabSettings ( QWidget* parent )
: ControllerTab (parent)
, _settings(new QTabWidget())
, _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".

View File

@ -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 );
inline ConfigurationWidget* getSettings ();
public slots:
void setCellWidget ( CellWidget* );
private:
ConfigurationWidget* _configuration;
protected:
QTabWidget* _settings;
};
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.