diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index a8fb0d66..6502c94a 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -4,20 +4,21 @@ include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane ${HURRICANE_SOURCE_DIR}/src/hviewer ) - set ( mocincludes hurricane/viewer/PaletteEntry.h + set ( mocincludes hurricane/viewer/HPaletteEntry.h hurricane/viewer/LayerPaletteEntry.h hurricane/viewer/GroupPaletteEntry.h hurricane/viewer/ViewerPaletteEntry.h - hurricane/viewer/Palette.h + hurricane/viewer/HPalette.h hurricane/viewer/DynamicLabel.h + hurricane/viewer/HMousePosition.h hurricane/viewer/CellWidget.h hurricane/viewer/CellViewer.h hurricane/viewer/RecordModel.h hurricane/viewer/HInspectorWidget.h ) set ( exports hurricane/viewer/ScreenUtilities.h - hurricane/viewer/PaletteEntry.h - hurricane/viewer/Palette.h + hurricane/viewer/HPaletteEntry.h + hurricane/viewer/HPalette.h hurricane/viewer/DisplayStyle.h hurricane/viewer/Graphics.h hurricane/viewer/CellViewer.h @@ -27,12 +28,13 @@ set ( cpps ScreenUtilities.cpp DisplayStyle.cpp Graphics.cpp - PaletteEntry.cpp + HPaletteEntry.cpp LayerPaletteEntry.cpp GroupPaletteEntry.cpp ViewerPaletteEntry.cpp - Palette.cpp + HPalette.cpp DynamicLabel.cpp + HMousePosition.cpp CellWidget.cpp CellViewer.cpp RecordModel.cpp diff --git a/hurricane/src/hviewer/CellViewer.cpp b/hurricane/src/hviewer/CellViewer.cpp index fb277864..ed494803 100644 --- a/hurricane/src/hviewer/CellViewer.cpp +++ b/hurricane/src/hviewer/CellViewer.cpp @@ -6,16 +6,18 @@ #include #include #include +#include #include #include "hurricane/DataBase.h" #include "hurricane/Cell.h" //#include "MapView.h" -#include "hurricane/viewer/Palette.h" +#include "hurricane/viewer/HPalette.h" #include "hurricane/viewer/CellWidget.h" #include "hurricane/viewer/CellViewer.h" #include "hurricane/viewer/HInspectorWidget.h" +#include "hurricane/viewer/HMousePosition.h" namespace Hurricane { @@ -37,6 +39,7 @@ namespace Hurricane { , _toolsMenu(NULL) //, _mapView(NULL) , _palette(NULL) + , _mousePosition(NULL) , _cellWidget(NULL) { createMenus (); @@ -118,10 +121,13 @@ namespace Hurricane { if ( _cellWidget ) return; _cellWidget = new CellWidget (); - _palette = _cellWidget->getPalette(); + _palette = new HPalette (); //_mapView = _cellWidget->getMapView (); - setStatusBar ( _cellWidget->getStatusBar() ); + _cellWidget->bindToPalette ( _palette ); + + HMousePosition* _mousePosition = new HMousePosition (); + statusBar()->addPermanentWidget ( _mousePosition ); setCorner ( Qt::TopLeftCorner , Qt::LeftDockWidgetArea ); setCorner ( Qt::BottomLeftCorner , Qt::LeftDockWidgetArea ); @@ -139,7 +145,7 @@ namespace Hurricane { | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable ); - layerMapDock->setObjectName ( "Palette" ); + layerMapDock->setObjectName ( "HPalette" ); layerMapDock->setWidget ( _palette ); layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); addDockWidget ( Qt::RightDockWidgetArea, layerMapDock ); @@ -150,6 +156,8 @@ namespace Hurricane { connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents ())); connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase())); connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell ())); + connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&)) + , _mousePosition , SLOT(setPosition(const Point&)) ); _cellWidget->redraw (); } diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index 17c646e4..7dd9b233 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -9,7 +9,6 @@ # include # include # include -# include # include "hurricane/DataBase.h" # include "hurricane/Technology.h" @@ -22,9 +21,8 @@ # include "hurricane/Pad.h" # include "hurricane/viewer/Graphics.h" -# include "hurricane/viewer/PaletteEntry.h" -# include "hurricane/viewer/Palette.h" -# include "hurricane/viewer/DynamicLabel.h" +# include "hurricane/viewer/HPaletteEntry.h" +# include "hurricane/viewer/HPalette.h" // # include "MapView.h" # include "hurricane/viewer/CellWidget.h" @@ -87,10 +85,8 @@ namespace Hurricane { CellWidget::CellWidget ( QWidget* parent ) : QWidget(parent) - , _statusBar(NULL) + , _technology(NULL) , _palette(NULL) - , _xPosition(NULL) - , _yPosition(NULL) , _displayArea(0,0,6*_stripWidth,6*_stripWidth) , _visibleArea(_stripWidth,_stripWidth,4*_stripWidth,4*_stripWidth) , _scale(1.0) @@ -115,21 +111,23 @@ namespace Hurricane { setFocusPolicy ( Qt::StrongFocus ); setMouseTracking ( true ); - _statusBar = new QStatusBar ( this ); +// _statusBar = new QStatusBar ( this ); - _xPosition = new DynamicLabel (); - _xPosition->setStaticText ( "X:" ); - _xPosition->setDynamicText ( "0l" ); +// _xPosition = new DynamicLabel (); +// _xPosition->setStaticText ( "X:" ); +// _xPosition->setDynamicText ( "0l" ); - _yPosition = new DynamicLabel (); - _yPosition->setStaticText ( "Y:" ); - _yPosition->setDynamicText ( "0l" ); +// _yPosition = new DynamicLabel (); +// _yPosition->setStaticText ( "Y:" ); +// _yPosition->setDynamicText ( "0l" ); - _statusBar->addPermanentWidget ( _xPosition ); - _statusBar->addPermanentWidget ( _yPosition ); +// _statusBar->addPermanentWidget ( _xPosition ); +// _statusBar->addPermanentWidget ( _yPosition ); //_mapView = new MapView ( this ); - _palette = new Palette ( this ); + DataBase* database = DataBase::getDB(); + if ( database ) + _technology = database->getTechnology (); fitToContents (); } @@ -141,6 +139,25 @@ namespace Hurricane { } + + void CellWidget::bindToPalette ( HPalette* palette ) + { + detachFromPalette (); + _palette = palette; + + connect ( _palette, SIGNAL(paletteChanged()), this, SLOT(redraw()) ); + } + + + void CellWidget::detachFromPalette () + { + if ( _palette ) { + disconnect ( _palette, SIGNAL(paletteChanged()), this, SLOT(redraw()) ); + _palette = NULL; + } + } + + void CellWidget::pushCursor ( Qt::CursorShape cursor ) { setCursor ( cursor ); @@ -181,18 +198,33 @@ namespace Hurricane { if ( _cell ) { Box redrawBox = displayToDbuBox ( redrawArea ); - vector& paletteEntries = _palette->getEntries (); - for ( size_t i=0 ; igetName()) ); - _drawingPainter.setBrush ( Graphics::getBrush(paletteEntries[i]->getName()) ); + for_each_basic_layer ( basicLayer, _technology->getBasicLayers() ) { + _drawingPainter.setPen ( Graphics::getPen (basicLayer->getName()) ); + _drawingPainter.setBrush ( Graphics::getBrush(basicLayer->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() ); - } + if ( isDrawable(basicLayer->getName()) ) + drawCell ( _cell, basicLayer, redrawBox, Transformation() ); + end_for; } + if ( isDrawable("boundaries") ) { + _drawingPainter.setPen ( Graphics::getPen ("boundaries") ); + _drawingPainter.setBrush ( Graphics::getBrush("boundaries") ); + + drawBoundaries ( _cell, redrawBox, Transformation() ); + } + +// vector& paletteEntries = _palette->getEntries (); +// for ( size_t i=0 ; igetName()) ); +// _drawingPainter.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() ); +// } +// } } _drawingPainter.end (); @@ -232,10 +264,12 @@ namespace Hurricane { } - bool CellWidget::isDrawable ( PaletteEntry* entry ) + bool CellWidget::isDrawable ( const Name& entryName ) { - return entry->isChecked() - && ( Graphics::getThreshold(entry->getName())/DbU::lambda(1.0) < _scale ); + HPaletteEntry* entry = (_palette) ? _palette->find(entryName) : NULL; + + return (!entry || entry->isChecked()) + && ( Graphics::getThreshold(entryName)/DbU::lambda(1.0) < _scale ); } @@ -648,8 +682,8 @@ namespace Hurricane { copyToScreen (); - if ( isDrawable(_palette->find("grid")) ) drawGrid (); - if ( isDrawable(_palette->find("spot")) ) _spot.moveTo ( _lastMousePosition ); + if ( isDrawable("grid") ) drawGrid (); + if ( isDrawable("spot") ) _spot.moveTo ( _lastMousePosition ); _screenPainter.end (); } @@ -720,11 +754,8 @@ namespace Hurricane { _lastMousePosition = event->pos(); } else { - //cerr << "x:" << event->x() << " y:" << event->y() << endl; - _xPosition->setDynamicText ( screenToDbuX(event->x()) ); - _yPosition->setDynamicText ( screenToDbuY(event->y()) ); - _lastMousePosition = event->pos(); + emit mousePositionChanged ( screenToDbuPoint(event->pos()) ); update (); } diff --git a/hurricane/src/hviewer/GroupPaletteEntry.cpp b/hurricane/src/hviewer/GroupPaletteEntry.cpp index e588d304..290815d1 100644 --- a/hurricane/src/hviewer/GroupPaletteEntry.cpp +++ b/hurricane/src/hviewer/GroupPaletteEntry.cpp @@ -7,14 +7,14 @@ # include "hurricane/viewer/Graphics.h" # include "hurricane/viewer/GroupPaletteEntry.h" -# include "hurricane/viewer/Palette.h" +# include "hurricane/viewer/HPalette.h" namespace Hurricane { - GroupPaletteEntry::GroupPaletteEntry ( Palette* palette, const Name& name ) - : PaletteEntry(palette) + GroupPaletteEntry::GroupPaletteEntry ( HPalette* palette, const Name& name ) + : HPaletteEntry(palette) , _name(name) , _button(NULL) , _index(0) @@ -23,7 +23,7 @@ namespace Hurricane { } - GroupPaletteEntry* GroupPaletteEntry::create ( Palette* palette, const Name& name ) + GroupPaletteEntry* GroupPaletteEntry::create ( HPalette* palette, const Name& name ) { GroupPaletteEntry* entry = new GroupPaletteEntry ( palette, name ); @@ -103,7 +103,7 @@ namespace Hurricane { void GroupPaletteEntry::hideShow () { - vector entries = _palette->getEntries (); + vector entries = _palette->getEntries (); if ( entries[_index] != this ) cerr << "[ERROR] Incoherent index for group \"" << getString(getName()) << "\"." << endl; diff --git a/hurricane/src/hviewer/Palette.cpp b/hurricane/src/hviewer/HPalette.cpp similarity index 88% rename from hurricane/src/hviewer/Palette.cpp rename to hurricane/src/hviewer/HPalette.cpp index 73eb0b19..a8132b14 100644 --- a/hurricane/src/hviewer/Palette.cpp +++ b/hurricane/src/hviewer/HPalette.cpp @@ -16,11 +16,11 @@ # include "hurricane/BasicLayers.h" # include "hurricane/viewer/Graphics.h" -# include "hurricane/viewer/PaletteEntry.h" +# include "hurricane/viewer/HPaletteEntry.h" # include "hurricane/viewer/LayerPaletteEntry.h" # include "hurricane/viewer/GroupPaletteEntry.h" # include "hurricane/viewer/ViewerPaletteEntry.h" -# include "hurricane/viewer/Palette.h" +# include "hurricane/viewer/HPalette.h" # include "hurricane/viewer/CellWidget.h" @@ -28,11 +28,10 @@ namespace Hurricane { - Palette::Palette ( CellWidget* cellWidget ) : QScrollArea() - , _cellWidget(cellWidget) - , _entries() - , _showAll(NULL) - , _hideAll(NULL) + HPalette::HPalette ( QWidget* parent ) : QScrollArea(parent) + , _entries() + , _showAll(NULL) + , _hideAll(NULL) { setWidgetResizable ( true ); @@ -135,7 +134,7 @@ namespace Hurricane { } - bool Palette::isDrawable ( size_t index ) + bool HPalette::isDrawable ( size_t index ) { if ( index < _entries.size() ) return _entries[index]->isChecked (); @@ -144,33 +143,33 @@ namespace Hurricane { } - void Palette::showAll () + void HPalette::showAll () { for ( size_t i=0 ; i<_entries.size() ; i++ ) if ( !_entries[i]->isGroup() ) _entries[i]->setChecked ( true ); - _cellWidget->redraw (); + emit paletteChanged(); } - void Palette::hideAll () + void HPalette::hideAll () { for ( size_t i=0 ; i<_entries.size() ; i++ ) if ( !_entries[i]->isGroup() ) _entries[i]->setChecked ( false ); - _cellWidget->redraw (); + emit paletteChanged(); } - void Palette::redrawCellWidget () + void HPalette::redrawCellWidget () { - _cellWidget->redraw (); + emit paletteChanged(); } - PaletteEntry* Palette::find ( const Name& name ) + HPaletteEntry* HPalette::find ( const Name& name ) { for ( size_t i=0 ; i<_entries.size() ; i++ ) { if ( _entries[i]->getName() == name ) diff --git a/hurricane/src/hviewer/PaletteEntry.cpp b/hurricane/src/hviewer/HPaletteEntry.cpp similarity index 78% rename from hurricane/src/hviewer/PaletteEntry.cpp rename to hurricane/src/hviewer/HPaletteEntry.cpp index 0cf6c75f..ee0e9cf3 100644 --- a/hurricane/src/hviewer/PaletteEntry.cpp +++ b/hurricane/src/hviewer/HPaletteEntry.cpp @@ -5,13 +5,13 @@ # include # include "hurricane/viewer/Graphics.h" -# include "hurricane/viewer/PaletteEntry.h" +# include "hurricane/viewer/HPaletteEntry.h" namespace Hurricane { - PaletteSample::PaletteSample ( PaletteEntry* entry ) + HPaletteSample::HPaletteSample ( HPaletteEntry* entry ) : QWidget() , _sample(QSize(20,20)) , _entry(entry) @@ -24,7 +24,7 @@ namespace Hurricane { } - void PaletteSample::redraw () + void HPaletteSample::redraw () { QPainter painter ( &_sample ); @@ -37,14 +37,14 @@ namespace Hurricane { } - void PaletteSample::paintEvent ( QPaintEvent* ) + void HPaletteSample::paintEvent ( QPaintEvent* ) { QPainter painter ( this ); painter.drawPixmap ( 0, 0, _sample ); } - PaletteEntry::PaletteEntry ( Palette* palette ) + HPaletteEntry::HPaletteEntry ( HPalette* palette ) : QWidget() , _palette(palette) { diff --git a/hurricane/src/hviewer/LayerPaletteEntry.cpp b/hurricane/src/hviewer/LayerPaletteEntry.cpp index 0753dfe2..715c5bce 100644 --- a/hurricane/src/hviewer/LayerPaletteEntry.cpp +++ b/hurricane/src/hviewer/LayerPaletteEntry.cpp @@ -9,20 +9,20 @@ # include "hurricane/viewer/Graphics.h" # include "hurricane/viewer/LayerPaletteEntry.h" -# include "hurricane/viewer/Palette.h" +# include "hurricane/viewer/HPalette.h" namespace Hurricane { - LayerPaletteEntry::LayerPaletteEntry ( Palette* entry, BasicLayer* basicLayer ) - : PaletteEntry(entry) + LayerPaletteEntry::LayerPaletteEntry ( HPalette* entry, BasicLayer* basicLayer ) + : HPaletteEntry(entry) , _basicLayer(basicLayer) { } - LayerPaletteEntry* LayerPaletteEntry::create ( Palette* palette, BasicLayer* basicLayer ) + LayerPaletteEntry* LayerPaletteEntry::create ( HPalette* palette, BasicLayer* basicLayer ) { LayerPaletteEntry* entry = new LayerPaletteEntry ( palette, basicLayer ); @@ -37,7 +37,7 @@ namespace Hurricane { QHBoxLayout* layout = new QHBoxLayout (); layout->setContentsMargins ( 0, 0, 0, 0 ); - layout->addWidget ( new PaletteSample(this) ); + layout->addWidget ( new HPaletteSample(this) ); _checkBox = new QCheckBox ( this ); _checkBox->setChecked ( true ); diff --git a/hurricane/src/hviewer/ViewerPaletteEntry.cpp b/hurricane/src/hviewer/ViewerPaletteEntry.cpp index af61f1b9..fcf17e04 100644 --- a/hurricane/src/hviewer/ViewerPaletteEntry.cpp +++ b/hurricane/src/hviewer/ViewerPaletteEntry.cpp @@ -9,20 +9,20 @@ # include "hurricane/viewer/Graphics.h" # include "hurricane/viewer/ViewerPaletteEntry.h" -# include "hurricane/viewer/Palette.h" +# include "hurricane/viewer/HPalette.h" namespace Hurricane { - ViewerPaletteEntry::ViewerPaletteEntry ( Palette* entry, const Name& name ) - : PaletteEntry(entry) + ViewerPaletteEntry::ViewerPaletteEntry ( HPalette* entry, const Name& name ) + : HPaletteEntry(entry) , _name(name) { } - ViewerPaletteEntry* ViewerPaletteEntry::create ( Palette* palette, const Name& name ) + ViewerPaletteEntry* ViewerPaletteEntry::create ( HPalette* palette, const Name& name ) { ViewerPaletteEntry* entry = new ViewerPaletteEntry ( palette, name ); @@ -37,7 +37,7 @@ namespace Hurricane { QHBoxLayout* layout = new QHBoxLayout (); layout->setContentsMargins ( 0, 0, 0, 0 ); - layout->addWidget ( new PaletteSample(this) ); + layout->addWidget ( new HPaletteSample(this) ); _checkBox = new QCheckBox ( this ); _checkBox->setChecked ( true ); diff --git a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h index 302e6d1c..9dfd50c2 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h @@ -23,44 +23,46 @@ namespace Hurricane { class Cell; - class Palette; + class HPalette; //class MapView; class CellWidget; + class HMousePosition; class CellViewer : public QMainWindow { Q_OBJECT; public: - CellViewer ( QWidget* parent=NULL ); - void setCell ( Cell* cell ); + CellViewer ( QWidget* parent=NULL ); + void setCell ( Cell* cell ); public slots: - void runInspectorOnDataBase (); - void runInspectorOnCell (); + void runInspectorOnDataBase (); + void runInspectorOnCell (); protected: - QAction* _openAction; - QAction* _nextCellAction; - QAction* _previousCellAction; - QAction* _nextAction; - QAction* _saveAction; - QAction* _exitAction; - QAction* _refreshAction; - QAction* _fitToContentsAction; - QAction* _runInspectorOnDataBase; - QAction* _runInspectorOnCell; - QMenu* _fileMenu; - QMenu* _viewMenu; - QMenu* _toolsMenu; - //MapView* _mapView; - Palette* _palette; - CellWidget* _cellWidget; + QAction* _openAction; + QAction* _nextCellAction; + QAction* _previousCellAction; + QAction* _nextAction; + QAction* _saveAction; + QAction* _exitAction; + QAction* _refreshAction; + QAction* _fitToContentsAction; + QAction* _runInspectorOnDataBase; + QAction* _runInspectorOnCell; + QMenu* _fileMenu; + QMenu* _viewMenu; + QMenu* _toolsMenu; + //MapView* _mapView; + HPalette* _palette; + HMousePosition* _mousePosition; + CellWidget* _cellWidget; protected: - void createActions (); - void createMenus (); - void createLayout (); - void runInspector ( Record* record ); + void createActions (); + void createMenus (); + void createLayout (); + void runInspector ( Record* record ); }; diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index cb5795b1..7416b229 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -20,7 +20,6 @@ class QResizeEvent; class QMouseEvent; class QKeyEvent; class QAction; -class QStatusBar; # include "hurricane/Commons.h" @@ -35,6 +34,7 @@ class QStatusBar; namespace Hurricane { + class Technology; class BasicLayer; class Go; class Cell; @@ -44,9 +44,8 @@ namespace Hurricane { class Contact; class Pad; - class PaletteEntry; - class Palette; - class DynamicLabel; + class HPaletteEntry; + class HPalette; //class MapView; @@ -55,79 +54,82 @@ namespace Hurricane { public: // Constructor & Destructor. - CellWidget ( QWidget* parent=NULL ); - virtual ~CellWidget (); + CellWidget ( QWidget* parent=NULL ); + virtual ~CellWidget (); // Accessors. - // MapView* getMapView () { return _mapView; }; - void setCell ( Cell* cell ); - inline Cell* getCell () const; - inline Palette* getPalette (); - inline QStatusBar* getStatusBar (); - inline bool showBoundaries () const; + // MapView* getMapView () { return _mapView; }; + void setCell ( Cell* cell ); + inline Cell* getCell () const; + inline HPalette* getPalette (); + void bindToPalette ( HPalette* palette ); + void detachFromPalette (); + 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& ); - void drawGrid (); - void drawSpot (); + void drawBoundaries ( const Cell* , const Box&, const Transformation& ); + void drawBoundaries ( const Instance*, const Box&, const Transformation& ); + bool isDrawable ( const Name& entryName ); + 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& ); + void drawGrid (); + void drawSpot (); // 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 int dbuToScreenX ( DbU::Unit x ) const; - inline int dbuToScreenY ( DbU::Unit y ) const; - QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const; - inline QPoint dbuToScreenPoint ( const Point& point ) 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; - inline Point screenToDbuPoint ( const QPoint& point ) const; + 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 int dbuToScreenX ( DbU::Unit x ) const; + inline int dbuToScreenY ( DbU::Unit y ) const; + QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const; + inline QPoint dbuToScreenPoint ( const Point& point ) 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; + inline Point screenToDbuPoint ( const QPoint& point ) 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* ); + 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* ); + signals: + void mousePositionChanged ( const Point& position ); public slots: // Qt QWidget Slots Overload & CellWidget Specifics. - inline QPainter& getScreenPainter (); - void redraw ( QRect redrawArea ); - inline void redraw (); - inline void copyToScreen ( int sx, int sy, int h, int w ); - inline void copyToScreen (); - 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 displayReframe (); - void shiftLeft ( int dx ); - void shiftRight ( int dx ); - void shiftUp ( int dy ); - void shiftDown ( int dy ); + inline QPainter& getScreenPainter (); + void redraw ( QRect redrawArea ); + inline void redraw (); + inline void copyToScreen ( int sx, int sy, int h, int w ); + inline void copyToScreen (); + 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 displayReframe (); + void shiftLeft ( int dx ); + void shiftRight ( int dx ); + void shiftUp ( int dy ); + void shiftDown ( int dy ); private: class Spot { @@ -146,11 +148,9 @@ namespace Hurricane { // Internal: Attributes. static const int _stripWidth; vector _cursors; - QStatusBar* _statusBar; // MapView* _mapView; - Palette* _palette; - DynamicLabel* _xPosition; - DynamicLabel* _yPosition; + Technology* _technology; + HPalette* _palette; Box _displayArea; Box _visibleArea; float _scale; @@ -247,14 +247,10 @@ inline Cell* CellWidget::getCell () const { return _cell; } -inline Palette* CellWidget::getPalette () +inline HPalette* CellWidget::getPalette () { return _palette; } -inline QStatusBar* CellWidget::getStatusBar () -{ return _statusBar; } - - inline bool CellWidget::showBoundaries () const { return _showBoundaries; } diff --git a/hurricane/src/hviewer/hurricane/viewer/DynamicLabel.h b/hurricane/src/hviewer/hurricane/viewer/DynamicLabel.h index 6ac581ae..acde57a0 100644 --- a/hurricane/src/hviewer/hurricane/viewer/DynamicLabel.h +++ b/hurricane/src/hviewer/hurricane/viewer/DynamicLabel.h @@ -38,7 +38,6 @@ namespace Hurricane { // Internal - Constructor. DynamicLabel ( const DynamicLabel& ); DynamicLabel& operator= ( const DynamicLabel& ); - }; diff --git a/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h index 13a097ed..702cafad 100644 --- a/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h @@ -2,26 +2,26 @@ // -*- C++ -*- -# ifndef __GROUP_PALETTE_ENTRY_H__ -# define __GROUP_PALETTE_ENTRY_H__ +# ifndef __GROUP_HPALETTE_ENTRY_H__ +# define __GROUP_HPALETTE_ENTRY_H__ class QPushButton; # include "hurricane/Name.h" -# include "hurricane/viewer/PaletteEntry.h" +# include "hurricane/viewer/HPaletteEntry.h" namespace Hurricane { - class GroupPaletteEntry : public PaletteEntry { + class GroupPaletteEntry : public HPaletteEntry { Q_OBJECT; // Constructor. public: - static GroupPaletteEntry* create ( Palette* palette, const Name& name ); + static GroupPaletteEntry* create ( HPalette* palette, const Name& name ); // Methods. public: @@ -44,7 +44,7 @@ namespace Hurricane { bool _expanded; // Internal - Constructor. - GroupPaletteEntry ( Palette* palette, const Name& name ); + GroupPaletteEntry ( HPalette* palette, const Name& name ); GroupPaletteEntry ( const GroupPaletteEntry& ); GroupPaletteEntry& operator= ( const GroupPaletteEntry& ); virtual void _postCreate (); diff --git a/hurricane/src/hviewer/hurricane/viewer/HPalette.h b/hurricane/src/hviewer/hurricane/viewer/HPalette.h new file mode 100644 index 00000000..e0177a9f --- /dev/null +++ b/hurricane/src/hviewer/hurricane/viewer/HPalette.h @@ -0,0 +1,71 @@ + +// -*- C++ -*- + + +# ifndef __HPALETTE__ +# define __HPALETTE__ + +# include +# include +# include +# include + +# include "hurricane/Commons.h" + + + class QCheckBox; + class QPushButton; + + +namespace Hurricane { + + + using namespace std; + + + class Name; + class BasicLayer; + class HPaletteEntry; + class CellWidget; + + + class HPalette : public QScrollArea { + Q_OBJECT; + + public: + // Constructor. + HPalette ( QWidget* parent=NULL ); + // Methods. + bool isDrawable ( size_t index ); + inline CellWidget* getCellWidget (); + inline vector& getEntries (); + void redrawCellWidget (); + HPaletteEntry* find ( const Name& name ); + signals: + // Signals. + void paletteChanged (); + public slots: + // Slots. + void showAll (); + void hideAll (); + + protected: + // Internal - Attributes. + vector _entries; + QPushButton* _showAll; + QPushButton* _hideAll; + // Internal - Constructors. + HPalette ( const HPalette& ); + HPalette& operator= ( const HPalette& ); + + }; + + + // Inline Functions. + inline vector& HPalette::getEntries () { return _entries; } + + +} // End of Hurricane namespace. + + +# endif diff --git a/hurricane/src/hviewer/hurricane/viewer/PaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h similarity index 68% rename from hurricane/src/hviewer/hurricane/viewer/PaletteEntry.h rename to hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h index 2f0722b6..052ccfb4 100644 --- a/hurricane/src/hviewer/hurricane/viewer/PaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h @@ -20,21 +20,21 @@ namespace Hurricane { class Name; class BasicLayer; - class Palette; - class PaletteEntry; + class HPalette; + class HPaletteEntry; - class PaletteSample : public QWidget { + class HPaletteSample : public QWidget { Q_OBJECT; // Constructor. public: - PaletteSample ( PaletteEntry* entry ); + HPaletteSample ( HPaletteEntry* entry ); // Internals - Attributes. protected: QPixmap _sample; - PaletteEntry* _entry; + HPaletteEntry* _entry; // Internals - Methods. void redraw (); @@ -43,7 +43,7 @@ namespace Hurricane { }; - class PaletteEntry : public QWidget { + class HPaletteEntry : public QWidget { Q_OBJECT; // Methods. @@ -61,13 +61,13 @@ namespace Hurricane { // Internal - Attributes. protected: - Palette* _palette; + HPalette* _palette; // Internal - Constructor. - PaletteEntry ( Palette* palette ); - PaletteEntry ( const PaletteEntry& ); - PaletteEntry& operator= ( const PaletteEntry& ); - virtual void _postCreate () = 0; + HPaletteEntry ( HPalette* palette ); + HPaletteEntry ( const HPaletteEntry& ); + HPaletteEntry& operator= ( const HPaletteEntry& ); + virtual void _postCreate () = 0; }; diff --git a/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h index 190f52e6..b5ae4244 100644 --- a/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h @@ -8,18 +8,18 @@ class QCheckBox; -# include "hurricane/viewer/PaletteEntry.h" +# include "hurricane/viewer/HPaletteEntry.h" namespace Hurricane { - class LayerPaletteEntry : public PaletteEntry { + class LayerPaletteEntry : public HPaletteEntry { Q_OBJECT; // Constructor. public: - static LayerPaletteEntry* create ( Palette* palette, BasicLayer* basicLayer ); + static LayerPaletteEntry* create ( HPalette* palette, BasicLayer* basicLayer ); // Methods. public: @@ -40,7 +40,7 @@ namespace Hurricane { QCheckBox* _checkBox; // Internal - Constructor. - LayerPaletteEntry ( Palette* palette, BasicLayer* basicLayer ); + LayerPaletteEntry ( HPalette* palette, BasicLayer* basicLayer ); LayerPaletteEntry ( const LayerPaletteEntry& ); LayerPaletteEntry& operator= ( const LayerPaletteEntry& ); virtual void _postCreate (); diff --git a/hurricane/src/hviewer/hurricane/viewer/Palette.h b/hurricane/src/hviewer/hurricane/viewer/Palette.h deleted file mode 100644 index b01a57ff..00000000 --- a/hurricane/src/hviewer/hurricane/viewer/Palette.h +++ /dev/null @@ -1,70 +0,0 @@ - -// -*- C++ -*- - - -# ifndef __PALETTE__ -# define __PALETTE__ - -# include -# include -# include -# include - -# include "hurricane/Commons.h" - - - class QCheckBox; - class QPushButton; - - -namespace Hurricane { - - - using namespace std; - - - class Name; - class BasicLayer; - class PaletteEntry; - class CellWidget; - - - class Palette : public QScrollArea { - Q_OBJECT; - - // Constructor. - public: - Palette ( CellWidget* cellWidget ); - // Methods. - bool isDrawable ( size_t index ); - inline CellWidget* getCellWidget (); - inline vector& getEntries (); - void redrawCellWidget (); - PaletteEntry* find ( const Name& name ); - // Slots. - public slots: - void showAll (); - void hideAll (); - - // Internal - Attributes. - protected: - CellWidget* _cellWidget; - vector _entries; - QPushButton* _showAll; - QPushButton* _hideAll; - // Internal - Constructors. - Palette ( const Palette& ); - Palette& operator= ( const Palette& ); - - }; - - - // Inline Functions. - inline CellWidget* Palette::getCellWidget () { return _cellWidget; } - inline vector& Palette::getEntries () { return _entries; } - - -} // End of Hurricane namespace. - - -# endif diff --git a/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h index b016e19c..8d0817df 100644 --- a/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h @@ -9,18 +9,18 @@ class QCheckBox; # include "hurricane/Name.h" -# include "hurricane/viewer/PaletteEntry.h" +# include "hurricane/viewer/HPaletteEntry.h" namespace Hurricane { - class ViewerPaletteEntry : public PaletteEntry { + class ViewerPaletteEntry : public HPaletteEntry { Q_OBJECT; // Constructor. public: - static ViewerPaletteEntry* create ( Palette* palette, const Name& name ); + static ViewerPaletteEntry* create ( HPalette* palette, const Name& name ); // Methods. public: @@ -41,7 +41,7 @@ namespace Hurricane { QCheckBox* _checkBox; // Internal - Constructor. - ViewerPaletteEntry ( Palette* palette, const Name& name ); + ViewerPaletteEntry ( HPalette* palette, const Name& name ); ViewerPaletteEntry ( const ViewerPaletteEntry& ); ViewerPaletteEntry& operator= ( const ViewerPaletteEntry& ); virtual void _postCreate ();