* ./hurricane/src/hviewer :

- New Widget policy : a widget do not generate other widget : applied to
       CellWidget which no longer supplies Palette & StatusBar.
         API note: to associate a HPalette to a CellWidget (that is be able
       to select layer) you have to call "bindToPalette()" on the CellWidget.
   - Hurricane reusable widget names prefixed by 'H' : HMousePosition and
       HPalette.
This commit is contained in:
Jean-Paul Chaput 2008-07-04 15:33:11 +00:00
parent 98d3004a22
commit 2607d8d94c
17 changed files with 320 additions and 282 deletions

View File

@ -4,20 +4,21 @@
include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane
${HURRICANE_SOURCE_DIR}/src/hviewer ) ${HURRICANE_SOURCE_DIR}/src/hviewer )
set ( mocincludes hurricane/viewer/PaletteEntry.h set ( mocincludes hurricane/viewer/HPaletteEntry.h
hurricane/viewer/LayerPaletteEntry.h hurricane/viewer/LayerPaletteEntry.h
hurricane/viewer/GroupPaletteEntry.h hurricane/viewer/GroupPaletteEntry.h
hurricane/viewer/ViewerPaletteEntry.h hurricane/viewer/ViewerPaletteEntry.h
hurricane/viewer/Palette.h hurricane/viewer/HPalette.h
hurricane/viewer/DynamicLabel.h hurricane/viewer/DynamicLabel.h
hurricane/viewer/HMousePosition.h
hurricane/viewer/CellWidget.h hurricane/viewer/CellWidget.h
hurricane/viewer/CellViewer.h hurricane/viewer/CellViewer.h
hurricane/viewer/RecordModel.h hurricane/viewer/RecordModel.h
hurricane/viewer/HInspectorWidget.h hurricane/viewer/HInspectorWidget.h
) )
set ( exports hurricane/viewer/ScreenUtilities.h set ( exports hurricane/viewer/ScreenUtilities.h
hurricane/viewer/PaletteEntry.h hurricane/viewer/HPaletteEntry.h
hurricane/viewer/Palette.h hurricane/viewer/HPalette.h
hurricane/viewer/DisplayStyle.h hurricane/viewer/DisplayStyle.h
hurricane/viewer/Graphics.h hurricane/viewer/Graphics.h
hurricane/viewer/CellViewer.h hurricane/viewer/CellViewer.h
@ -27,12 +28,13 @@
set ( cpps ScreenUtilities.cpp set ( cpps ScreenUtilities.cpp
DisplayStyle.cpp DisplayStyle.cpp
Graphics.cpp Graphics.cpp
PaletteEntry.cpp HPaletteEntry.cpp
LayerPaletteEntry.cpp LayerPaletteEntry.cpp
GroupPaletteEntry.cpp GroupPaletteEntry.cpp
ViewerPaletteEntry.cpp ViewerPaletteEntry.cpp
Palette.cpp HPalette.cpp
DynamicLabel.cpp DynamicLabel.cpp
HMousePosition.cpp
CellWidget.cpp CellWidget.cpp
CellViewer.cpp CellViewer.cpp
RecordModel.cpp RecordModel.cpp

View File

@ -6,16 +6,18 @@
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
#include <QMenuBar> #include <QMenuBar>
#include <QStatusBar>
#include <QDockWidget> #include <QDockWidget>
#include "hurricane/DataBase.h" #include "hurricane/DataBase.h"
#include "hurricane/Cell.h" #include "hurricane/Cell.h"
//#include "MapView.h" //#include "MapView.h"
#include "hurricane/viewer/Palette.h" #include "hurricane/viewer/HPalette.h"
#include "hurricane/viewer/CellWidget.h" #include "hurricane/viewer/CellWidget.h"
#include "hurricane/viewer/CellViewer.h" #include "hurricane/viewer/CellViewer.h"
#include "hurricane/viewer/HInspectorWidget.h" #include "hurricane/viewer/HInspectorWidget.h"
#include "hurricane/viewer/HMousePosition.h"
namespace Hurricane { namespace Hurricane {
@ -37,6 +39,7 @@ namespace Hurricane {
, _toolsMenu(NULL) , _toolsMenu(NULL)
//, _mapView(NULL) //, _mapView(NULL)
, _palette(NULL) , _palette(NULL)
, _mousePosition(NULL)
, _cellWidget(NULL) , _cellWidget(NULL)
{ {
createMenus (); createMenus ();
@ -118,10 +121,13 @@ namespace Hurricane {
if ( _cellWidget ) return; if ( _cellWidget ) return;
_cellWidget = new CellWidget (); _cellWidget = new CellWidget ();
_palette = _cellWidget->getPalette(); _palette = new HPalette ();
//_mapView = _cellWidget->getMapView (); //_mapView = _cellWidget->getMapView ();
setStatusBar ( _cellWidget->getStatusBar() ); _cellWidget->bindToPalette ( _palette );
HMousePosition* _mousePosition = new HMousePosition ();
statusBar()->addPermanentWidget ( _mousePosition );
setCorner ( Qt::TopLeftCorner , Qt::LeftDockWidgetArea ); setCorner ( Qt::TopLeftCorner , Qt::LeftDockWidgetArea );
setCorner ( Qt::BottomLeftCorner , Qt::LeftDockWidgetArea ); setCorner ( Qt::BottomLeftCorner , Qt::LeftDockWidgetArea );
@ -139,7 +145,7 @@ namespace Hurricane {
| QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetMovable
| QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetFloatable
); );
layerMapDock->setObjectName ( "Palette" ); layerMapDock->setObjectName ( "HPalette" );
layerMapDock->setWidget ( _palette ); layerMapDock->setWidget ( _palette );
layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
addDockWidget ( Qt::RightDockWidgetArea, layerMapDock ); addDockWidget ( Qt::RightDockWidgetArea, layerMapDock );
@ -150,6 +156,8 @@ namespace Hurricane {
connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents ())); connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents ()));
connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase())); connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase()));
connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell ())); connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell ()));
connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&))
, _mousePosition , SLOT(setPosition(const Point&)) );
_cellWidget->redraw (); _cellWidget->redraw ();
} }

View File

@ -9,7 +9,6 @@
# include <QStylePainter> # include <QStylePainter>
# include <QBitmap> # include <QBitmap>
# include <QLabel> # include <QLabel>
# include <QStatusBar>
# include "hurricane/DataBase.h" # include "hurricane/DataBase.h"
# include "hurricane/Technology.h" # include "hurricane/Technology.h"
@ -22,9 +21,8 @@
# include "hurricane/Pad.h" # include "hurricane/Pad.h"
# include "hurricane/viewer/Graphics.h" # include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/PaletteEntry.h" # include "hurricane/viewer/HPaletteEntry.h"
# include "hurricane/viewer/Palette.h" # include "hurricane/viewer/HPalette.h"
# include "hurricane/viewer/DynamicLabel.h"
// # include "MapView.h" // # include "MapView.h"
# include "hurricane/viewer/CellWidget.h" # include "hurricane/viewer/CellWidget.h"
@ -87,10 +85,8 @@ namespace Hurricane {
CellWidget::CellWidget ( QWidget* parent ) : QWidget(parent) CellWidget::CellWidget ( QWidget* parent ) : QWidget(parent)
, _statusBar(NULL) , _technology(NULL)
, _palette(NULL) , _palette(NULL)
, _xPosition(NULL)
, _yPosition(NULL)
, _displayArea(0,0,6*_stripWidth,6*_stripWidth) , _displayArea(0,0,6*_stripWidth,6*_stripWidth)
, _visibleArea(_stripWidth,_stripWidth,4*_stripWidth,4*_stripWidth) , _visibleArea(_stripWidth,_stripWidth,4*_stripWidth,4*_stripWidth)
, _scale(1.0) , _scale(1.0)
@ -115,21 +111,23 @@ namespace Hurricane {
setFocusPolicy ( Qt::StrongFocus ); setFocusPolicy ( Qt::StrongFocus );
setMouseTracking ( true ); setMouseTracking ( true );
_statusBar = new QStatusBar ( this ); // _statusBar = new QStatusBar ( this );
_xPosition = new DynamicLabel (); // _xPosition = new DynamicLabel ();
_xPosition->setStaticText ( "X:" ); // _xPosition->setStaticText ( "X:" );
_xPosition->setDynamicText ( "0l" ); // _xPosition->setDynamicText ( "0l" );
_yPosition = new DynamicLabel (); // _yPosition = new DynamicLabel ();
_yPosition->setStaticText ( "Y:" ); // _yPosition->setStaticText ( "Y:" );
_yPosition->setDynamicText ( "0l" ); // _yPosition->setDynamicText ( "0l" );
_statusBar->addPermanentWidget ( _xPosition ); // _statusBar->addPermanentWidget ( _xPosition );
_statusBar->addPermanentWidget ( _yPosition ); // _statusBar->addPermanentWidget ( _yPosition );
//_mapView = new MapView ( this ); //_mapView = new MapView ( this );
_palette = new Palette ( this ); DataBase* database = DataBase::getDB();
if ( database )
_technology = database->getTechnology ();
fitToContents (); 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 ) void CellWidget::pushCursor ( Qt::CursorShape cursor )
{ {
setCursor ( cursor ); setCursor ( cursor );
@ -181,18 +198,33 @@ namespace Hurricane {
if ( _cell ) { if ( _cell ) {
Box redrawBox = displayToDbuBox ( redrawArea ); Box redrawBox = displayToDbuBox ( redrawArea );
vector<PaletteEntry*>& paletteEntries = _palette->getEntries (); for_each_basic_layer ( basicLayer, _technology->getBasicLayers() ) {
for ( size_t i=0 ; i<paletteEntries.size() ; i++ ) { _drawingPainter.setPen ( Graphics::getPen (basicLayer->getName()) );
_drawingPainter.setPen ( Graphics::getPen (paletteEntries[i]->getName()) ); _drawingPainter.setBrush ( Graphics::getBrush(basicLayer->getName()) );
_drawingPainter.setBrush ( Graphics::getBrush(paletteEntries[i]->getName()) );
if ( paletteEntries[i]->isBasicLayer() && isDrawable(paletteEntries[i]) ) { if ( isDrawable(basicLayer->getName()) )
drawCell ( _cell, paletteEntries[i]->getBasicLayer(), redrawBox, Transformation() ); drawCell ( _cell, basicLayer, redrawBox, Transformation() );
} else if ( (paletteEntries[i]->getName() == DisplayStyle::Boundaries) end_for;
&& paletteEntries[i]->isChecked() ) {
drawBoundaries ( _cell, redrawBox, Transformation() );
}
} }
if ( isDrawable("boundaries") ) {
_drawingPainter.setPen ( Graphics::getPen ("boundaries") );
_drawingPainter.setBrush ( Graphics::getBrush("boundaries") );
drawBoundaries ( _cell, redrawBox, Transformation() );
}
// vector<HPaletteEntry*>& paletteEntries = _palette->getEntries ();
// for ( size_t i=0 ; i<paletteEntries.size() ; i++ ) {
// _drawingPainter.setPen ( Graphics::getPen (paletteEntries[i]->getName()) );
// _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 (); _drawingPainter.end ();
@ -232,10 +264,12 @@ namespace Hurricane {
} }
bool CellWidget::isDrawable ( PaletteEntry* entry ) bool CellWidget::isDrawable ( const Name& entryName )
{ {
return entry->isChecked() HPaletteEntry* entry = (_palette) ? _palette->find(entryName) : NULL;
&& ( Graphics::getThreshold(entry->getName())/DbU::lambda(1.0) < _scale );
return (!entry || entry->isChecked())
&& ( Graphics::getThreshold(entryName)/DbU::lambda(1.0) < _scale );
} }
@ -648,8 +682,8 @@ namespace Hurricane {
copyToScreen (); copyToScreen ();
if ( isDrawable(_palette->find("grid")) ) drawGrid (); if ( isDrawable("grid") ) drawGrid ();
if ( isDrawable(_palette->find("spot")) ) _spot.moveTo ( _lastMousePosition ); if ( isDrawable("spot") ) _spot.moveTo ( _lastMousePosition );
_screenPainter.end (); _screenPainter.end ();
} }
@ -720,11 +754,8 @@ namespace Hurricane {
_lastMousePosition = event->pos(); _lastMousePosition = event->pos();
} else { } else {
//cerr << "x:" << event->x() << " y:" << event->y() << endl;
_xPosition->setDynamicText ( screenToDbuX(event->x()) );
_yPosition->setDynamicText ( screenToDbuY(event->y()) );
_lastMousePosition = event->pos(); _lastMousePosition = event->pos();
emit mousePositionChanged ( screenToDbuPoint(event->pos()) );
update (); update ();
} }

View File

@ -7,14 +7,14 @@
# include "hurricane/viewer/Graphics.h" # include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/GroupPaletteEntry.h" # include "hurricane/viewer/GroupPaletteEntry.h"
# include "hurricane/viewer/Palette.h" # include "hurricane/viewer/HPalette.h"
namespace Hurricane { namespace Hurricane {
GroupPaletteEntry::GroupPaletteEntry ( Palette* palette, const Name& name ) GroupPaletteEntry::GroupPaletteEntry ( HPalette* palette, const Name& name )
: PaletteEntry(palette) : HPaletteEntry(palette)
, _name(name) , _name(name)
, _button(NULL) , _button(NULL)
, _index(0) , _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 ); GroupPaletteEntry* entry = new GroupPaletteEntry ( palette, name );
@ -103,7 +103,7 @@ namespace Hurricane {
void GroupPaletteEntry::hideShow () void GroupPaletteEntry::hideShow ()
{ {
vector<PaletteEntry*> entries = _palette->getEntries (); vector<HPaletteEntry*> entries = _palette->getEntries ();
if ( entries[_index] != this ) if ( entries[_index] != this )
cerr << "[ERROR] Incoherent index for group \"" << getString(getName()) << "\"." << endl; cerr << "[ERROR] Incoherent index for group \"" << getString(getName()) << "\"." << endl;

View File

@ -16,11 +16,11 @@
# include "hurricane/BasicLayers.h" # include "hurricane/BasicLayers.h"
# include "hurricane/viewer/Graphics.h" # include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/PaletteEntry.h" # include "hurricane/viewer/HPaletteEntry.h"
# include "hurricane/viewer/LayerPaletteEntry.h" # include "hurricane/viewer/LayerPaletteEntry.h"
# include "hurricane/viewer/GroupPaletteEntry.h" # include "hurricane/viewer/GroupPaletteEntry.h"
# include "hurricane/viewer/ViewerPaletteEntry.h" # include "hurricane/viewer/ViewerPaletteEntry.h"
# include "hurricane/viewer/Palette.h" # include "hurricane/viewer/HPalette.h"
# include "hurricane/viewer/CellWidget.h" # include "hurricane/viewer/CellWidget.h"
@ -28,11 +28,10 @@ namespace Hurricane {
Palette::Palette ( CellWidget* cellWidget ) : QScrollArea() HPalette::HPalette ( QWidget* parent ) : QScrollArea(parent)
, _cellWidget(cellWidget) , _entries()
, _entries() , _showAll(NULL)
, _showAll(NULL) , _hideAll(NULL)
, _hideAll(NULL)
{ {
setWidgetResizable ( true ); setWidgetResizable ( true );
@ -135,7 +134,7 @@ namespace Hurricane {
} }
bool Palette::isDrawable ( size_t index ) bool HPalette::isDrawable ( size_t index )
{ {
if ( index < _entries.size() ) if ( index < _entries.size() )
return _entries[index]->isChecked (); 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++ ) for ( size_t i=0 ; i<_entries.size() ; i++ )
if ( !_entries[i]->isGroup() ) if ( !_entries[i]->isGroup() )
_entries[i]->setChecked ( true ); _entries[i]->setChecked ( true );
_cellWidget->redraw (); emit paletteChanged();
} }
void Palette::hideAll () void HPalette::hideAll ()
{ {
for ( size_t i=0 ; i<_entries.size() ; i++ ) for ( size_t i=0 ; i<_entries.size() ; i++ )
if ( !_entries[i]->isGroup() ) if ( !_entries[i]->isGroup() )
_entries[i]->setChecked ( false ); _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++ ) { for ( size_t i=0 ; i<_entries.size() ; i++ ) {
if ( _entries[i]->getName() == name ) if ( _entries[i]->getName() == name )

View File

@ -5,13 +5,13 @@
# include <QPainter> # include <QPainter>
# include "hurricane/viewer/Graphics.h" # include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/PaletteEntry.h" # include "hurricane/viewer/HPaletteEntry.h"
namespace Hurricane { namespace Hurricane {
PaletteSample::PaletteSample ( PaletteEntry* entry ) HPaletteSample::HPaletteSample ( HPaletteEntry* entry )
: QWidget() : QWidget()
, _sample(QSize(20,20)) , _sample(QSize(20,20))
, _entry(entry) , _entry(entry)
@ -24,7 +24,7 @@ namespace Hurricane {
} }
void PaletteSample::redraw () void HPaletteSample::redraw ()
{ {
QPainter painter ( &_sample ); QPainter painter ( &_sample );
@ -37,14 +37,14 @@ namespace Hurricane {
} }
void PaletteSample::paintEvent ( QPaintEvent* ) void HPaletteSample::paintEvent ( QPaintEvent* )
{ {
QPainter painter ( this ); QPainter painter ( this );
painter.drawPixmap ( 0, 0, _sample ); painter.drawPixmap ( 0, 0, _sample );
} }
PaletteEntry::PaletteEntry ( Palette* palette ) HPaletteEntry::HPaletteEntry ( HPalette* palette )
: QWidget() : QWidget()
, _palette(palette) , _palette(palette)
{ {

View File

@ -9,20 +9,20 @@
# include "hurricane/viewer/Graphics.h" # include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/LayerPaletteEntry.h" # include "hurricane/viewer/LayerPaletteEntry.h"
# include "hurricane/viewer/Palette.h" # include "hurricane/viewer/HPalette.h"
namespace Hurricane { namespace Hurricane {
LayerPaletteEntry::LayerPaletteEntry ( Palette* entry, BasicLayer* basicLayer ) LayerPaletteEntry::LayerPaletteEntry ( HPalette* entry, BasicLayer* basicLayer )
: PaletteEntry(entry) : HPaletteEntry(entry)
, _basicLayer(basicLayer) , _basicLayer(basicLayer)
{ {
} }
LayerPaletteEntry* LayerPaletteEntry::create ( Palette* palette, BasicLayer* basicLayer ) LayerPaletteEntry* LayerPaletteEntry::create ( HPalette* palette, BasicLayer* basicLayer )
{ {
LayerPaletteEntry* entry = new LayerPaletteEntry ( palette, basicLayer ); LayerPaletteEntry* entry = new LayerPaletteEntry ( palette, basicLayer );
@ -37,7 +37,7 @@ namespace Hurricane {
QHBoxLayout* layout = new QHBoxLayout (); QHBoxLayout* layout = new QHBoxLayout ();
layout->setContentsMargins ( 0, 0, 0, 0 ); layout->setContentsMargins ( 0, 0, 0, 0 );
layout->addWidget ( new PaletteSample(this) ); layout->addWidget ( new HPaletteSample(this) );
_checkBox = new QCheckBox ( this ); _checkBox = new QCheckBox ( this );
_checkBox->setChecked ( true ); _checkBox->setChecked ( true );

View File

@ -9,20 +9,20 @@
# include "hurricane/viewer/Graphics.h" # include "hurricane/viewer/Graphics.h"
# include "hurricane/viewer/ViewerPaletteEntry.h" # include "hurricane/viewer/ViewerPaletteEntry.h"
# include "hurricane/viewer/Palette.h" # include "hurricane/viewer/HPalette.h"
namespace Hurricane { namespace Hurricane {
ViewerPaletteEntry::ViewerPaletteEntry ( Palette* entry, const Name& name ) ViewerPaletteEntry::ViewerPaletteEntry ( HPalette* entry, const Name& name )
: PaletteEntry(entry) : HPaletteEntry(entry)
, _name(name) , _name(name)
{ {
} }
ViewerPaletteEntry* ViewerPaletteEntry::create ( Palette* palette, const Name& name ) ViewerPaletteEntry* ViewerPaletteEntry::create ( HPalette* palette, const Name& name )
{ {
ViewerPaletteEntry* entry = new ViewerPaletteEntry ( palette, name ); ViewerPaletteEntry* entry = new ViewerPaletteEntry ( palette, name );
@ -37,7 +37,7 @@ namespace Hurricane {
QHBoxLayout* layout = new QHBoxLayout (); QHBoxLayout* layout = new QHBoxLayout ();
layout->setContentsMargins ( 0, 0, 0, 0 ); layout->setContentsMargins ( 0, 0, 0, 0 );
layout->addWidget ( new PaletteSample(this) ); layout->addWidget ( new HPaletteSample(this) );
_checkBox = new QCheckBox ( this ); _checkBox = new QCheckBox ( this );
_checkBox->setChecked ( true ); _checkBox->setChecked ( true );

View File

@ -23,44 +23,46 @@ namespace Hurricane {
class Cell; class Cell;
class Palette; class HPalette;
//class MapView; //class MapView;
class CellWidget; class CellWidget;
class HMousePosition;
class CellViewer : public QMainWindow { class CellViewer : public QMainWindow {
Q_OBJECT; Q_OBJECT;
public: public:
CellViewer ( QWidget* parent=NULL ); CellViewer ( QWidget* parent=NULL );
void setCell ( Cell* cell ); void setCell ( Cell* cell );
public slots: public slots:
void runInspectorOnDataBase (); void runInspectorOnDataBase ();
void runInspectorOnCell (); void runInspectorOnCell ();
protected: protected:
QAction* _openAction; QAction* _openAction;
QAction* _nextCellAction; QAction* _nextCellAction;
QAction* _previousCellAction; QAction* _previousCellAction;
QAction* _nextAction; QAction* _nextAction;
QAction* _saveAction; QAction* _saveAction;
QAction* _exitAction; QAction* _exitAction;
QAction* _refreshAction; QAction* _refreshAction;
QAction* _fitToContentsAction; QAction* _fitToContentsAction;
QAction* _runInspectorOnDataBase; QAction* _runInspectorOnDataBase;
QAction* _runInspectorOnCell; QAction* _runInspectorOnCell;
QMenu* _fileMenu; QMenu* _fileMenu;
QMenu* _viewMenu; QMenu* _viewMenu;
QMenu* _toolsMenu; QMenu* _toolsMenu;
//MapView* _mapView; //MapView* _mapView;
Palette* _palette; HPalette* _palette;
CellWidget* _cellWidget; HMousePosition* _mousePosition;
CellWidget* _cellWidget;
protected: protected:
void createActions (); void createActions ();
void createMenus (); void createMenus ();
void createLayout (); void createLayout ();
void runInspector ( Record* record ); void runInspector ( Record* record );
}; };

View File

@ -20,7 +20,6 @@ class QResizeEvent;
class QMouseEvent; class QMouseEvent;
class QKeyEvent; class QKeyEvent;
class QAction; class QAction;
class QStatusBar;
# include "hurricane/Commons.h" # include "hurricane/Commons.h"
@ -35,6 +34,7 @@ class QStatusBar;
namespace Hurricane { namespace Hurricane {
class Technology;
class BasicLayer; class BasicLayer;
class Go; class Go;
class Cell; class Cell;
@ -44,9 +44,8 @@ namespace Hurricane {
class Contact; class Contact;
class Pad; class Pad;
class PaletteEntry; class HPaletteEntry;
class Palette; class HPalette;
class DynamicLabel;
//class MapView; //class MapView;
@ -55,79 +54,82 @@ namespace Hurricane {
public: public:
// Constructor & Destructor. // Constructor & Destructor.
CellWidget ( QWidget* parent=NULL ); CellWidget ( QWidget* parent=NULL );
virtual ~CellWidget (); virtual ~CellWidget ();
// Accessors. // Accessors.
// MapView* getMapView () { return _mapView; }; // MapView* getMapView () { return _mapView; };
void setCell ( Cell* cell ); void setCell ( Cell* cell );
inline Cell* getCell () const; inline Cell* getCell () const;
inline Palette* getPalette (); inline HPalette* getPalette ();
inline QStatusBar* getStatusBar (); void bindToPalette ( HPalette* palette );
inline bool showBoundaries () const; void detachFromPalette ();
inline bool showBoundaries () const;
// Painter control & Hurricane objects drawing primitives. // Painter control & Hurricane objects drawing primitives.
void drawBoundaries ( const Cell* , const Box&, const Transformation& ); void drawBoundaries ( const Cell* , const Box&, const Transformation& );
void drawBoundaries ( const Instance*, const Box&, const Transformation& ); void drawBoundaries ( const Instance*, const Box&, const Transformation& );
bool isDrawable ( PaletteEntry* entry ); bool isDrawable ( const Name& entryName );
void drawCell ( const Cell* , const BasicLayer*, const Box&, const Transformation& ); void drawCell ( const Cell* , const BasicLayer*, const Box&, const Transformation& );
void drawInstance ( const Instance*, 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 drawSlice ( const Slice* , const BasicLayer*, const Box&, const Transformation& );
void drawGo ( const Go* , 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 drawSegment ( const Segment* , const BasicLayer*, const Box&, const Transformation& );
void drawContact ( const Contact* , 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 drawPad ( const Pad* , const BasicLayer*, const Box&, const Transformation& );
void drawBox ( const Box& ); void drawBox ( const Box& );
void drawLine ( const Point&, const Point& ); void drawLine ( const Point&, const Point& );
void drawGrid (); void drawGrid ();
void drawSpot (); void drawSpot ();
// Geometric conversions. // Geometric conversions.
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const; QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
QRect dbuToDisplayRect ( const Box& box ) const; QRect dbuToDisplayRect ( const Box& box ) const;
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const; QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
QPoint dbuToDisplayPoint ( const Point& point ) const; QPoint dbuToDisplayPoint ( const Point& point ) const;
inline int dbuToDisplayX ( DbU::Unit x ) const; inline int dbuToDisplayX ( DbU::Unit x ) const;
inline int dbuToDisplayY ( DbU::Unit y ) const; inline int dbuToDisplayY ( DbU::Unit y ) const;
inline int dbuToDisplayLength ( DbU::Unit length ) const; inline int dbuToDisplayLength ( DbU::Unit length ) const;
inline int dbuToScreenX ( DbU::Unit x ) const; inline int dbuToScreenX ( DbU::Unit x ) const;
inline int dbuToScreenY ( DbU::Unit y ) const; inline int dbuToScreenY ( DbU::Unit y ) const;
QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const; QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
inline QPoint dbuToScreenPoint ( const Point& point ) const; inline QPoint dbuToScreenPoint ( const Point& point ) const;
inline DbU::Unit displayToDbuX ( int x ) const; inline DbU::Unit displayToDbuX ( int x ) const;
inline DbU::Unit displayToDbuY ( int y ) const; inline DbU::Unit displayToDbuY ( int y ) const;
inline DbU::Unit displayToDbuLength ( int length ) const; inline DbU::Unit displayToDbuLength ( int length ) const;
inline Box displayToDbuBox ( const QRect& rect ) const; inline Box displayToDbuBox ( const QRect& rect ) const;
inline DbU::Unit screenToDbuX ( int x ) const; inline DbU::Unit screenToDbuX ( int x ) const;
inline DbU::Unit screenToDbuY ( int y ) const; inline DbU::Unit screenToDbuY ( int y ) const;
inline Point screenToDbuPoint ( const QPoint& point ) const; inline Point screenToDbuPoint ( const QPoint& point ) const;
// Qt QWidget Functions Overloads. // Qt QWidget Functions Overloads.
void pushCursor ( Qt::CursorShape cursor ); void pushCursor ( Qt::CursorShape cursor );
void popCursor (); void popCursor ();
QSize minimumSizeHint () const; QSize minimumSizeHint () const;
void paintEvent ( QPaintEvent* ); void paintEvent ( QPaintEvent* );
void resizeEvent ( QResizeEvent* ); void resizeEvent ( QResizeEvent* );
void keyPressEvent ( QKeyEvent* ); void keyPressEvent ( QKeyEvent* );
void mouseMoveEvent ( QMouseEvent* ); void mouseMoveEvent ( QMouseEvent* );
void mousePressEvent ( QMouseEvent* ); void mousePressEvent ( QMouseEvent* );
void mouseReleaseEvent ( QMouseEvent* ); void mouseReleaseEvent ( QMouseEvent* );
signals:
void mousePositionChanged ( const Point& position );
public slots: public slots:
// Qt QWidget Slots Overload & CellWidget Specifics. // Qt QWidget Slots Overload & CellWidget Specifics.
inline QPainter& getScreenPainter (); inline QPainter& getScreenPainter ();
void redraw ( QRect redrawArea ); void redraw ( QRect redrawArea );
inline void redraw (); inline void redraw ();
inline void copyToScreen ( int sx, int sy, int h, int w ); inline void copyToScreen ( int sx, int sy, int h, int w );
inline void copyToScreen (); inline void copyToScreen ();
void goLeft ( int dx = 0 ); void goLeft ( int dx = 0 );
void goRight ( int dx = 0 ); void goRight ( int dx = 0 );
void goUp ( int dy = 0 ); void goUp ( int dy = 0 );
void goDown ( int dy = 0 ); void goDown ( int dy = 0 );
void fitToContents (); void fitToContents ();
void setScale ( float scale ); void setScale ( float scale );
void setShowBoundaries ( bool state ); void setShowBoundaries ( bool state );
void reframe ( const Box& box ); void reframe ( const Box& box );
void displayReframe (); void displayReframe ();
void shiftLeft ( int dx ); void shiftLeft ( int dx );
void shiftRight ( int dx ); void shiftRight ( int dx );
void shiftUp ( int dy ); void shiftUp ( int dy );
void shiftDown ( int dy ); void shiftDown ( int dy );
private: private:
class Spot { class Spot {
@ -146,11 +148,9 @@ namespace Hurricane {
// Internal: Attributes. // Internal: Attributes.
static const int _stripWidth; static const int _stripWidth;
vector<Qt::CursorShape> _cursors; vector<Qt::CursorShape> _cursors;
QStatusBar* _statusBar;
// MapView* _mapView; // MapView* _mapView;
Palette* _palette; Technology* _technology;
DynamicLabel* _xPosition; HPalette* _palette;
DynamicLabel* _yPosition;
Box _displayArea; Box _displayArea;
Box _visibleArea; Box _visibleArea;
float _scale; float _scale;
@ -247,14 +247,10 @@ inline Cell* CellWidget::getCell () const
{ return _cell; } { return _cell; }
inline Palette* CellWidget::getPalette () inline HPalette* CellWidget::getPalette ()
{ return _palette; } { return _palette; }
inline QStatusBar* CellWidget::getStatusBar ()
{ return _statusBar; }
inline bool CellWidget::showBoundaries () const inline bool CellWidget::showBoundaries () const
{ return _showBoundaries; } { return _showBoundaries; }

View File

@ -38,7 +38,6 @@ namespace Hurricane {
// Internal - Constructor. // Internal - Constructor.
DynamicLabel ( const DynamicLabel& ); DynamicLabel ( const DynamicLabel& );
DynamicLabel& operator= ( const DynamicLabel& ); DynamicLabel& operator= ( const DynamicLabel& );
}; };

View File

@ -2,26 +2,26 @@
// -*- C++ -*- // -*- C++ -*-
# ifndef __GROUP_PALETTE_ENTRY_H__ # ifndef __GROUP_HPALETTE_ENTRY_H__
# define __GROUP_PALETTE_ENTRY_H__ # define __GROUP_HPALETTE_ENTRY_H__
class QPushButton; class QPushButton;
# include "hurricane/Name.h" # include "hurricane/Name.h"
# include "hurricane/viewer/PaletteEntry.h" # include "hurricane/viewer/HPaletteEntry.h"
namespace Hurricane { namespace Hurricane {
class GroupPaletteEntry : public PaletteEntry { class GroupPaletteEntry : public HPaletteEntry {
Q_OBJECT; Q_OBJECT;
// Constructor. // Constructor.
public: public:
static GroupPaletteEntry* create ( Palette* palette, const Name& name ); static GroupPaletteEntry* create ( HPalette* palette, const Name& name );
// Methods. // Methods.
public: public:
@ -44,7 +44,7 @@ namespace Hurricane {
bool _expanded; bool _expanded;
// Internal - Constructor. // Internal - Constructor.
GroupPaletteEntry ( Palette* palette, const Name& name ); GroupPaletteEntry ( HPalette* palette, const Name& name );
GroupPaletteEntry ( const GroupPaletteEntry& ); GroupPaletteEntry ( const GroupPaletteEntry& );
GroupPaletteEntry& operator= ( const GroupPaletteEntry& ); GroupPaletteEntry& operator= ( const GroupPaletteEntry& );
virtual void _postCreate (); virtual void _postCreate ();

View File

@ -0,0 +1,71 @@
// -*- C++ -*-
# ifndef __HPALETTE__
# define __HPALETTE__
# include <vector>
# include <QWidget>
# include <QScrollArea>
# include <QPixmap>
# 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<HPaletteEntry*>& getEntries ();
void redrawCellWidget ();
HPaletteEntry* find ( const Name& name );
signals:
// Signals.
void paletteChanged ();
public slots:
// Slots.
void showAll ();
void hideAll ();
protected:
// Internal - Attributes.
vector<HPaletteEntry*> _entries;
QPushButton* _showAll;
QPushButton* _hideAll;
// Internal - Constructors.
HPalette ( const HPalette& );
HPalette& operator= ( const HPalette& );
};
// Inline Functions.
inline vector<HPaletteEntry*>& HPalette::getEntries () { return _entries; }
} // End of Hurricane namespace.
# endif

View File

@ -20,21 +20,21 @@ namespace Hurricane {
class Name; class Name;
class BasicLayer; class BasicLayer;
class Palette; class HPalette;
class PaletteEntry; class HPaletteEntry;
class PaletteSample : public QWidget { class HPaletteSample : public QWidget {
Q_OBJECT; Q_OBJECT;
// Constructor. // Constructor.
public: public:
PaletteSample ( PaletteEntry* entry ); HPaletteSample ( HPaletteEntry* entry );
// Internals - Attributes. // Internals - Attributes.
protected: protected:
QPixmap _sample; QPixmap _sample;
PaletteEntry* _entry; HPaletteEntry* _entry;
// Internals - Methods. // Internals - Methods.
void redraw (); void redraw ();
@ -43,7 +43,7 @@ namespace Hurricane {
}; };
class PaletteEntry : public QWidget { class HPaletteEntry : public QWidget {
Q_OBJECT; Q_OBJECT;
// Methods. // Methods.
@ -61,13 +61,13 @@ namespace Hurricane {
// Internal - Attributes. // Internal - Attributes.
protected: protected:
Palette* _palette; HPalette* _palette;
// Internal - Constructor. // Internal - Constructor.
PaletteEntry ( Palette* palette ); HPaletteEntry ( HPalette* palette );
PaletteEntry ( const PaletteEntry& ); HPaletteEntry ( const HPaletteEntry& );
PaletteEntry& operator= ( const PaletteEntry& ); HPaletteEntry& operator= ( const HPaletteEntry& );
virtual void _postCreate () = 0; virtual void _postCreate () = 0;
}; };

View File

@ -8,18 +8,18 @@
class QCheckBox; class QCheckBox;
# include "hurricane/viewer/PaletteEntry.h" # include "hurricane/viewer/HPaletteEntry.h"
namespace Hurricane { namespace Hurricane {
class LayerPaletteEntry : public PaletteEntry { class LayerPaletteEntry : public HPaletteEntry {
Q_OBJECT; Q_OBJECT;
// Constructor. // Constructor.
public: public:
static LayerPaletteEntry* create ( Palette* palette, BasicLayer* basicLayer ); static LayerPaletteEntry* create ( HPalette* palette, BasicLayer* basicLayer );
// Methods. // Methods.
public: public:
@ -40,7 +40,7 @@ namespace Hurricane {
QCheckBox* _checkBox; QCheckBox* _checkBox;
// Internal - Constructor. // Internal - Constructor.
LayerPaletteEntry ( Palette* palette, BasicLayer* basicLayer ); LayerPaletteEntry ( HPalette* palette, BasicLayer* basicLayer );
LayerPaletteEntry ( const LayerPaletteEntry& ); LayerPaletteEntry ( const LayerPaletteEntry& );
LayerPaletteEntry& operator= ( const LayerPaletteEntry& ); LayerPaletteEntry& operator= ( const LayerPaletteEntry& );
virtual void _postCreate (); virtual void _postCreate ();

View File

@ -1,70 +0,0 @@
// -*- C++ -*-
# ifndef __PALETTE__
# define __PALETTE__
# include <vector>
# include <QWidget>
# include <QScrollArea>
# include <QPixmap>
# 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<PaletteEntry*>& getEntries ();
void redrawCellWidget ();
PaletteEntry* find ( const Name& name );
// Slots.
public slots:
void showAll ();
void hideAll ();
// Internal - Attributes.
protected:
CellWidget* _cellWidget;
vector<PaletteEntry*> _entries;
QPushButton* _showAll;
QPushButton* _hideAll;
// Internal - Constructors.
Palette ( const Palette& );
Palette& operator= ( const Palette& );
};
// Inline Functions.
inline CellWidget* Palette::getCellWidget () { return _cellWidget; }
inline vector<PaletteEntry*>& Palette::getEntries () { return _entries; }
} // End of Hurricane namespace.
# endif

View File

@ -9,18 +9,18 @@
class QCheckBox; class QCheckBox;
# include "hurricane/Name.h" # include "hurricane/Name.h"
# include "hurricane/viewer/PaletteEntry.h" # include "hurricane/viewer/HPaletteEntry.h"
namespace Hurricane { namespace Hurricane {
class ViewerPaletteEntry : public PaletteEntry { class ViewerPaletteEntry : public HPaletteEntry {
Q_OBJECT; Q_OBJECT;
// Constructor. // Constructor.
public: public:
static ViewerPaletteEntry* create ( Palette* palette, const Name& name ); static ViewerPaletteEntry* create ( HPalette* palette, const Name& name );
// Methods. // Methods.
public: public:
@ -41,7 +41,7 @@ namespace Hurricane {
QCheckBox* _checkBox; QCheckBox* _checkBox;
// Internal - Constructor. // Internal - Constructor.
ViewerPaletteEntry ( Palette* palette, const Name& name ); ViewerPaletteEntry ( HPalette* palette, const Name& name );
ViewerPaletteEntry ( const ViewerPaletteEntry& ); ViewerPaletteEntry ( const ViewerPaletteEntry& );
ViewerPaletteEntry& operator= ( const ViewerPaletteEntry& ); ViewerPaletteEntry& operator= ( const ViewerPaletteEntry& );
virtual void _postCreate (); virtual void _postCreate ();