* ./hurricane/src/hviewer :
- API : in CellWidget & CellViewer constructors now only takes the parent QWidget. - Renaming coordinates translation functions for more clarity. - Adding a StatusBar showing mouse coordinates.
This commit is contained in:
parent
51a72fc639
commit
3c7d1b2e62
|
@ -1 +1,2 @@
|
|||
add_subdirectory(hurricane)
|
||||
add_subdirectory(hviewer)
|
||||
|
|
|
@ -258,7 +258,7 @@ Segments segments = netgetComponents()->getSubSet<Segment*>(IsOnLayer(metal));
|
|||
*/
|
||||
// \{
|
||||
|
||||
/*! \function bool Collection::isEmpty() const;
|
||||
/* \function bool Collection::isEmpty() const;
|
||||
* This function returns \true if the collection designates no
|
||||
* element and else \false.
|
||||
*/
|
||||
|
|
|
@ -207,7 +207,7 @@
|
|||
* getValueString(). Avalaibles modes are :
|
||||
*/
|
||||
|
||||
/*! \function string DbU::getValueString(Unit unit);
|
||||
/*! \function string DbU::getValueString(Unit unit, int mode=SmartTruncate);
|
||||
* \return A character string representing the external value of
|
||||
* \c \<unit\>. The value is converted in the length according
|
||||
* to setStringMode(): database, grid or symbolic.
|
||||
|
|
|
@ -214,34 +214,30 @@ namespace Hurricane {
|
|||
// }
|
||||
|
||||
|
||||
string DbU::getValueString ( DbU::Unit u )
|
||||
string DbU::getValueString ( DbU::Unit u, int mode )
|
||||
{
|
||||
char buffer[1024];
|
||||
char unitSymbol = 'u';
|
||||
|
||||
if ( _stringMode == Grid ) {
|
||||
if ( u == 0 ) return "0g";
|
||||
|
||||
unitSymbol = 'g';
|
||||
snprintf ( buffer, 1024, "%.1f", getGrid(u) );
|
||||
} else if ( _stringMode == Symbolic ) {
|
||||
if ( u == 0 ) return "0l";
|
||||
|
||||
unitSymbol = 'l';
|
||||
snprintf ( buffer, 1024, "%.1f", getLambda(u) );
|
||||
} else {
|
||||
if ( _stringMode != Db )
|
||||
cerr << "[ERROR] Unknown Unit representation mode: " << _stringMode << endl;
|
||||
|
||||
if ( u == 0 ) return "0u";
|
||||
|
||||
snprintf ( buffer, 1024, "%ld", u );
|
||||
}
|
||||
|
||||
size_t length = strlen(buffer) - 1;
|
||||
for ( ; length > 0 ; length-- ) {
|
||||
if ( (buffer[length] != '0') && (buffer[length] != '.') )
|
||||
break;
|
||||
if ( mode & SmartTruncate ) {
|
||||
for ( ; length > 0 ; length-- ) {
|
||||
if ( buffer[length] == '.' ) { length--; break; }
|
||||
if ( buffer[length] != '0' ) break;
|
||||
}
|
||||
}
|
||||
buffer[++length] = unitSymbol;
|
||||
buffer[++length] = '\0';
|
||||
|
|
|
@ -48,9 +48,10 @@ namespace Hurricane {
|
|||
public:
|
||||
typedef long Unit;
|
||||
public:
|
||||
enum StringMode { Db = 1
|
||||
, Grid = 2
|
||||
, Symbolic = 4
|
||||
enum StringMode { Db = 1
|
||||
, Grid = 2
|
||||
, Symbolic = 4
|
||||
, SmartTruncate = 8
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -80,7 +81,7 @@ namespace Hurricane {
|
|||
static inline long getDb ( Unit u );
|
||||
static inline double getGrid ( Unit u );
|
||||
static inline double getLambda ( Unit u );
|
||||
static string getValueString ( Unit u );
|
||||
static string getValueString ( Unit u, int mode=SmartTruncate );
|
||||
static Record* getValueRecord ( const Unit* u );
|
||||
static Slot* getValueSlot ( const string& name, const Unit* u );
|
||||
static inline void setStringMode ( unsigned int mode );
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
hurricane/viewer/GroupPaletteEntry.h
|
||||
hurricane/viewer/ViewerPaletteEntry.h
|
||||
hurricane/viewer/Palette.h
|
||||
hurricane/viewer/DynamicLabel.h
|
||||
hurricane/viewer/CellWidget.h
|
||||
hurricane/viewer/CellViewer.h
|
||||
hurricane/viewer/RecordModel.h
|
||||
|
@ -30,6 +31,7 @@
|
|||
GroupPaletteEntry.cpp
|
||||
ViewerPaletteEntry.cpp
|
||||
Palette.cpp
|
||||
DynamicLabel.cpp
|
||||
CellWidget.cpp
|
||||
CellViewer.cpp
|
||||
RecordModel.cpp
|
||||
|
|
|
@ -21,27 +21,26 @@
|
|||
namespace Hurricane {
|
||||
|
||||
|
||||
CellViewer::CellViewer ( Cell* cell ) : QMainWindow()
|
||||
, _openAction(NULL)
|
||||
, _nextCellAction(NULL)
|
||||
, _previousCellAction(NULL)
|
||||
, _nextAction(NULL)
|
||||
, _saveAction(NULL)
|
||||
, _exitAction(NULL)
|
||||
, _refreshAction(NULL)
|
||||
, _fitToContentsAction(NULL)
|
||||
, _showBoundariesAction(NULL)
|
||||
, _runInspectorOnDataBase(NULL)
|
||||
, _runInspectorOnCell(NULL)
|
||||
, _fileMenu(NULL)
|
||||
, _viewMenu(NULL)
|
||||
, _toolsMenu(NULL)
|
||||
//, _mapView(NULL)
|
||||
, _palette(NULL)
|
||||
, _cellWidget(NULL)
|
||||
CellViewer::CellViewer ( QWidget* parent ) : QMainWindow(parent)
|
||||
, _openAction(NULL)
|
||||
, _nextCellAction(NULL)
|
||||
, _previousCellAction(NULL)
|
||||
, _nextAction(NULL)
|
||||
, _saveAction(NULL)
|
||||
, _exitAction(NULL)
|
||||
, _refreshAction(NULL)
|
||||
, _fitToContentsAction(NULL)
|
||||
, _runInspectorOnDataBase(NULL)
|
||||
, _runInspectorOnCell(NULL)
|
||||
, _fileMenu(NULL)
|
||||
, _viewMenu(NULL)
|
||||
, _toolsMenu(NULL)
|
||||
//, _mapView(NULL)
|
||||
, _palette(NULL)
|
||||
, _cellWidget(NULL)
|
||||
{
|
||||
createMenus ();
|
||||
createLayout ( cell );
|
||||
createLayout ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,10 +80,6 @@ namespace Hurricane {
|
|||
_fitToContentsAction->setStatusTip ( tr("Adjust zoom to fit the whole cell's contents") );
|
||||
_fitToContentsAction->setShortcut ( Qt::Key_F );
|
||||
|
||||
_showBoundariesAction = new QAction ( tr("&Boundaries"), this );
|
||||
_showBoundariesAction->setCheckable ( true );
|
||||
_showBoundariesAction->setStatusTip ( tr("Show/hide cell & instances abutment boxes") );
|
||||
|
||||
_runInspectorOnDataBase= new QAction ( tr("Inspect &DataBase"), this );
|
||||
_runInspectorOnDataBase->setStatusTip ( tr("Run Inspector on Hurricane DataBase") );
|
||||
|
||||
|
@ -110,7 +105,6 @@ namespace Hurricane {
|
|||
_viewMenu = menuBar()->addMenu ( tr("View") );
|
||||
_viewMenu->addAction ( _refreshAction );
|
||||
_viewMenu->addAction ( _fitToContentsAction );
|
||||
//_viewMenu->addAction ( _showBoundariesAction );
|
||||
|
||||
_toolsMenu = menuBar()->addMenu ( tr("Tool") );
|
||||
_toolsMenu->addAction ( _runInspectorOnDataBase );
|
||||
|
@ -119,14 +113,16 @@ namespace Hurricane {
|
|||
|
||||
|
||||
|
||||
void CellViewer::createLayout ( Cell* cell )
|
||||
void CellViewer::createLayout ()
|
||||
{
|
||||
if ( _cellWidget ) return;
|
||||
|
||||
_cellWidget = new CellWidget ( cell );
|
||||
_cellWidget = new CellWidget ();
|
||||
_palette = _cellWidget->getPalette();
|
||||
//_mapView = _cellWidget->getMapView ();
|
||||
|
||||
setStatusBar ( _cellWidget->getStatusBar() );
|
||||
|
||||
setCorner ( Qt::TopLeftCorner , Qt::LeftDockWidgetArea );
|
||||
setCorner ( Qt::BottomLeftCorner , Qt::LeftDockWidgetArea );
|
||||
setCorner ( Qt::TopRightCorner , Qt::RightDockWidgetArea );
|
||||
|
@ -151,13 +147,16 @@ namespace Hurricane {
|
|||
connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase()));
|
||||
connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell ()));
|
||||
|
||||
//_showBoundariesAction->setChecked ( _cellWidget->showBoundaries() );
|
||||
//connect ( _showBoundariesAction, SIGNAL(toggled(bool)), _cellWidget, SLOT(setShowBoundaries(bool)) );
|
||||
|
||||
_cellWidget->redraw ();
|
||||
}
|
||||
|
||||
|
||||
void CellViewer::setCell ( Cell* cell )
|
||||
{
|
||||
_cellWidget->setCell ( cell );
|
||||
}
|
||||
|
||||
|
||||
void CellViewer::runInspector ( Record* record )
|
||||
{
|
||||
static HInspectorWidget* inspector = NULL;
|
||||
|
@ -181,7 +180,8 @@ namespace Hurricane {
|
|||
|
||||
void CellViewer::runInspectorOnCell ()
|
||||
{
|
||||
runInspector ( getRecord(_cellWidget->getCell()) );
|
||||
Cell* cell = _cellWidget->getCell();
|
||||
if ( cell ) runInspector ( getRecord(cell) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
# include <QPainter>
|
||||
# include <QStylePainter>
|
||||
# include <QBitmap>
|
||||
# include <QLabel>
|
||||
# include <QStatusBar>
|
||||
|
||||
# include "hurricane/DataBase.h"
|
||||
# include "hurricane/Technology.h"
|
||||
|
@ -22,6 +24,7 @@
|
|||
# include "hurricane/viewer/Graphics.h"
|
||||
# include "hurricane/viewer/PaletteEntry.h"
|
||||
# include "hurricane/viewer/Palette.h"
|
||||
# include "hurricane/viewer/DynamicLabel.h"
|
||||
// # include "MapView.h"
|
||||
# include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
@ -36,35 +39,50 @@ const int CellWidget::_stripWidth = 100;
|
|||
|
||||
|
||||
|
||||
CellWidget::CellWidget ( Cell* cell ) : QWidget()
|
||||
, _palette(NULL)
|
||||
, _displayArea(0,0,6*_stripWidth,6*_stripWidth)
|
||||
, _visibleArea(_stripWidth,_stripWidth,4*_stripWidth,4*_stripWidth)
|
||||
, _scale(1.0)
|
||||
, _offsetVA(_stripWidth,_stripWidth)
|
||||
, _drawingBuffer(6*_stripWidth,6*_stripWidth)
|
||||
, _painter()
|
||||
, _lastMousePosition(0,0)
|
||||
, _cell(cell)
|
||||
, _mouseGo(false)
|
||||
, _openCell(true)
|
||||
, _showBoundaries(true)
|
||||
, _redrawRectCount(0)
|
||||
CellWidget::CellWidget ( QWidget* parent ) : QWidget(parent)
|
||||
, _statusBar(NULL)
|
||||
, _palette(NULL)
|
||||
, _xPosition(NULL)
|
||||
, _yPosition(NULL)
|
||||
, _displayArea(0,0,6*_stripWidth,6*_stripWidth)
|
||||
, _visibleArea(_stripWidth,_stripWidth,4*_stripWidth,4*_stripWidth)
|
||||
, _scale(1.0)
|
||||
, _offsetVA(_stripWidth,_stripWidth)
|
||||
, _drawingBuffer(6*_stripWidth,6*_stripWidth)
|
||||
, _painter()
|
||||
, _lastMousePosition(0,0)
|
||||
, _cell(NULL)
|
||||
, _mouseGo(false)
|
||||
, _showBoundaries(true)
|
||||
, _redrawRectCount(0)
|
||||
{
|
||||
//setBackgroundRole ( QPalette::Dark );
|
||||
//setAutoFillBackground ( false );
|
||||
setAttribute ( Qt::WA_OpaquePaintEvent );
|
||||
//setAttribute ( Qt::WA_NoSystemBackground );
|
||||
//setAttribute ( Qt::WA_PaintOnScreen );
|
||||
//setAttribute ( Qt::WA_StaticContents );
|
||||
setSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||
setFocusPolicy ( Qt::StrongFocus );
|
||||
setAttribute ( Qt::WA_OpaquePaintEvent );
|
||||
//setAttribute ( Qt::WA_NoSystemBackground );
|
||||
//setAttribute ( Qt::WA_PaintOnScreen );
|
||||
//setAttribute ( Qt::WA_StaticContents );
|
||||
setSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||
setFocusPolicy ( Qt::StrongFocus );
|
||||
setMouseTracking ( true );
|
||||
|
||||
_statusBar = new QStatusBar ( this );
|
||||
|
||||
_xPosition = new DynamicLabel ();
|
||||
_xPosition->setStaticText ( "X:" );
|
||||
_xPosition->setDynamicText ( "0l" );
|
||||
|
||||
_yPosition = new DynamicLabel ();
|
||||
_yPosition->setStaticText ( "Y:" );
|
||||
_yPosition->setDynamicText ( "0l" );
|
||||
|
||||
_statusBar->addPermanentWidget ( _xPosition );
|
||||
_statusBar->addPermanentWidget ( _yPosition );
|
||||
|
||||
//_mapView = new MapView ( this );
|
||||
_palette = new Palette ( this );
|
||||
|
||||
fitToContents ();
|
||||
_openCell = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,20 +128,21 @@ void CellWidget::redraw ( QRect redrawArea )
|
|||
_painter.setClipRect ( redrawArea );
|
||||
_painter.eraseRect ( redrawArea );
|
||||
|
||||
Box redrawBox = getBox ( redrawArea );
|
||||
if ( _cell ) {
|
||||
Box redrawBox = displayToDbuBox ( redrawArea );
|
||||
|
||||
vector<PaletteEntry*>& paletteEntries = _palette->getEntries ();
|
||||
for ( size_t i=0 ; i<paletteEntries.size() ; i++ ) {
|
||||
_painter.setPen ( Graphics::getPen (paletteEntries[i]->getName()) );
|
||||
_painter.setBrush ( Graphics::getBrush(paletteEntries[i]->getName()) );
|
||||
|
||||
if ( paletteEntries[i]->isBasicLayer() && isDrawable(paletteEntries[i]) ) {
|
||||
drawCell ( _cell, paletteEntries[i]->getBasicLayer(), redrawBox, Transformation() );
|
||||
} else if ( (paletteEntries[i]->getName() == DisplayStyle::Boundaries)
|
||||
&& paletteEntries[i]->isChecked() ) {
|
||||
drawBoundaries ( _cell, redrawBox, Transformation() );
|
||||
vector<PaletteEntry*>& paletteEntries = _palette->getEntries ();
|
||||
for ( size_t i=0 ; i<paletteEntries.size() ; i++ ) {
|
||||
_painter.setPen ( Graphics::getPen (paletteEntries[i]->getName()) );
|
||||
_painter.setBrush ( Graphics::getBrush(paletteEntries[i]->getName()) );
|
||||
|
||||
if ( paletteEntries[i]->isBasicLayer() && isDrawable(paletteEntries[i]) ) {
|
||||
drawCell ( _cell, paletteEntries[i]->getBasicLayer(), redrawBox, Transformation() );
|
||||
} else if ( (paletteEntries[i]->getName() == DisplayStyle::Boundaries)
|
||||
&& paletteEntries[i]->isChecked() ) {
|
||||
drawBoundaries ( _cell, redrawBox, Transformation() );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_painter.end ();
|
||||
|
@ -253,7 +272,7 @@ void CellWidget::drawSegment ( const Segment* segment
|
|||
, const Transformation& transformation
|
||||
)
|
||||
{
|
||||
if ( 1 < getScreenLength(segment->getWidth()) ) {
|
||||
if ( 1 < dbuToDisplayLength(segment->getWidth()) ) {
|
||||
drawBox ( transformation.getBox(segment->getBoundingBox(basicLayer)) );
|
||||
} else {
|
||||
drawLine ( transformation.getPoint(segment->getSourcePosition()),
|
||||
|
@ -284,13 +303,13 @@ void CellWidget::drawPad ( const Pad* pad
|
|||
void CellWidget::drawBox ( const Box& box )
|
||||
{
|
||||
_redrawRectCount++;
|
||||
_painter.drawRect ( getScreenRect(box) );
|
||||
_painter.drawRect ( dbuToDisplayRect(box) );
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::drawLine ( const Point& p1, const Point& p2 )
|
||||
{
|
||||
_painter.drawLine ( getScreenPoint(p1), getScreenPoint(p2) );
|
||||
_painter.drawLine ( dbuToDisplayPoint(p1), dbuToDisplayPoint(p2) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -411,7 +430,7 @@ void CellWidget::reframe ( const Box& box )
|
|||
|
||||
void CellWidget::fitToContents ()
|
||||
{
|
||||
reframe ( _cell->getBoundingBox() );
|
||||
if ( _cell ) reframe ( _cell->getBoundingBox() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -596,8 +615,6 @@ void CellWidget::keyPressEvent ( QKeyEvent* event )
|
|||
|
||||
void CellWidget::mouseMoveEvent ( QMouseEvent* event )
|
||||
{
|
||||
//cerr << "CellWidget::mouseMoveEvent()" << endl;
|
||||
|
||||
if ( _mouseGo ) {
|
||||
int dx = event->x() - _lastMousePosition.x();
|
||||
dx <<= 1;
|
||||
|
@ -612,6 +629,10 @@ void CellWidget::mouseMoveEvent ( QMouseEvent* event )
|
|||
if ( dy < 0 ) goDown ( -dy );
|
||||
|
||||
_lastMousePosition = event->pos();
|
||||
} else {
|
||||
//cerr << "x:" << event->x() << " y:" << event->y() << endl;
|
||||
_xPosition->setDynamicText ( screenToDbuX(event->x()) );
|
||||
_yPosition->setDynamicText ( screenToDbuY(event->y()) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -635,35 +656,35 @@ void CellWidget::mouseReleaseEvent ( QMouseEvent* event )
|
|||
}
|
||||
|
||||
|
||||
QPoint CellWidget::getScreenPoint ( DbU::Unit x, DbU::Unit y ) const
|
||||
QPoint CellWidget::dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const
|
||||
{
|
||||
return QPoint ( getScreenX(x), getScreenY(y) );
|
||||
return QPoint ( dbuToDisplayX(x), dbuToDisplayY(y) );
|
||||
}
|
||||
|
||||
|
||||
QPoint CellWidget::getScreenPoint ( const Point& point ) const
|
||||
QPoint CellWidget::dbuToDisplayPoint ( const Point& point ) const
|
||||
{
|
||||
return getScreenPoint ( point.getX(), point.getY() );
|
||||
return dbuToDisplayPoint ( point.getX(), point.getY() );
|
||||
}
|
||||
|
||||
|
||||
QRect CellWidget::getScreenRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const
|
||||
QRect CellWidget::dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const
|
||||
{
|
||||
return QRect ( getScreenX(x1)
|
||||
, getScreenY(y2)
|
||||
, getScreenX(x2) - getScreenX(x1)
|
||||
, getScreenY(y1) - getScreenY(y2)
|
||||
return QRect ( dbuToDisplayX(x1)
|
||||
, dbuToDisplayY(y2)
|
||||
, dbuToDisplayX(x2) - dbuToDisplayX(x1)
|
||||
, dbuToDisplayY(y1) - dbuToDisplayY(y2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
QRect CellWidget::getScreenRect ( const Box& box ) const
|
||||
QRect CellWidget::dbuToDisplayRect ( const Box& box ) const
|
||||
{
|
||||
return getScreenRect ( box.getXMin()
|
||||
, box.getYMin()
|
||||
, box.getXMax()
|
||||
, box.getYMax()
|
||||
);
|
||||
return dbuToDisplayRect ( box.getXMin()
|
||||
, box.getYMin()
|
||||
, box.getXMax()
|
||||
, box.getYMax()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -676,4 +697,11 @@ void CellWidget::setShowBoundaries ( bool state )
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::setCell ( Cell* cell )
|
||||
{
|
||||
_cell = cell;
|
||||
fitToContents ();
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
|
||||
|
||||
# include <QFontMetrics>
|
||||
# include <QFont>
|
||||
# include <QLabel>
|
||||
# include <QHBoxLayout>
|
||||
|
||||
# include "hurricane/viewer/Graphics.h"
|
||||
# include "hurricane/viewer/DynamicLabel.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
DynamicLabel::DynamicLabel ( QWidget* parent )
|
||||
: QWidget(parent)
|
||||
, _staticLabel(NULL)
|
||||
, _dynamicLabel(NULL)
|
||||
{
|
||||
_staticLabel = new QLabel ();
|
||||
_staticLabel->setText ( " V: " );
|
||||
_staticLabel->setMinimumSize ( _staticLabel->sizeHint() );
|
||||
_staticLabel->setAlignment ( Qt::AlignHCenter );
|
||||
//_staticLabel->setFrameStyle (QFrame::Panel | QFrame::Raised );
|
||||
|
||||
QFont font = Graphics::getFixedFont(QFont::Bold);
|
||||
int cwidth = QFontMetrics(font).width('X');
|
||||
|
||||
_dynamicLabel = new QLabel ();
|
||||
_dynamicLabel->setText ( "vvv.vu" );
|
||||
_dynamicLabel->setIndent ( cwidth/2 );
|
||||
_dynamicLabel->setMinimumSize ( QSize(cwidth*10,QFontMetrics(font).height()) );
|
||||
_dynamicLabel->setAlignment ( Qt::AlignRight );
|
||||
_dynamicLabel->setFont ( font );
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout ();
|
||||
layout->addWidget ( _staticLabel );
|
||||
layout->addWidget ( _dynamicLabel );
|
||||
layout->setContentsMargins ( 0, 0, 0, 0 );
|
||||
|
||||
setLayout ( layout );
|
||||
}
|
||||
|
||||
|
||||
QString DynamicLabel::getStaticText () const
|
||||
{
|
||||
return _staticLabel->text ();
|
||||
}
|
||||
|
||||
|
||||
QString DynamicLabel::getDynamicText () const
|
||||
{
|
||||
return _dynamicLabel->text ();
|
||||
}
|
||||
|
||||
|
||||
void DynamicLabel::setStaticText ( const QString& text )
|
||||
{
|
||||
_staticLabel->setText ( text );
|
||||
}
|
||||
|
||||
|
||||
void DynamicLabel::setDynamicText ( const QString& text )
|
||||
{
|
||||
_dynamicLabel->setText ( text );
|
||||
}
|
||||
|
||||
|
||||
void DynamicLabel::setDynamicText ( DbU::Unit u )
|
||||
{
|
||||
_dynamicLabel->setText ( DbU::getValueString(u,0).c_str() );
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
# include <assert.h>
|
||||
|
||||
# include <Qt>
|
||||
# include <QBrush>
|
||||
# include <QPen>
|
||||
# include <QFont>
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace Hurricane {
|
|||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
CellViewer ( Cell* cell );
|
||||
CellViewer ( QWidget* parent=NULL );
|
||||
void setCell ( Cell* cell );
|
||||
public slots:
|
||||
void runInspectorOnDataBase ();
|
||||
void runInspectorOnCell ();
|
||||
|
@ -46,7 +47,6 @@ namespace Hurricane {
|
|||
QAction* _exitAction;
|
||||
QAction* _refreshAction;
|
||||
QAction* _fitToContentsAction;
|
||||
QAction* _showBoundariesAction;
|
||||
QAction* _runInspectorOnDataBase;
|
||||
QAction* _runInspectorOnCell;
|
||||
QMenu* _fileMenu;
|
||||
|
@ -59,7 +59,7 @@ namespace Hurricane {
|
|||
protected:
|
||||
void createActions ();
|
||||
void createMenus ();
|
||||
void createLayout ( Cell* cell );
|
||||
void createLayout ();
|
||||
void runInspector ( Record* record );
|
||||
};
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ class QResizeEvent;
|
|||
class QMouseEvent;
|
||||
class QKeyEvent;
|
||||
class QAction;
|
||||
class QStatusBar;
|
||||
|
||||
|
||||
# include "hurricane/Commons.h"
|
||||
|
@ -45,176 +46,164 @@ namespace Hurricane {
|
|||
|
||||
class PaletteEntry;
|
||||
class Palette;
|
||||
class DynamicLabel;
|
||||
//class MapView;
|
||||
|
||||
|
||||
class CellWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
|
||||
// Attributes.
|
||||
protected:
|
||||
static const int _stripWidth;
|
||||
vector<Qt::CursorShape> _cursors;
|
||||
// MapView* _mapView;
|
||||
Palette* _palette;
|
||||
Box _displayArea;
|
||||
Box _visibleArea;
|
||||
float _scale;
|
||||
QPoint _offsetVA;
|
||||
QPixmap _drawingBuffer;
|
||||
QPainter _painter;
|
||||
QPoint _lastMousePosition;
|
||||
Cell* _cell;
|
||||
bool _mouseGo;
|
||||
bool _openCell;
|
||||
bool _showBoundaries;
|
||||
size_t _redrawRectCount;
|
||||
|
||||
public:
|
||||
CellWidget ( Cell* cell );
|
||||
virtual ~CellWidget ();
|
||||
|
||||
public slots:
|
||||
void redraw ( QRect redrawArea );
|
||||
inline void redraw ();
|
||||
void goLeft ( int dx = 0 );
|
||||
void goRight ( int dx = 0 );
|
||||
void goUp ( int dy = 0 );
|
||||
void goDown ( int dy = 0 );
|
||||
void fitToContents ();
|
||||
void setScale ( float scale );
|
||||
void setShowBoundaries ( bool state );
|
||||
void reframe ( const Box& box );
|
||||
void screenReframe ();
|
||||
void shiftLeft ( int dx );
|
||||
void shiftRight ( int dx );
|
||||
void shiftUp ( int dy );
|
||||
void shiftDown ( int dy );
|
||||
|
||||
// Qt QWidget Overloads.
|
||||
public:
|
||||
void pushCursor ( Qt::CursorShape cursor );
|
||||
void popCursor ();
|
||||
QSize minimumSizeHint () const;
|
||||
void paintEvent ( QPaintEvent* );
|
||||
void resizeEvent ( QResizeEvent* );
|
||||
void keyPressEvent ( QKeyEvent* );
|
||||
void mouseMoveEvent ( QMouseEvent* );
|
||||
void mousePressEvent ( QMouseEvent* );
|
||||
void mouseReleaseEvent ( QMouseEvent* );
|
||||
|
||||
// Geometric conversions.
|
||||
public:
|
||||
QRect getScreenRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
|
||||
QRect getScreenRect ( const Box& box ) const;
|
||||
QPoint getScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
|
||||
QPoint getScreenPoint ( const Point& point ) const;
|
||||
inline int getScreenX ( DbU::Unit x ) const;
|
||||
inline int getScreenY ( DbU::Unit y ) const;
|
||||
inline int getScreenLength ( DbU::Unit length ) const;
|
||||
inline DbU::Unit getX ( int x ) const;
|
||||
inline DbU::Unit getY ( int y ) const;
|
||||
inline DbU::Unit getLength ( int length ) const;
|
||||
inline Box getBox ( const QRect& rect ) const;
|
||||
|
||||
// Painter control & Hurricane objects drawing primitives.
|
||||
public:
|
||||
void drawBoundaries ( const Cell* , const Box&, const Transformation& );
|
||||
void drawBoundaries ( const Instance*, const Box&, const Transformation& );
|
||||
bool isDrawable ( PaletteEntry* entry );
|
||||
void drawCell ( const Cell* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawInstance ( const Instance*, const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawSlice ( const Slice* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawGo ( const Go* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawSegment ( const Segment* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawContact ( const Contact* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawPad ( const Pad* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawBox ( const Box& );
|
||||
void drawLine ( const Point&, const Point& );
|
||||
|
||||
// Constructor & Destructor.
|
||||
CellWidget ( QWidget* parent=NULL );
|
||||
virtual ~CellWidget ();
|
||||
// Accessors.
|
||||
public:
|
||||
// MapView* getMapView () { return _mapView; };
|
||||
inline Cell* getCell () const;
|
||||
inline Palette* getPalette ();
|
||||
inline bool showBoundaries () const;
|
||||
// MapView* getMapView () { return _mapView; };
|
||||
void setCell ( Cell* cell );
|
||||
inline Cell* getCell () const;
|
||||
inline Palette* getPalette ();
|
||||
inline QStatusBar* getStatusBar ();
|
||||
inline bool showBoundaries () const;
|
||||
// Painter control & Hurricane objects drawing primitives.
|
||||
void drawBoundaries ( const Cell* , const Box&, const Transformation& );
|
||||
void drawBoundaries ( const Instance*, const Box&, const Transformation& );
|
||||
bool isDrawable ( PaletteEntry* entry );
|
||||
void drawCell ( const Cell* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawInstance ( const Instance*, const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawSlice ( const Slice* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawGo ( const Go* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawSegment ( const Segment* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawContact ( const Contact* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawPad ( const Pad* , const BasicLayer*, const Box&, const Transformation& );
|
||||
void drawBox ( const Box& );
|
||||
void drawLine ( const Point&, const Point& );
|
||||
// Geometric conversions.
|
||||
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
|
||||
QRect dbuToDisplayRect ( const Box& box ) const;
|
||||
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
|
||||
QPoint dbuToDisplayPoint ( const Point& point ) const;
|
||||
inline int dbuToDisplayX ( DbU::Unit x ) const;
|
||||
inline int dbuToDisplayY ( DbU::Unit y ) const;
|
||||
inline int dbuToDisplayLength ( DbU::Unit length ) const;
|
||||
inline DbU::Unit displayToDbuX ( int x ) const;
|
||||
inline DbU::Unit displayToDbuY ( int y ) const;
|
||||
inline DbU::Unit displayToDbuLength ( int length ) const;
|
||||
inline Box displayToDbuBox ( const QRect& rect ) const;
|
||||
inline DbU::Unit screenToDbuX ( int x ) const;
|
||||
inline DbU::Unit screenToDbuY ( int y ) const;
|
||||
// Qt QWidget Functions Overloads.
|
||||
void pushCursor ( Qt::CursorShape cursor );
|
||||
void popCursor ();
|
||||
QSize minimumSizeHint () const;
|
||||
void paintEvent ( QPaintEvent* );
|
||||
void resizeEvent ( QResizeEvent* );
|
||||
void keyPressEvent ( QKeyEvent* );
|
||||
void mouseMoveEvent ( QMouseEvent* );
|
||||
void mousePressEvent ( QMouseEvent* );
|
||||
void mouseReleaseEvent ( QMouseEvent* );
|
||||
public slots:
|
||||
// Qt QWidget Slots Overload & CellWidget Specifics.
|
||||
void redraw ( QRect redrawArea );
|
||||
inline void redraw ();
|
||||
void goLeft ( int dx = 0 );
|
||||
void goRight ( int dx = 0 );
|
||||
void goUp ( int dy = 0 );
|
||||
void goDown ( int dy = 0 );
|
||||
void fitToContents ();
|
||||
void setScale ( float scale );
|
||||
void setShowBoundaries ( bool state );
|
||||
void reframe ( const Box& box );
|
||||
void screenReframe ();
|
||||
void shiftLeft ( int dx );
|
||||
void shiftRight ( int dx );
|
||||
void shiftUp ( int dy );
|
||||
void shiftDown ( int dy );
|
||||
|
||||
// Modifiers.
|
||||
public:
|
||||
protected:
|
||||
// Internal: Attributes.
|
||||
static const int _stripWidth;
|
||||
vector<Qt::CursorShape> _cursors;
|
||||
QStatusBar* _statusBar;
|
||||
// MapView* _mapView;
|
||||
Palette* _palette;
|
||||
DynamicLabel* _xPosition;
|
||||
DynamicLabel* _yPosition;
|
||||
Box _displayArea;
|
||||
Box _visibleArea;
|
||||
float _scale;
|
||||
QPoint _offsetVA;
|
||||
QPixmap _drawingBuffer;
|
||||
QPainter _painter;
|
||||
QPoint _lastMousePosition;
|
||||
Cell* _cell;
|
||||
bool _mouseGo;
|
||||
bool _showBoundaries;
|
||||
size_t _redrawRectCount;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
inline void CellWidget::redraw ()
|
||||
{ redraw ( QRect(QPoint(0,0),_drawingBuffer.size()) ); }
|
||||
|
||||
|
||||
inline int CellWidget::dbuToDisplayX ( DbU::Unit x ) const
|
||||
{ return (int)rint ( (float)( x - _displayArea.getXMin() ) * _scale ); }
|
||||
|
||||
|
||||
inline int CellWidget::dbuToDisplayY ( DbU::Unit y ) const
|
||||
{ return (int)rint ( (float)( _displayArea.getYMax() - y ) * _scale ); }
|
||||
|
||||
|
||||
inline int CellWidget::dbuToDisplayLength ( DbU::Unit length ) const
|
||||
{ return (int)rint ( (float)length * _scale ); }
|
||||
|
||||
|
||||
inline DbU::Unit CellWidget::displayToDbuX ( int x ) const
|
||||
{ return (DbU::Unit)(x/_scale) + _displayArea.getXMin(); }
|
||||
|
||||
|
||||
inline DbU::Unit CellWidget::displayToDbuY ( int y ) const
|
||||
{ return _displayArea.getYMax() - (DbU::Unit)(y/_scale); }
|
||||
|
||||
|
||||
inline DbU::Unit CellWidget::displayToDbuLength ( int length ) const
|
||||
{ return (int)( (float)length / _scale ); }
|
||||
|
||||
|
||||
inline Box CellWidget::displayToDbuBox ( const QRect& rect ) const
|
||||
{
|
||||
redraw ( QRect(QPoint(0,0),_drawingBuffer.size()) );
|
||||
return Box ( displayToDbuX(rect.x())
|
||||
, displayToDbuY(rect.y())
|
||||
, displayToDbuX(rect.x()+rect.width ())
|
||||
, displayToDbuY(rect.y()+rect.height())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline int CellWidget::getScreenX ( DbU::Unit x ) const
|
||||
{
|
||||
return (int)rint ( (float)( x - _displayArea.getXMin() ) * _scale );
|
||||
}
|
||||
inline DbU::Unit CellWidget::screenToDbuX ( int x ) const
|
||||
{ return displayToDbuX(x+_offsetVA.x()); }
|
||||
|
||||
|
||||
inline int CellWidget::getScreenY ( DbU::Unit y ) const
|
||||
{
|
||||
return (int)rint ( (float)( _displayArea.getYMax() - y ) * _scale );
|
||||
}
|
||||
|
||||
|
||||
inline int CellWidget::getScreenLength ( DbU::Unit length ) const
|
||||
{
|
||||
return (int)rint ( (float)length * _scale );
|
||||
}
|
||||
|
||||
|
||||
inline DbU::Unit CellWidget::getX ( int x ) const
|
||||
{
|
||||
return (DbU::Unit)(x/_scale) + _displayArea.getXMin();
|
||||
}
|
||||
|
||||
|
||||
inline DbU::Unit CellWidget::getY ( int y ) const
|
||||
{
|
||||
return _displayArea.getYMax() - (DbU::Unit)(y/_scale);
|
||||
}
|
||||
|
||||
|
||||
inline DbU::Unit CellWidget::getLength ( int length ) const
|
||||
{
|
||||
return (int)( (float)length / _scale );
|
||||
}
|
||||
|
||||
|
||||
inline Box CellWidget::getBox ( const QRect& rect ) const
|
||||
{
|
||||
return Box ( getX(rect.x())
|
||||
, getY(rect.y())
|
||||
, getX(rect.x()+rect.width ())
|
||||
, getY(rect.y()+rect.height()));
|
||||
}
|
||||
inline DbU::Unit CellWidget::screenToDbuY ( int y ) const
|
||||
{ return displayToDbuY(y+_offsetVA.y()); }
|
||||
|
||||
|
||||
inline Cell* CellWidget::getCell () const
|
||||
{
|
||||
return _cell;
|
||||
}
|
||||
{ return _cell; }
|
||||
|
||||
|
||||
inline Palette* CellWidget::getPalette ()
|
||||
{
|
||||
return _palette;
|
||||
}
|
||||
{ return _palette; }
|
||||
|
||||
|
||||
inline QStatusBar* CellWidget::getStatusBar ()
|
||||
{ return _statusBar; }
|
||||
|
||||
|
||||
inline bool CellWidget::showBoundaries () const
|
||||
{
|
||||
return _showBoundaries;
|
||||
}
|
||||
|
||||
|
||||
{ return _showBoundaries; }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
|
||||
|
||||
# ifndef __DYNAMIC_LABEL_H__
|
||||
# define __DYNAMIC_LABEL_H__
|
||||
|
||||
# include <QString>
|
||||
# include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
|
||||
# include "hurricane/Commons.h"
|
||||
# include "hurricane/DbU.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class DynamicLabel : public QWidget {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
DynamicLabel ( QWidget* parent=NULL );
|
||||
// Methods.
|
||||
QString getStaticText () const;
|
||||
QString getDynamicText () const;
|
||||
void setStaticText ( const QString& text );
|
||||
void setDynamicText ( const QString& text );
|
||||
void setDynamicText ( DbU::Unit u );
|
||||
|
||||
protected:
|
||||
// Internal - Attributes.
|
||||
QLabel* _staticLabel;
|
||||
QLabel* _dynamicLabel;
|
||||
|
||||
// Internal - Constructor.
|
||||
DynamicLabel ( const DynamicLabel& );
|
||||
DynamicLabel& operator= ( const DynamicLabel& );
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
# endif
|
Loading…
Reference in New Issue