diff --git a/hurricane/src/hurricane/CMakeLists.txt b/hurricane/src/hurricane/CMakeLists.txt index 5adfb26b..19c05b10 100644 --- a/hurricane/src/hurricane/CMakeLists.txt +++ b/hurricane/src/hurricane/CMakeLists.txt @@ -51,6 +51,7 @@ hurricane/Properties.h hurricane/Property.h hurricane/QuadTree.h hurricane/Quark.h hurricane/Quarks.h + hurricane/Query.h hurricane/Record.h hurricane/Reference.h hurricane/References.h hurricane/Region.h @@ -137,6 +138,7 @@ Slice.cpp UpdateSession.cpp Region.cpp + Query.cpp DisplaySlot.cpp Marker.cpp Timer.cpp diff --git a/hurricane/src/hurricane/Query.cpp b/hurricane/src/hurricane/Query.cpp new file mode 100644 index 00000000..cc5dd3e9 --- /dev/null +++ b/hurricane/src/hurricane/Query.cpp @@ -0,0 +1,165 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// Main contributors : +// Christophe Alexandre +// Sophie Belloeil +// Hugo Clément +// Jean-Paul Chaput +// Damien Dupuis +// Christian Masson +// Marek Sroka +// +// The Coriolis Project is free software; you can redistribute it +// and/or modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// The Coriolis Project is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with the Coriolis Project; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA +// +// License-Tag +// Authors-Tag +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./Query.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include + +#include "hurricane/BasicLayer.h" +#include "hurricane/Slice.h" +#include "hurricane/Cell.h" +#include "hurricane/Instance.h" +#include "hurricane/Query.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Slave Class : "QueryState". + + +// ------------------------------------------------------------------- +// Class : "QueryStack". + + + QueryStack::QueryStack () + : vector() + //, _tab(" ") + , _topCell(NULL) + , _topArea() + , _topTransformation() + , _startLevel(0) + , _stopLevel(UINT_MAX) + { } + + + QueryStack::~QueryStack () + { + for ( size_t i=0 ; igetSlices() ) { + if ( !(*islice)->getLayer()->contains(getBasicLayer()) ) continue; + if ( !(*islice)->getBoundingBox().intersect(getArea()) ) continue; + + forEach ( Go*, igo, (*islice)->getGosUnder(_stack.getArea()) ) + goCallback ( *igo ); + } + } + + if ( (_filter & DoMasterCells) && hasMasterCellCallback() ) + masterCellCallback (); + + _stack.progress (); + } // End of while. + } + + + bool Query::hasGoCallback () const + { + return false; + } + + + bool Query::hasMasterCellCallback () const + { + return false; + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/BasicLayer.h b/hurricane/src/hurricane/hurricane/BasicLayer.h index b988c669..98f3f9b7 100644 --- a/hurricane/src/hurricane/hurricane/BasicLayer.h +++ b/hurricane/src/hurricane/hurricane/BasicLayer.h @@ -95,8 +95,6 @@ namespace Hurricane { virtual string _getString () const; virtual Record* _getRecord () const; - - private: // Internal: Attributes Material _material; diff --git a/hurricane/src/hurricane/hurricane/Collection.h b/hurricane/src/hurricane/hurricane/Collection.h index 88779d4a..45f9a49e 100644 --- a/hurricane/src/hurricane/hurricane/Collection.h +++ b/hurricane/src/hurricane/hurricane/Collection.h @@ -813,6 +813,61 @@ template class SubSetCollection : public Collection { _locator->progress(); +// ------------------------------------------------------------------- +// Template Class : "ForEachIterator" + + +template +class ForEachIterator { + public: + inline ForEachIterator ( GenericCollection coll ); + inline bool isValid (); + inline Element operator* (); + inline ForEachIterator& operator++ (int); + public: + GenericCollection& collection; + GenericLocator locator; + Element element; +}; + + +template +inline ForEachIterator::ForEachIterator ( GenericCollection coll ) + : collection(coll) + , locator(collection.getLocator()) + , element() +{ + if ( locator.isValid() ) element = locator.getElement(); +} + + +template< typename Element > +inline bool ForEachIterator::isValid () +{ + if ( locator.isValid() ) element = locator.getElement(); + return locator.isValid(); +} + + +template< typename Element > +inline Element ForEachIterator::operator* () +{ + return element; +} + + +template< typename Element > +inline ForEachIterator& ForEachIterator::operator++ (int) +{ + locator.progress (); + return *this; +} + + +#define forEach(type,iterator,collection) \ + for ( ForEachIterator iterator(collection); iterator.isValid() ; iterator++ ) + + } // End of Hurricane namespace. @@ -842,6 +897,9 @@ template inline Hurricane::Record* getRecord ( const Hurricane::C #include "hurricane/ListCollection.h" #include "hurricane/VectorCollection.h" + + + #endif // HURRICANE_COLLECTION // **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/Nets.h b/hurricane/src/hurricane/hurricane/Nets.h index 805d528f..b6e8a59d 100644 --- a/hurricane/src/hurricane/hurricane/Nets.h +++ b/hurricane/src/hurricane/hurricane/Nets.h @@ -51,6 +51,9 @@ typedef GenericFilter NetFilter; Net* net = _locator.getElement();\ _locator.progress(); +#define forEachNet(iterator,collection) forEach(Net*,iterator,collection) + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/Query.h b/hurricane/src/hurricane/hurricane/Query.h new file mode 100644 index 00000000..76cb92f9 --- /dev/null +++ b/hurricane/src/hurricane/hurricane/Query.h @@ -0,0 +1,378 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// Main contributors : +// Christophe Alexandre +// Sophie Belloeil +// Hugo Clément +// Jean-Paul Chaput +// Damien Dupuis +// Christian Masson +// Marek Sroka +// +// The Coriolis Project is free software; you can redistribute it +// and/or modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// The Coriolis Project is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with the Coriolis Project; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA +// +// License-Tag +// Authors-Tag +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./Query.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __QUERY_H__ +#define __QUERY_H__ + + +#include + +#include "hurricane/Commons.h" +#include "hurricane/Box.h" +#include "hurricane/Transformation.h" +#include "hurricane/Cell.h" +#include "hurricane/Instance.h" + + +namespace Hurricane { + + + class BasicLayer; + class Go; + class QueryStack; + + +// ------------------------------------------------------------------- +// Slave Class : "QueryState". + + + class QueryState { + private: + inline QueryState ( Locator* locator ); + inline QueryState ( Locator* locator + , const Box& area + , const Transformation& transformation + ); + QueryState ( const QueryState& ); + QueryState& operator= ( const QueryState& ); + inline ~QueryState (); + private: + Locator* _locator; + Box _area; + Transformation _transformation; + + friend class QueryStack; + }; + + +// QueryState Inline Functions. + + + inline QueryState::QueryState ( Locator* locator ) + : _locator(locator) + , _area() + , _transformation() + { } + + + inline QueryState::QueryState ( Locator* locator + , const Box& area + , const Transformation& transformation + ) + : _locator(locator) + , _area(area) + , _transformation(transformation) + { } + + + inline QueryState::~QueryState () + { + if ( _locator ) delete _locator; + } + + +// ------------------------------------------------------------------- +// Class : "QueryStack". + + + class QueryStack : public vector { + public: + // Constructor & destructor. + QueryStack (); + ~QueryStack (); + // Accessors. + inline Cell* getTopCell (); + inline const Box& getTopArea () const; + inline const Transformation& getTopTransformation () const; + inline unsigned int getStartLevel () const; + inline unsigned int getStopLevel () const; + inline Cell* getMasterCell (); + inline Instance* getInstance (); + inline const Box& getArea () const; + inline const Transformation& getTransformation () const; + //inline const Tabulation& getTab () const; + // Modifiers. + inline void setTopCell ( Cell* cell ); + inline void setTopArea ( const Box& area ); + inline void setTopTransformation ( const Transformation& transformation ); + inline void setStartLevel ( unsigned int level ); + inline void setStopLevel ( unsigned int level ); + inline void init (); + inline void updateTransformation (); + inline bool levelDown (); + inline void levelUp (); + inline void levelProgress (); + inline bool levelCompleted (); + inline void progress ( bool init=false ); + + protected: + // Internal: Attributes. + // Tabulation _tab; + Cell* _topCell; + Box _topArea; + Transformation _topTransformation; + unsigned int _startLevel; + unsigned int _stopLevel; + + private: + // Internal: Constructors. + QueryStack ( const QueryStack& ); + QueryStack& operator= ( const QueryStack& ); + }; + + +// QueryStack Inline Functions. + + + inline Cell* QueryStack::getTopCell () { return _topCell; } + inline const Box& QueryStack::getTopArea () const { return _topArea; } + inline const Transformation& QueryStack::getTopTransformation () const { return _topTransformation; } + inline unsigned int QueryStack::getStartLevel () const { return _startLevel; } + inline unsigned int QueryStack::getStopLevel () const { return _stopLevel; } + inline const Box& QueryStack::getArea () const { return back()->_area; } + inline const Transformation& QueryStack::getTransformation () const { return back()->_transformation; } +//inline const Tabulation& QueryStack::getTab () const { return _tab; } + + + inline Instance* QueryStack::getInstance () + { + if ( levelCompleted() ) return NULL; + return back()->_locator->getElement(); + } + + + inline Cell* QueryStack::getMasterCell () + { + if ( size() == 1 ) return _topCell; + if ( !getInstance() ) return NULL; + return getInstance()->getMasterCell(); + } + + + inline void QueryStack::setTopCell ( Cell* cell ) { _topCell = cell; } + inline void QueryStack::setTopArea ( const Box& area ) { _topArea = area; } + inline void QueryStack::setTopTransformation ( const Transformation& transformation ) { _topTransformation = transformation; } + inline void QueryStack::setStartLevel ( unsigned int level ) { _startLevel = level; } + inline void QueryStack::setStopLevel ( unsigned int level ) { _stopLevel = level; } + + + inline void QueryStack::init () + { + while ( !empty() ) levelUp(); + + push_back ( new QueryState(NULL,_topArea,_topTransformation) ); + //_tab++; + + progress ( true ); + } + + + inline void QueryStack::updateTransformation () + { + QueryState* child = *(rbegin() ); + QueryState* parent = *(rbegin()+1); + Instance* instance = child->_locator->getElement(); + + child->_area = parent->_area; + child->_transformation = instance->getTransformation (); + + instance->getTransformation().getInvert().applyOn ( child->_area ); + parent->_transformation.applyOn ( child->_transformation ); + } + + + inline bool QueryStack::levelDown () + { + if ( size() > _stopLevel ) return false; + + Locator* locator = getMasterCell()->getInstancesUnder(getArea()).getLocator(); + + if ( locator->isValid() ) { + push_back ( new QueryState ( locator ) ); + + updateTransformation (); + //_tab++; + + return true; + } + + return false; + } + + + inline void QueryStack::levelUp () + { + delete back (); + pop_back (); + //_tab--; + } + + + inline bool QueryStack::levelCompleted () + { + if ( !back()->_locator || !back()->_locator->isValid () ) return true; + return false; + } + + + inline void QueryStack::levelProgress () + { + if ( levelCompleted() ) return; + + back()->_locator->progress (); + if ( !back()->_locator->isValid() ) return; + + updateTransformation (); + } + + + inline void QueryStack::progress ( bool init ) + { + if ( !init ) levelProgress (); + else { + if ( !levelDown() && ( size() > _startLevel ) ) + return; + } + + while ( !empty() ) { + if ( levelCompleted() ) { + levelUp (); + } else { + if ( levelDown() ) continue; + } + + if ( size() > _startLevel ) return; + if ( empty() ) break; + levelProgress (); + } + } + + +// ------------------------------------------------------------------- +// Class : "Query". + + + class Query { + public: + // Types. + enum QueryFilter { DoMasterCells = 1 + , DoComponents = 2 + , DoAll = DoMasterCells || DoComponents + }; + public: + // Constructors & Destructors. + Query (); + virtual ~Query (); + // Accessors. + inline unsigned int getStartLevel () const; + inline unsigned int getStopLevel () const; + inline size_t getDepth () const; + inline const Transformation& getTransformation () const; + inline const Box& getArea () const; + inline const BasicLayer* getBasicLayer () const; + inline Cell* getMasterCell (); + inline Instance* getInstance (); + //inline const Tabulation& getTab () const; + virtual bool hasGoCallback () const; + virtual bool hasMasterCellCallback () const; + virtual void goCallback ( Go* go ) = 0; + virtual void masterCellCallback () = 0; + // Modifiers. + void setQuery ( Cell* cell + , const Box& area + , const Transformation& transformation + , const BasicLayer* basicLayer + , unsigned int filter + ); + inline void setCell ( Cell* cell ); + inline void setArea ( const Box& area ); + inline void setTransformation ( const Transformation& transformation ); + inline void setBasicLayer ( const BasicLayer* basicLayer ); + inline void setFilter ( unsigned int mode ); + inline void setStartLevel ( unsigned int level ); + inline void setStopLevel ( unsigned int level ); + void doQuery (); + + protected: + // Internal: Attributes. + QueryStack _stack; + const BasicLayer* _basicLayer; + unsigned int _filter; + }; + + +// Query Inline Functions. + + inline void Query::setCell ( Cell* cell ) { _stack.setTopCell(cell); } + inline void Query::setArea ( const Box& area ) { _stack.setTopArea(area); } + inline void Query::setTransformation ( const Transformation& transformation ) { _stack.setTopTransformation(transformation); } + inline void Query::setBasicLayer ( const BasicLayer* basicLayer ) { _basicLayer = basicLayer; } + inline void Query::setFilter ( unsigned int filter ) { _filter = filter; } + inline void Query::setStartLevel ( unsigned int level ) { _stack.setStartLevel(level); } + inline void Query::setStopLevel ( unsigned int level ) { _stack.setStopLevel(level); } + + inline unsigned int Query::getStartLevel () const { return _stack.getStartLevel(); } + inline unsigned int Query::getStopLevel () const { return _stack.getStopLevel(); } + inline size_t Query::getDepth () const { return _stack.size(); } + inline const Box& Query::getArea () const { return _stack.getArea(); } + inline const Transformation& Query::getTransformation () const { return _stack.getTransformation(); } + inline const BasicLayer* Query::getBasicLayer () const { return _basicLayer; } + inline Cell* Query::getMasterCell () { return _stack.getMasterCell(); } + inline Instance* Query::getInstance () { return _stack.getInstance(); } +//inline const Tabulation& Query::getTab () const { return _stack.getTab(); } + + + +} // End of Hurricane namespace. + + +#endif // __QUERY_H__ diff --git a/hurricane/src/hviewer/CellViewer.cpp b/hurricane/src/hviewer/CellViewer.cpp index 2a00874a..36b30d2d 100644 --- a/hurricane/src/hviewer/CellViewer.cpp +++ b/hurricane/src/hviewer/CellViewer.cpp @@ -72,9 +72,8 @@ namespace Hurricane { CellViewer::CellViewer ( QWidget* parent ) : QMainWindow(parent) + , _applicationName(tr("Viewer")) , _openAction(NULL) - , _nextCellAction(NULL) - , _previousCellAction(NULL) , _nextAction(NULL) , _saveAction(NULL) , _exitAction(NULL) @@ -91,7 +90,10 @@ namespace Hurricane { , _palette(NULL) , _mousePosition(NULL) , _cellWidget(NULL) + , _cellHistory() { + setObjectName("viewer"); + createMenus (); createLayout (); } @@ -103,49 +105,64 @@ namespace Hurricane { { if ( _openAction ) return; - _openAction = new QAction ( tr("&Open Cell"), this ); - _openAction->setIcon ( QIcon(":/images/stock_open.png") ); - _openAction->setStatusTip ( tr("Open (load) a new Cell") ); + _openAction = new QAction ( tr("&Open Cell"), this ); + _openAction->setObjectName ( "viewer.file.openCell" ); + _openAction->setIcon ( QIcon(":/images/stock_open.png") ); + _openAction->setStatusTip ( tr("Open (load) a new Cell") ); + cerr << "_openAction: " << _openAction << endl; - _nextCellAction = new QAction ( tr("Next Cell"), this ); - _nextCellAction->setStatusTip ( tr("Go to the next Cell in history") ); + _nextAction = new QAction ( tr("&Next Breakpoint"), this ); + _nextAction->setObjectName ( "viewer.file.nextBreakpoint" ); + _nextAction->setStatusTip ( tr("Proceed to the next breakpoint") ); - _previousCellAction = new QAction ( tr("Previous Cell"), this ); - _previousCellAction->setStatusTip ( tr("Go to the previous Cell in history") ); + for ( size_t i=0 ; isetObjectName ( QString("viewer.file.cellHistory[%1]").arg(i) ); + _cellHistoryAction[i]->setVisible ( false ); + _cellHistoryAction[i]->setData ( i ); + _cellHistoryAction[i]->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) ); + connect ( _cellHistoryAction[i], SIGNAL(triggered()), this, SLOT(openHistoryCell())); + } - _nextAction = new QAction ( tr("&Next Breakpoint"), this ); - _nextAction->setStatusTip ( tr("Proceed to the next breakpoint") ); + _saveAction = new QAction ( tr("&Save Cell"), this ); + _saveAction->setObjectName ( "viewer.file.saveCell" ); + _saveAction->setIcon ( QIcon(":/images/stock_save.png") ); + _saveAction->setStatusTip ( tr("Save the current Cell") ); + _saveAction->setVisible ( false ); - _saveAction = new QAction ( tr("&Save Cell"), this ); - _saveAction->setIcon ( QIcon(":/images/stock_save.png") ); - _saveAction->setStatusTip ( tr("Save the current Cell") ); - - _exitAction = new QAction ( tr("&Exit"), this ); - _exitAction->setStatusTip ( tr("Close Coriolis CellViewer") ); - _exitAction->setShortcut ( QKeySequence(tr("CTRL+Q")) ); + _exitAction = new QAction ( tr("&Exit"), this ); + _exitAction->setObjectName ( "viewer.file.exit" ); + _exitAction->setStatusTip ( tr("Close Coriolis CellViewer") ); + _exitAction->setShortcut ( QKeySequence(tr("CTRL+Q")) ); connect ( _exitAction, SIGNAL(triggered()), this, SLOT(close()) ); - _refreshAction = new QAction ( tr("&Refresh"), this ); - _refreshAction->setStatusTip ( tr("Force full redrawing of the display") ); - _refreshAction->setShortcut ( QKeySequence(tr("CTRL+L")) ); + _refreshAction = new QAction ( tr("&Refresh"), this ); + _refreshAction->setObjectName ( "viewer.view.refresh" ); + _refreshAction->setStatusTip ( tr("Force full redrawing of the display") ); + _refreshAction->setShortcut ( QKeySequence(tr("CTRL+L")) ); - _fitToContentsAction = new QAction ( tr("&Fit to Contents"), this ); - _fitToContentsAction->setStatusTip ( tr("Adjust zoom to fit the whole cell's contents") ); - _fitToContentsAction->setShortcut ( Qt::Key_F ); + _fitToContentsAction = new QAction ( tr("&Fit to Contents"), this ); + _fitToContentsAction->setObjectName ( "viewer.view.fit" ); + _fitToContentsAction->setStatusTip ( tr("Adjust zoom to fit the whole cell's contents") ); + _fitToContentsAction->setShortcut ( Qt::Key_F ); - _showSelectionAction = new QAction ( tr("&Show Selection"), this ); - _showSelectionAction->setStatusTip ( tr("Highlight the selected items (darken others)") ); - _showSelectionAction->setShortcut ( Qt::Key_S ); - _showSelectionAction->setCheckable ( true ); + _showSelectionAction = new QAction ( tr("&Show Selection"), this ); + _showSelectionAction->setObjectName ( "viewer.view.showSelection" ); + _showSelectionAction->setStatusTip ( tr("Highlight the selected items (darken others)") ); + _showSelectionAction->setShortcut ( Qt::Key_S ); + _showSelectionAction->setCheckable ( true ); - _runInspectorOnDataBase= new QAction ( tr("Inspect &DataBase"), this ); - _runInspectorOnDataBase->setStatusTip ( tr("Run Inspector on Hurricane DataBase") ); + _runInspectorOnDataBase= new QAction ( tr("Inspect &DataBase"), this ); + _runInspectorOnDataBase->setObjectName ( "viewer.tool.inspectDb" ); + _runInspectorOnDataBase->setStatusTip ( tr("Run Inspector on Hurricane DataBase") ); - _runInspectorOnCell= new QAction ( tr("Inspect &Cell"), this ); - _runInspectorOnCell->setStatusTip ( tr("Run Inspector on the current Cell") ); + _runInspectorOnCell= new QAction ( tr("Inspect &Cell"), this ); + _runInspectorOnCell->setObjectName ( "viewer.tool.inspectCell" ); + _runInspectorOnCell->setStatusTip ( tr("Run Inspector on the current Cell") ); - _browseNetlist= new QAction ( tr("Browse &Netlist"), this ); - _browseNetlist->setStatusTip ( tr("Browse netlist from the current Cell") ); + _browseNetlist= new QAction ( tr("Browse &Netlist"), this ); + _browseNetlist->setObjectName ( "viewer.tool.browseNetlist" ); + _browseNetlist->setStatusTip ( tr("Browse netlist from the current Cell") ); } @@ -156,19 +173,25 @@ namespace Hurricane { if ( !_openAction ) createActions (); _fileMenu = menuBar()->addMenu ( tr("File") ); + _fileMenu->setObjectName ( "viewer.file" ); _fileMenu->addAction ( _openAction ); - _fileMenu->addAction ( _nextCellAction ); - _fileMenu->addAction ( _previousCellAction ); _fileMenu->addAction ( _nextAction ); + _fileMenu->addSeparator (); + for ( size_t i=0 ; iaddAction ( _cellHistoryAction[i] ); + } + _fileMenu->addSeparator (); _fileMenu->addAction ( _saveAction ); _fileMenu->addAction ( _exitAction ); _viewMenu = menuBar()->addMenu ( tr("View") ); + _viewMenu->setObjectName ( "viewer.view" ); _viewMenu->addAction ( _refreshAction ); _viewMenu->addAction ( _fitToContentsAction ); _viewMenu->addAction ( _showSelectionAction ); _toolsMenu = menuBar()->addMenu ( tr("Tool") ); + _toolsMenu->setObjectName ( "viewer.tool" ); _toolsMenu->addAction ( _runInspectorOnDataBase ); _toolsMenu->addAction ( _runInspectorOnCell ); _toolsMenu->addAction ( _browseNetlist ); @@ -225,9 +248,52 @@ namespace Hurricane { } + void CellViewer::refreshHistory () + { + Cell* activeCell = getCell(); + _cellHistory.remove ( activeCell ); + + if ( _cellHistory.size() > CellHistorySize-1 ) + _cellHistory.pop_front (); + _cellHistory.push_back ( activeCell ); + + list::iterator iname = _cellHistory.begin(); + for ( size_t i=0 ; igetName()).c_str() ); + _cellHistoryAction[i]->setText ( entry ); + _cellHistoryAction[i]->setVisible ( true ); + iname++; + } else { + _cellHistoryAction[i]->setVisible ( false ); + } + } + } + + void CellViewer::setCell ( Cell* cell ) { _cellWidget->setCell ( cell ); + + QString title + = QString("%1:<%2>").arg(_applicationName).arg(getString(cell->getName()).c_str()); + setWindowTitle ( title ); + + refreshHistory (); + } + + + Cell* CellViewer::getCell () + { return getCellWidget()->getCell(); } + + + Cell* CellViewer::getCellFromDb ( const char* name ) + { + cerr << "[ERROR] virtual function CellViewer::getCellFromDb() has not been overloaded.\n" + << " (this will prevent \"Open Cell\" to work)" + << endl; + + return NULL; } @@ -246,6 +312,21 @@ namespace Hurricane { } + void CellViewer::openHistoryCell () + { + QAction* historyAction = qobject_cast ( sender() ); + if ( historyAction ) { + list::iterator icell = _cellHistory.begin(); + size_t index = historyAction->data().toUInt(); + + for ( ; index>0 ; index--, icell++ ); + + cerr << "History: " << *icell << endl; + setCell ( *icell ); + } + } + + void CellViewer::runInspectorOnDataBase () { runInspector ( getRecord(DataBase::getDB()) ); diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index 9bb58bb1..26788646 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include # include @@ -135,7 +130,10 @@ namespace Hurricane { CellWidget::DrawingPlanes::DrawingPlanes ( const QSize& size, CellWidget* cw ) : _cellWidget(cw) + , _normalPen() + , _linePen() , _workingPlane(0) + , _lineMode(false) { for ( size_t i=0 ; i<2 ; i++ ) _planes[i] = new QPixmap ( size ); @@ -151,6 +149,40 @@ namespace Hurricane { } + void CellWidget::DrawingPlanes::setPen ( const QPen& pen ) + { + _normalPen = pen; + _linePen = pen; + _linePen.setStyle ( Qt::SolidLine ); + _linePen.setWidth ( 1 ); + + if ( _lineMode ) { + _painters[0].setPen ( _linePen ); + _painters[1].setPen ( _linePen ); + } else { + _painters[0].setPen ( _normalPen ); + _painters[1].setPen ( _normalPen ); + } + } + + + void CellWidget::DrawingPlanes::setBrush ( const QBrush& brush ) + { + _painters[0].setBrush ( brush ); + _painters[1].setBrush ( brush ); + } + + + void CellWidget::DrawingPlanes::setLineMode ( bool mode ) + { + if ( _lineMode != mode ) { + _lineMode = mode; + if ( _lineMode ) painter().setPen ( _linePen ); + else painter().setPen ( _normalPen ); + } + } + + void CellWidget::DrawingPlanes::resize ( const QSize& size ) { for ( size_t i=0 ; i<2 ; i++ ) { @@ -230,6 +262,71 @@ namespace Hurricane { } +// ------------------------------------------------------------------- +// Class : "Hurricane::CellWidget::DrawingQuery". + + + CellWidget::DrawingQuery::DrawingQuery ( CellWidget* widget ) + : Query() + ,_cellWidget(widget) + { } + + + bool CellWidget::DrawingQuery::hasMasterCellCallback () const + { + return true; + } + + + void CellWidget::DrawingQuery::masterCellCallback () + { + _cellWidget->drawBox ( getTransformation().getBox(getMasterCell()->getAbutmentBox()) ); + } + + + bool CellWidget::DrawingQuery::hasGoCallback () const + { + return true; + } + + + void CellWidget::DrawingQuery::goCallback ( Go* go ) + { + drawGo ( go, getBasicLayer(), getArea(), getTransformation() ); + } + + + void CellWidget::DrawingQuery::drawGo ( const Go* go + , const BasicLayer* basicLayer + , const Box& area + , const Transformation& transformation + ) + { + const Segment* segment = dynamic_cast(go); + if ( segment ) { + if ( 1 < _cellWidget->dbuToDisplayLength(segment->getWidth()) ) { + _cellWidget->drawBox ( transformation.getBox(segment->getBoundingBox(basicLayer)) ); + } else { + _cellWidget->drawLine ( transformation.getPoint(segment->getSourcePosition()) + , transformation.getPoint(segment->getTargetPosition()) ); + } + return; + } + + const Contact* contact = dynamic_cast(go); + if ( contact ) { + _cellWidget->drawBox ( transformation.getBox(contact->getBoundingBox(basicLayer)) ); + return; + } + + const Pad* pad = dynamic_cast(go); + if ( pad ) { + _cellWidget->drawBox ( transformation.getBox(pad->getBoundingBox(basicLayer)) ); + return; + } + } + + // ------------------------------------------------------------------- // Class : "Hurricane::CellWidget". @@ -245,6 +342,7 @@ namespace Hurricane { , _scale(1.0) , _offsetVA(_stripWidth,_stripWidth) , _drawingPlanes(QSize(6*_stripWidth,6*_stripWidth),this) + , _drawingQuery(this) , _lastMousePosition(0,0) , _spot(this) , _cell(NULL) @@ -324,7 +422,8 @@ namespace Hurricane { void CellWidget::setShowSelection ( bool state ) { if ( state != _showSelection ) { - _showSelection = state; + _showSelection = state; + _selectionHasChanged = false; redraw (); } } @@ -332,13 +431,16 @@ namespace Hurricane { void CellWidget::redraw ( QRect redrawArea ) { - //cerr << "CellWidget::redraw()" << endl; + cerr << "CellWidget::redraw() - " << _selectionHasChanged << endl; + + //_drawingQuery.setStartLevel ( 1 ); + //_drawingQuery.setStopLevel ( 2 ); _redrawRectCount = 0; pushCursor ( Qt::BusyCursor ); - if ( !_selectionHasChanged ) { + if ( ! ( _selectionHasChanged && _showSelection ) ) { _spot.setRestore ( false ); _drawingPlanes.select ( 0 ); _drawingPlanes.painterBegin (); @@ -351,21 +453,31 @@ namespace Hurricane { int darkening = (_showSelection) ? 200 : 100; if ( _cell ) { - Box redrawBox = displayToDbuBox ( redrawArea ); - for_each_basic_layer ( basicLayer, _technology->getBasicLayers() ) { - _drawingPlanes.painter().setPen ( Graphics::getPen (basicLayer->getName(),darkening) ); - _drawingPlanes.painter().setBrush ( Graphics::getBrush(basicLayer->getName(),darkening) ); + Box redrawBox = displayToDbuBox ( redrawArea ); - if ( isDrawable(basicLayer->getName()) ) - drawCell ( _cell, basicLayer, redrawBox, Transformation() ); - end_for; + _drawingQuery.setArea ( redrawBox ); + _drawingQuery.setTransformation ( Transformation() ); + + forEach ( BasicLayer*, iLayer, _technology->getBasicLayers() ) { + _drawingPlanes.setPen ( Graphics::getPen ((*iLayer)->getName(),darkening)); + _drawingPlanes.setBrush ( Graphics::getBrush((*iLayer)->getName(),darkening) ); + + if ( isDrawable((*iLayer)->getName()) ) { + //drawCell ( _cell, (*iLayer), redrawBox, Transformation() ); + _drawingQuery.setBasicLayer ( *iLayer ); + _drawingQuery.setFilter ( Query::DoComponents ); + _drawingQuery.doQuery (); + } } if ( isDrawable("boundaries") ) { - _drawingPlanes.painter().setPen ( Graphics::getPen ("boundaries") ); - _drawingPlanes.painter().setBrush ( Graphics::getBrush("boundaries") ); + _drawingPlanes.setPen ( Graphics::getPen ("boundaries") ); + _drawingPlanes.setBrush ( Graphics::getBrush("boundaries") ); - drawBoundaries ( _cell, redrawBox, Transformation() ); + //drawBoundaries ( _cell, redrawBox, Transformation() ); + _drawingQuery.setBasicLayer ( NULL ); + _drawingQuery.setFilter ( Query::DoMasterCells ); + _drawingQuery.doQuery (); } } @@ -386,8 +498,6 @@ namespace Hurricane { void CellWidget::redrawSelection ( QRect redrawArea ) { - cerr << "CellWidget::redrawSelection()" << endl; - _drawingPlanes.copyToSelect ( redrawArea.x() , redrawArea.y() , redrawArea.width() @@ -404,10 +514,10 @@ namespace Hurricane { Box redrawBox = displayToDbuBox ( redrawArea ); for_each_basic_layer ( basicLayer, _technology->getBasicLayers() ) { - if ( !isDrawable(basicLayer->getName()) ) continue; + //if ( !isDrawable(basicLayer->getName()) ) continue; - _drawingPlanes.painter().setPen ( Graphics::getPen (basicLayer->getName()) ); - _drawingPlanes.painter().setBrush ( Graphics::getBrush(basicLayer->getName()) ); + _drawingPlanes.setPen ( Graphics::getPen (basicLayer->getName()) ); + _drawingPlanes.setBrush ( Graphics::getBrush(basicLayer->getName()) ); set::iterator iselector = _selectors.begin (); for ( ; iselector != _selectors.end() ; iselector++ ) { @@ -416,11 +526,21 @@ namespace Hurricane { Instance* instance = dynamic_cast(occurrence.getEntity()); if ( instance ) { - drawInstance ( instance, basicLayer, redrawBox, transformation ); + // Temporary. + //drawInstance ( instance, basicLayer, redrawBox, transformation ); continue; } - drawGo ( dynamic_cast(occurrence.getEntity()), basicLayer, redrawBox, transformation ); + Component* component = dynamic_cast(occurrence.getEntity()); + if ( !component ) continue; + if ( !component->getLayer() ) continue; + if ( !component->getLayer()->contains(basicLayer) ) continue; + + _drawingQuery.drawGo ( dynamic_cast(occurrence.getEntity()) + , basicLayer + , redrawBox + , transformation + ); } end_for; } @@ -431,34 +551,6 @@ namespace Hurricane { } - void CellWidget::drawBoundaries ( const Cell* cell - , const Box& redrawArea - , const Transformation& transformation - ) - { - drawBox ( transformation.getBox(cell->getAbutmentBox()) ); - for_each_instance ( instance, cell->getInstances() ) { - drawBoundaries ( instance, redrawArea, transformation ); - end_for; - } - } - - - void CellWidget::drawBoundaries ( const Instance* instance - , const Box& redrawArea - , const Transformation& transformation - ) - { - Box masterArea = redrawArea; - Transformation masterTransformation = instance->getTransformation(); - - instance->getTransformation().getInvert().applyOn ( masterArea ); - transformation.applyOn ( masterTransformation ); - - drawBoundaries ( instance->getMasterCell(), masterArea, masterTransformation ); - } - - bool CellWidget::isDrawable ( const Name& entryName ) { HPaletteEntry* entry = (_palette) ? _palette->find(entryName) : NULL; @@ -468,126 +560,17 @@ namespace Hurricane { } - void CellWidget::drawCell ( const Cell* cell - , const BasicLayer* basicLayer - , const Box& redrawArea - , const Transformation& transformation - ) - { - for_each_instance ( instance, cell->getInstancesUnder(redrawArea) ) { - drawInstance ( instance, basicLayer, redrawArea, transformation ); - end_for; - } - - for_each_slice ( slice, cell->getSlices() ) { - drawSlice ( slice, basicLayer, redrawArea, transformation ); - end_for; - } - } - - - void CellWidget::drawInstance ( const Instance* instance - , const BasicLayer* basicLayer - , const Box& redrawArea - , const Transformation& transformation - ) - { - Box masterArea = redrawArea; - Transformation masterTransformation = instance->getTransformation(); - - instance->getTransformation().getInvert().applyOn ( masterArea ); - transformation.applyOn ( masterTransformation ); - - drawCell ( instance->getMasterCell(), basicLayer, masterArea, masterTransformation ); - } - - - void CellWidget::drawSlice ( const Slice* slice - , const BasicLayer* basicLayer - , const Box& redrawArea - , const Transformation& transformation - ) - { - if ( slice->getLayer()->contains(basicLayer) ) { - if ( slice->getBoundingBox().intersect(redrawArea) ) { - for_each_go ( go, slice->getGosUnder(redrawArea) ) { - drawGo ( go, basicLayer, redrawArea, transformation ); - end_for; - } - } - } - } - - - void CellWidget::drawGo ( const Go* go - , const BasicLayer* basicLayer - , const Box& redrawArea - , const Transformation& transformation - ) - { - const Segment* segment = dynamic_cast(go); - if (segment) { - drawSegment ( segment, basicLayer, redrawArea, transformation ); - return; - } - - const Contact* contact = dynamic_cast(go); - if (contact) { - drawContact ( contact, basicLayer, redrawArea, transformation ); - return; - } - - const Pad* pad = dynamic_cast(go); - if (pad) { - drawPad ( pad, basicLayer, redrawArea, transformation ); - return; - } - } - - - void CellWidget::drawSegment ( const Segment* segment - , const BasicLayer* basicLayer - , const Box& redrawArea - , const Transformation& transformation - ) - { - if ( 1 < dbuToDisplayLength(segment->getWidth()) ) { - drawBox ( transformation.getBox(segment->getBoundingBox(basicLayer)) ); - } else { - drawLine ( transformation.getPoint(segment->getSourcePosition()), - transformation.getPoint(segment->getTargetPosition()) ); - } - } - - - void CellWidget::drawContact ( const Contact* contact - , const BasicLayer* basicLayer - , const Box& redrawArea - , const Transformation& transformation - ) - { - drawBox ( transformation.getBox(contact->getBoundingBox(basicLayer)) ); - } - - void CellWidget::drawPad ( const Pad* pad - , const BasicLayer* basicLayer - , const Box& redrawArea - , const Transformation& transformation - ) - { - drawBox ( transformation.getBox(pad->getBoundingBox(basicLayer)) ); - } - - void CellWidget::drawBox ( const Box& box ) { _redrawRectCount++; + _drawingPlanes.setLineMode ( false ); _drawingPlanes.painter().drawRect ( dbuToDisplayRect(box) ); } void CellWidget::drawLine ( const Point& p1, const Point& p2 ) { + _drawingPlanes.setLineMode ( true ); _drawingPlanes.painter().drawLine ( dbuToDisplayPoint(p1), dbuToDisplayPoint(p2) ); } @@ -998,6 +981,8 @@ namespace Hurricane { void CellWidget::setCell ( Cell* cell ) { _cell = cell; + _drawingQuery.setCell ( cell ); + fitToContents (); } diff --git a/hurricane/src/hviewer/DisplayStyle.cpp b/hurricane/src/hviewer/DisplayStyle.cpp index b9b5737a..5542bab3 100644 --- a/hurricane/src/hviewer/DisplayStyle.cpp +++ b/hurricane/src/hviewer/DisplayStyle.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include "hurricane/viewer/DisplayStyle.h" @@ -99,8 +94,10 @@ namespace Hurricane { , _threshold(threshold) , _refcount(1) { - if ( borderWidth ) + if ( borderWidth ) { + _pen.setStyle ( Qt::SolidLine ); _pen.setWidth ( borderWidth ); + } else _pen.setStyle ( Qt::NoPen ); } diff --git a/hurricane/src/hviewer/DynamicLabel.cpp b/hurricane/src/hviewer/DynamicLabel.cpp index 4bbb7bdd..24dc7e42 100644 --- a/hurricane/src/hviewer/DynamicLabel.cpp +++ b/hurricane/src/hviewer/DynamicLabel.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include # include diff --git a/hurricane/src/hviewer/Graphics.cpp b/hurricane/src/hviewer/Graphics.cpp index 887a2d35..d1b7b7eb 100644 --- a/hurricane/src/hviewer/Graphics.cpp +++ b/hurricane/src/hviewer/Graphics.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include diff --git a/hurricane/src/hviewer/GroupPaletteEntry.cpp b/hurricane/src/hviewer/GroupPaletteEntry.cpp index 99989c0b..35bf4d12 100644 --- a/hurricane/src/hviewer/GroupPaletteEntry.cpp +++ b/hurricane/src/hviewer/GroupPaletteEntry.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include diff --git a/hurricane/src/hviewer/HInspectorWidget.cpp b/hurricane/src/hviewer/HInspectorWidget.cpp index a788d4f5..9de4a1e2 100644 --- a/hurricane/src/hviewer/HInspectorWidget.cpp +++ b/hurricane/src/hviewer/HInspectorWidget.cpp @@ -50,10 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - #include #include #include @@ -192,6 +188,7 @@ namespace Hurricane { , _history() { setAttribute ( Qt::WA_DeleteOnClose ); + setAttribute ( Qt::WA_QuitOnClose, false ); _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; diff --git a/hurricane/src/hviewer/HMousePosition.cpp b/hurricane/src/hviewer/HMousePosition.cpp index 5168300e..e3302630 100644 --- a/hurricane/src/hviewer/HMousePosition.cpp +++ b/hurricane/src/hviewer/HMousePosition.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include "hurricane/viewer/DynamicLabel.h" diff --git a/hurricane/src/hviewer/HNetlist.cpp b/hurricane/src/hviewer/HNetlist.cpp index 2f392d2b..513e23fe 100644 --- a/hurricane/src/hviewer/HNetlist.cpp +++ b/hurricane/src/hviewer/HNetlist.cpp @@ -38,7 +38,6 @@ // x-----------------------------------------------------------------x // | | // | H U R R I C A N E | -// | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | @@ -50,17 +49,13 @@ // x-----------------------------------------------------------------x -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include "hurricane/Commons.h" #include "hurricane/Net.h" @@ -68,6 +63,7 @@ #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/HNetlistModel.h" #include "hurricane/viewer/HNetlist.h" +#include "hurricane/viewer/HInspectorWidget.h" namespace Hurricane { @@ -83,6 +79,7 @@ namespace Hurricane { , _cellWidget(NULL) { setAttribute ( Qt::WA_DeleteOnClose ); + setAttribute ( Qt::WA_QuitOnClose, false ); _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; @@ -146,11 +143,8 @@ namespace Hurricane { void HNetlist::keyPressEvent ( QKeyEvent* event ) { - cerr << "keyPressEvent" << endl; - - if ( event->key() == Qt::Key_Left ) { - cerr << "Key Left Pressed." << endl; - } else { + if ( event->key() == Qt::Key_I ) { runInspector(_netlistView->currentIndex()); } + else { event->ignore(); } } @@ -162,4 +156,17 @@ namespace Hurricane { } + void HNetlist::runInspector ( const QModelIndex& index ) + { + if ( index.isValid() ) { + const Net* net = _netlistModel->getNet ( _sortModel->mapToSource(index).row() ); + + HInspectorWidget* inspector = new HInspectorWidget (); + + inspector->setRootRecord ( getRecord(net) ); + inspector->show (); + } + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/HNetlistModel.cpp b/hurricane/src/hviewer/HNetlistModel.cpp index 677a4694..ea963f62 100644 --- a/hurricane/src/hviewer/HNetlistModel.cpp +++ b/hurricane/src/hviewer/HNetlistModel.cpp @@ -50,9 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include #include #include diff --git a/hurricane/src/hviewer/HPalette.cpp b/hurricane/src/hviewer/HPalette.cpp index 07e998a5..bfbb418f 100644 --- a/hurricane/src/hviewer/HPalette.cpp +++ b/hurricane/src/hviewer/HPalette.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include diff --git a/hurricane/src/hviewer/HPaletteEntry.cpp b/hurricane/src/hviewer/HPaletteEntry.cpp index ef622a82..99838473 100644 --- a/hurricane/src/hviewer/HPaletteEntry.cpp +++ b/hurricane/src/hviewer/HPaletteEntry.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include "hurricane/viewer/Graphics.h" diff --git a/hurricane/src/hviewer/LayerPaletteEntry.cpp b/hurricane/src/hviewer/LayerPaletteEntry.cpp index f1dce083..d12813a6 100644 --- a/hurricane/src/hviewer/LayerPaletteEntry.cpp +++ b/hurricane/src/hviewer/LayerPaletteEntry.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include diff --git a/hurricane/src/hviewer/NetInformations.cpp b/hurricane/src/hviewer/NetInformations.cpp index e3973db4..62041ff3 100644 --- a/hurricane/src/hviewer/NetInformations.cpp +++ b/hurricane/src/hviewer/NetInformations.cpp @@ -50,9 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include #include #include "hurricane/Name.h" diff --git a/hurricane/src/hviewer/RecordModel.cpp b/hurricane/src/hviewer/RecordModel.cpp index 6ca82693..a3a87d21 100644 --- a/hurricane/src/hviewer/RecordModel.cpp +++ b/hurricane/src/hviewer/RecordModel.cpp @@ -50,9 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include #include #include diff --git a/hurricane/src/hviewer/ScreenUtilities.cpp b/hurricane/src/hviewer/ScreenUtilities.cpp index e6cb852b..804ced28 100644 --- a/hurricane/src/hviewer/ScreenUtilities.cpp +++ b/hurricane/src/hviewer/ScreenUtilities.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include "hurricane/BasicLayer.h" diff --git a/hurricane/src/hviewer/ViewerPaletteEntry.cpp b/hurricane/src/hviewer/ViewerPaletteEntry.cpp index bb85ddc0..d48c4bcb 100644 --- a/hurricane/src/hviewer/ViewerPaletteEntry.cpp +++ b/hurricane/src/hviewer/ViewerPaletteEntry.cpp @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # include # include diff --git a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h index 7449a68a..3e3b3a65 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h @@ -50,15 +50,12 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - #ifndef __CELL_VIEWER_H__ #define __CELL_VIEWER_H__ +#include + using namespace std; #include @@ -69,6 +66,7 @@ class QAction; class QMenu; #include "hurricane/Commons.h" +#include "hurricane/Name.h" #include "hurricane/Occurrence.h" @@ -89,21 +87,27 @@ namespace Hurricane { public: CellViewer ( QWidget* parent=NULL ); + inline void setApplicationName ( const QString& name ); void setCell ( Cell* cell ); + Cell* getCell (); + virtual Cell* getCellFromDb ( const char* name ); inline CellWidget* getCellWidget (); void select ( Occurrence& occurence ); void unselect ( Occurrence& occurence ); void unselectAll (); public slots: + void openHistoryCell (); void runInspectorOnDataBase (); void runInspectorOnCell (); void browseNetlist (); + public: + enum { CellHistorySize = 10 }; protected: + QString _applicationName; QAction* _openAction; - QAction* _nextCellAction; - QAction* _previousCellAction; QAction* _nextAction; + QAction* _cellHistoryAction[CellHistorySize]; QAction* _saveAction; QAction* _exitAction; QAction* _refreshAction; @@ -119,18 +123,20 @@ namespace Hurricane { HPalette* _palette; HMousePosition* _mousePosition; CellWidget* _cellWidget; + list _cellHistory; protected: void createActions (); void createMenus (); void createLayout (); + void refreshHistory (); void runInspector ( Record* record ); }; // Inline Functions. - inline CellWidget* CellViewer::getCellWidget () - { return _cellWidget; } + inline CellWidget* CellViewer::getCellWidget () { return _cellWidget; } + inline void CellViewer::setApplicationName ( const QString& name ) { _applicationName = name; } diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index 0b302e66..1a1f7d80 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __CELL_WIDGET_H__ # define __CELL_WIDGET_H__ @@ -79,6 +74,7 @@ class QAction; # include "hurricane/Point.h" # include "hurricane/Box.h" # include "hurricane/Transformation.h" +# include "hurricane/Query.h" # include "hurricane/viewer/DisplayStyle.h" # include "hurricane/viewer/CellWidgets.h" @@ -131,16 +127,7 @@ namespace Hurricane { void unselect ( Occurrence& occurence ); void unselectAll ( bool delayRedraw=true ); // Painter control & Hurricane objects drawing primitives. - 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 (); @@ -217,6 +204,7 @@ namespace Hurricane { public: DrawingPlanes ( const QSize& size, CellWidget* cw ); ~DrawingPlanes (); + inline bool getLineMode () const; inline int width () const; inline int height () const; inline QSize size () const; @@ -231,6 +219,9 @@ namespace Hurricane { inline void painterEnd (); inline void painterEnd ( size_t i ); inline void paintersEnd (); + void setLineMode ( bool mode ); + void setPen ( const QPen& pen ); + void setBrush ( const QBrush& brush ); void resize ( const QSize& size ); void shiftLeft ( int dx ); void shiftRight ( int dx ); @@ -244,12 +235,38 @@ namespace Hurricane { CellWidget* _cellWidget; QPixmap* _planes[2]; QPainter _painters[3]; + QPen _normalPen; + QPen _linePen; size_t _workingPlane; + bool _lineMode; private: DrawingPlanes ( const DrawingPlanes& ); DrawingPlanes& operator= ( const DrawingPlanes& ); }; + private: + class DrawingQuery : public Query { + public: + DrawingQuery ( CellWidget* widget ); + inline void setQuery ( const Box& area + , const Transformation& transformation + , const BasicLayer* basicLayer + , unsigned int filter + ); + virtual bool hasMasterCellCallback () const; + virtual bool hasGoCallback () const; + virtual void masterCellCallback (); + virtual void goCallback ( Go* go ); + void drawGo ( const Go* go + , const BasicLayer* basicLayer + , const Box& area + , const Transformation& transformation + ); + + protected: + CellWidget* _cellWidget; + }; + protected: // Internal: Attributes. static const int _stripWidth; @@ -262,6 +279,7 @@ namespace Hurricane { float _scale; QPoint _offsetVA; DrawingPlanes _drawingPlanes; + DrawingQuery _drawingQuery; QPoint _lastMousePosition; Spot _spot; Cell* _cell; @@ -276,6 +294,18 @@ namespace Hurricane { + inline void CellWidget::DrawingQuery::setQuery ( const Box& area + , const Transformation& transformation + , const BasicLayer* basicLayer + , unsigned int filter + ) + { Query::setQuery ( _cellWidget->getCell(), area, transformation, basicLayer, filter ); } + + + inline bool CellWidget::DrawingPlanes::getLineMode () const + { return _lineMode; } + + inline int CellWidget::DrawingPlanes::width () const { return _planes[0]->width(); } @@ -315,7 +345,7 @@ namespace Hurricane { inline void CellWidget::DrawingPlanes::painterBegin ( size_t i ) { if ( i<2 ) _painters[i].begin ( _planes[i] ); - else _painters[i].begin ( _cellWidget ); + else _painters[i].begin ( _cellWidget ); } diff --git a/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h b/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h index db58198e..7d1fb09d 100644 --- a/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h +++ b/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __DISPLAYSTYLE_H__ # define __DISPLAYSTYLE_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/DynamicLabel.h b/hurricane/src/hviewer/hurricane/viewer/DynamicLabel.h index ec776163..7a394680 100644 --- a/hurricane/src/hviewer/hurricane/viewer/DynamicLabel.h +++ b/hurricane/src/hviewer/hurricane/viewer/DynamicLabel.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __DYNAMIC_LABEL_H__ # define __DYNAMIC_LABEL_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/Graphics.h b/hurricane/src/hviewer/hurricane/viewer/Graphics.h index 7cad0a00..795f18a6 100644 --- a/hurricane/src/hviewer/hurricane/viewer/Graphics.h +++ b/hurricane/src/hviewer/hurricane/viewer/Graphics.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __GRAPHICS_H__ # define __GRAPHICS_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h index fefba397..66ae366f 100644 --- a/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __GROUP_HPALETTE_ENTRY_H__ # define __GROUP_HPALETTE_ENTRY_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HInspectorWidget.h b/hurricane/src/hviewer/hurricane/viewer/HInspectorWidget.h index 59e237ad..2ab04da0 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HInspectorWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/HInspectorWidget.h @@ -50,9 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include #ifndef __HINSPECTOR_WIDGET_H__ #define __HINSPECTOR_WIDGET_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HMousePosition.h b/hurricane/src/hviewer/hurricane/viewer/HMousePosition.h index a42b36fa..b1278105 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HMousePosition.h +++ b/hurricane/src/hviewer/hurricane/viewer/HMousePosition.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __HMOUSE_POSITION_H__ # define __HMOUSE_POSITION_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HNetlist.h b/hurricane/src/hviewer/hurricane/viewer/HNetlist.h index 2631952a..110105df 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HNetlist.h +++ b/hurricane/src/hviewer/hurricane/viewer/HNetlist.h @@ -50,9 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include #ifndef __HNETLIST_WIDGET_H__ #define __HNETLIST_WIDGET_H__ @@ -90,6 +87,7 @@ namespace Hurricane { void setCell ( Cell* cell ); template void setCellWidget ( CellWidget* cw ); + void runInspector ( const QModelIndex& index ); private slots: void textFilterChanged (); void selectNet ( const QModelIndex& index ); diff --git a/hurricane/src/hviewer/hurricane/viewer/HNetlistModel.h b/hurricane/src/hviewer/hurricane/viewer/HNetlistModel.h index 631d7ef5..4e10cf46 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HNetlistModel.h +++ b/hurricane/src/hviewer/hurricane/viewer/HNetlistModel.h @@ -50,9 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include #ifndef __NETLIST_MODEL_H__ #define __NETLIST_MODEL_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HPalette.h b/hurricane/src/hviewer/hurricane/viewer/HPalette.h index d753f1dc..771ecbd3 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HPalette.h +++ b/hurricane/src/hviewer/hurricane/viewer/HPalette.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __HPALETTE__ # define __HPALETTE__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h index 28f5669c..88b9d8a8 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __PALETTE_ENTRY_H__ # define __PALETTE_ENTRY_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h index 26b30afc..2e1cccb9 100644 --- a/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __LAYER_PALETTE_ENTRY_H__ # define __LAYER_PALETTE_ENTRY_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/NetInformations.h b/hurricane/src/hviewer/hurricane/viewer/NetInformations.h index 9bec18a4..a4ba1391 100644 --- a/hurricane/src/hviewer/hurricane/viewer/NetInformations.h +++ b/hurricane/src/hviewer/hurricane/viewer/NetInformations.h @@ -50,9 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include #ifndef __NET_INFORMATIONS_H__ #define __NET_INFORMATIONS_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/RecordModel.h b/hurricane/src/hviewer/hurricane/viewer/RecordModel.h index 969024a0..57605387 100644 --- a/hurricane/src/hviewer/hurricane/viewer/RecordModel.h +++ b/hurricane/src/hviewer/hurricane/viewer/RecordModel.h @@ -50,9 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include #ifndef __RECORD_MODEL_H__ #define __RECORD_MODEL_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/ScreenUtilities.h b/hurricane/src/hviewer/hurricane/viewer/ScreenUtilities.h index 1bdf655f..bf5fe129 100644 --- a/hurricane/src/hviewer/hurricane/viewer/ScreenUtilities.h +++ b/hurricane/src/hviewer/hurricane/viewer/ScreenUtilities.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __SCREENUTILITIES_H__ # define __SCREENUTILITIES_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h index a7c499c7..57defe46 100644 --- a/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h +++ b/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h @@ -50,11 +50,6 @@ // x-----------------------------------------------------------------x -#include -#include -#include - - # ifndef __VIEWER_PALETTE_ENTRY_H__ # define __VIEWER_PALETTE_ENTRY_H__