* Merry Christmas & Fuck Numericable.

* ./hurricane/src/hurricane :
    - New feature: Display support for Rubber, three modes of representation : centric,
        barycentric and (pseudo) steiner.
    - New feature: ability to generate pdf/ps snapshot using QPrinter. Can perform
        an exact snapshot or print a synthetic A4 (choice hard-wired for now).
    - Change: display styles reorganisation, recreation of the "Alliance Graal" look.
    - New feature: darkening managment at CellWidget level, to allow Extension to
        darken when unselecteds.
    - New feature: ExtentionGo are now managed by the selection redraw function.
    - New feature: Selector set is now sorted by object type, this allow to speedup
        the redraw function which will now perform only one loop.
This commit is contained in:
Jean-Paul Chaput 2008-12-25 10:27:58 +00:00
parent b725e49732
commit 9edbed80ae
19 changed files with 688 additions and 277 deletions

View File

@ -1,36 +1,9 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// 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$
@ -146,6 +119,11 @@ namespace Hurricane {
}
}
if ( !getMasterCell()->isTerminal() && (_filter & DoRubbers) ) {
forEach ( Rubber*, rubber, getMasterCell()->getRubbersUnder(_stack.getArea()) )
rubberCallback ( *rubber );
}
if ( hasExtensionGoCallback() && (_filter & DoExtensionGos) ) {
if ( !getMasterCell()->isTerminal() || (_filter & DoTerminalCells) ) {
forEach ( ExtensionSlice*, islice, getMasterCell()->getExtensionSlices() ) {
@ -172,6 +150,12 @@ namespace Hurricane {
}
bool Query::hasRubberCallback () const
{
return false;
}
bool Query::hasExtensionGoCallback () const
{
return false;
@ -184,4 +168,8 @@ namespace Hurricane {
}
void Query::rubberCallback ( Rubber* )
{ }
} // End of Hurricane namespace.

View File

@ -305,13 +305,15 @@ namespace Hurricane {
class Query {
public:
// Types.
enum QueryFilter { DoMasterCells = 1
, DoTerminalCells = 2
, DoComponents = 4
, DoExtensionGos = 8
enum QueryFilter { DoMasterCells = 1
, DoTerminalCells = 2
, DoComponents = 4
, DoRubbers = 8
, DoExtensionGos = 16
, DoAll = DoMasterCells
| DoTerminalCells
| DoComponents
| DoRubbers
| DoExtensionGos
};
public:
@ -329,10 +331,12 @@ namespace Hurricane {
inline Instance* getInstance ();
//inline const Tabulation& getTab () const;
virtual bool hasGoCallback () const;
virtual bool hasRubberCallback () const;
virtual bool hasExtensionGoCallback () const;
virtual bool hasMasterCellCallback () const;
virtual void goCallback ( Go* go ) = 0;
virtual void extensionGoCallback ( Go* go ) = 0;
virtual void goCallback ( Go* ) = 0;
virtual void rubberCallback ( Rubber* );
virtual void extensionGoCallback ( Go* ) = 0;
virtual void masterCellCallback () = 0;
// Modifiers.
void setQuery ( Cell* cell

View File

@ -14,7 +14,6 @@
hurricane/viewer/MousePositionWidget.h
hurricane/viewer/SelectCommand.h
hurricane/viewer/CellWidget.h
hurricane/viewer/CellWidgets.h
hurricane/viewer/CellViewer.h
hurricane/viewer/RecordModel.h
hurricane/viewer/InspectorWidget.h

View File

@ -29,6 +29,8 @@
#include <QStatusBar>
#include <QDockWidget>
#include <QApplication>
#include <QPrinter>
#include <QPrintDialog>
#include "hurricane/DataBase.h"
#include "hurricane/Cell.h"
@ -48,12 +50,14 @@ namespace Hurricane {
, _applicationName(tr("Viewer"))
, _openAction(NULL)
, _nextAction(NULL)
, _printAction(NULL)
, _saveAction(NULL)
, _closeAction(NULL)
, _exitAction(NULL)
, _refreshAction(NULL)
, _fitToContentsAction(NULL)
, _showSelectionAction(NULL)
, _rubberChangeAction(NULL)
, _controllerAction(NULL)
, _fileMenu(NULL)
, _viewMenu(NULL)
@ -91,6 +95,7 @@ namespace Hurricane {
_openAction = new QAction ( tr("&Open Cell"), this );
_openAction->setObjectName ( "viewer.menuBar.file.openCell" );
_openAction->setShortcut ( QKeySequence(tr("CTRL+O")) );
_openAction->setIcon ( QIcon(":/images/stock_open.png") );
_openAction->setStatusTip ( tr("Open (load) a new Cell") );
@ -107,6 +112,13 @@ namespace Hurricane {
connect ( _cellHistoryAction[i], SIGNAL(triggered()), this, SLOT(openHistoryCell()));
}
_printAction = new QAction ( tr("&Print"), this );
_printAction->setObjectName ( "viewer.menuBar.file.print" );
_printAction->setStatusTip ( tr("Print the displayed area") );
_printAction->setShortcut ( QKeySequence(tr("CTRL+P")) );
_printAction->setVisible ( true );
connect ( _printAction, SIGNAL(triggered()), this, SLOT(printDisplay()) );
_saveAction = new QAction ( tr("&Save Cell"), this );
_saveAction->setObjectName ( "viewer.menuBar.file.saveCell" );
_saveAction->setIcon ( QIcon(":/images/stock_save.png") );
@ -141,10 +153,16 @@ namespace Hurricane {
_showSelectionAction->setShortcut ( Qt::Key_S );
_showSelectionAction->setCheckable ( true );
_rubberChangeAction = new QAction ( tr("Change Rubber Style"), this );
_rubberChangeAction->setObjectName ( "viewer.menuBar.view.changeRubber" );
_rubberChangeAction->setStatusTip ( tr("Cycle through all avalaibles rubber drawing styles") );
_rubberChangeAction->setShortcut ( Qt::Key_Asterisk );
_controllerAction = new QAction ( tr("Controller"), this );
_controllerAction->setObjectName ( "viewer.menuBar.tools.controller" );
_controllerAction->setIcon ( QIcon(":/images/swiss-knife.png") );
_controllerAction->setStatusTip ( tr("Fine Tune && Inspect DataBase") );
_controllerAction->setIcon ( QIcon(":/images/swiss-knife.png") );
_controllerAction->setShortcut ( QKeySequence(tr("CTRL+I")) );
}
@ -164,7 +182,9 @@ namespace Hurricane {
_fileMenu->addAction ( _cellHistoryAction[i] );
}
_fileMenu->addSeparator ();
_fileMenu->addAction ( _printAction );
_fileMenu->addAction ( _saveAction );
_fileMenu->addSeparator ();
_fileMenu->addAction ( _closeAction );
_fileMenu->addAction ( _exitAction );
@ -173,6 +193,7 @@ namespace Hurricane {
_viewMenu->addAction ( _refreshAction );
_viewMenu->addAction ( _fitToContentsAction );
_viewMenu->addAction ( _showSelectionAction );
_viewMenu->addAction ( _rubberChangeAction );
_toolsMenu = menuBar()->addMenu ( tr("Tools") );
_toolsMenu->setObjectName ( "viewer.menuBar.tools" );
@ -225,11 +246,12 @@ namespace Hurricane {
setCentralWidget ( _cellWidget );
connect ( this , SIGNAL(redrawCellWidget()), _cellWidget, SLOT(refresh()) );
connect ( _refreshAction , SIGNAL(triggered()) , _cellWidget, SLOT(refresh()) );
connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents()) );
connect ( _showSelectionAction , SIGNAL(toggled(bool)) , _cellWidget, SLOT(setShowSelection(bool)) );
connect ( _controllerAction , SIGNAL(triggered()) , this , SLOT(showController()) );
connect ( this , SIGNAL(redrawCellWidget()), _cellWidget, SLOT(refresh()) );
connect ( _refreshAction , SIGNAL(triggered()) , _cellWidget, SLOT(refresh()) );
connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents()) );
connect ( _showSelectionAction , SIGNAL(toggled(bool)) , _cellWidget, SLOT(setShowSelection(bool)) );
connect ( _rubberChangeAction , SIGNAL(triggered()) , _cellWidget, SLOT(rubberChange()) );
connect ( _controllerAction , SIGNAL(triggered()) , this , SLOT(showController()) );
connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&))
, _mousePosition , SLOT(setPosition(const Point&)) );
connect ( _cellWidget , SIGNAL(showSelectionToggled(bool))
@ -328,4 +350,21 @@ namespace Hurricane {
{ if ( _cellWidget ) _cellWidget->unselectAll(); }
void CellViewer::printDisplay ()
{
if ( !_cellWidget ) return;
if ( !_cellWidget->getCell() ) {
cerr << Warning("Unable to print, no cell loaded yet.") << endl;
return;
}
QPrinter printer ( QPrinter::ScreenResolution );
printer.setOutputFileName ( "unicorn-snapshot.pdf" );
QPrintDialog dialog ( &printer );
if ( dialog.exec() == QDialog::Accepted )
_cellWidget->copyToPrinter ( &printer );
}
} // End of Hurricane namespace.

View File

@ -170,7 +170,7 @@ namespace Hurricane {
_restore = true;
QPainter& screenPainter = _cellWidget->getDrawingPlanes().painter(2);
QPainter& screenPainter = _cellWidget->getDrawingPlanes().painter(PlaneId::Widget);
_spotPoint = computeSpotPoint ( screenPoint );
screenPainter.setPen ( Graphics::getPen("spot") );
@ -315,6 +315,7 @@ namespace Hurricane {
CellWidget::DrawingPlanes::DrawingPlanes ( const QSize& size, CellWidget* cw )
: _cellWidget(cw)
, _printer(NULL)
, _normalPen()
, _linePen()
, _workingPlane(0)
@ -353,22 +354,22 @@ namespace Hurricane {
void CellWidget::DrawingPlanes::setBrush ( const QBrush& brush )
{
_painters[0].setBrush ( brush );
_painters[1].setBrush ( brush );
_painters[PlaneId::Normal ].setBrush ( brush );
_painters[PlaneId::Selection].setBrush ( brush );
}
void CellWidget::DrawingPlanes::setBackground ( const QBrush& brush )
{
_painters[0].setBackground ( brush );
_painters[1].setBackground ( brush );
_painters[PlaneId::Normal ].setBackground ( brush );
_painters[PlaneId::Selection].setBackground ( brush );
}
void CellWidget::DrawingPlanes::setBackgroundMode ( Qt::BGMode mode )
{
_painters[0].setBackgroundMode ( mode );
_painters[1].setBackgroundMode ( mode );
_painters[PlaneId::Normal ].setBackgroundMode ( mode );
_painters[PlaneId::Selection].setBackgroundMode ( mode );
}
@ -399,8 +400,8 @@ namespace Hurricane {
void CellWidget::DrawingPlanes::shiftLeft ( int dx )
{
paintersBegin ();
_painters[0].drawPixmap ( dx, 0, *_planes[0], 0, 0, width()-dx, height() );
_painters[1].drawPixmap ( dx, 0, *_planes[1], 0, 0, width()-dx, height() );
_painters[PlaneId::Normal ].drawPixmap ( dx, 0, *_planes[0], 0, 0, width()-dx, height() );
_painters[PlaneId::Selection].drawPixmap ( dx, 0, *_planes[1], 0, 0, width()-dx, height() );
paintersEnd ();
}
@ -408,8 +409,8 @@ namespace Hurricane {
void CellWidget::DrawingPlanes::shiftRight ( int dx )
{
paintersBegin ();
_painters[0].drawPixmap ( 0, 0, *_planes[0], dx, 0, width()-dx, height() );
_painters[1].drawPixmap ( 0, 0, *_planes[1], dx, 0, width()-dx, height() );
_painters[PlaneId::Normal ].drawPixmap ( 0, 0, *_planes[0], dx, 0, width()-dx, height() );
_painters[PlaneId::Selection].drawPixmap ( 0, 0, *_planes[1], dx, 0, width()-dx, height() );
paintersEnd ();
}
@ -417,8 +418,8 @@ namespace Hurricane {
void CellWidget::DrawingPlanes::shiftUp ( int dy )
{
paintersBegin ();
_painters[0].drawPixmap ( 0, dy, *_planes[0], 0, 0, width(), height()-dy );
_painters[1].drawPixmap ( 0, dy, *_planes[1], 0, 0, width(), height()-dy );
_painters[PlaneId::Normal ].drawPixmap ( 0, dy, *_planes[0], 0, 0, width(), height()-dy );
_painters[PlaneId::Selection].drawPixmap ( 0, dy, *_planes[1], 0, 0, width(), height()-dy );
paintersEnd ();
}
@ -426,38 +427,108 @@ namespace Hurricane {
void CellWidget::DrawingPlanes::shiftDown ( int dy )
{
paintersBegin ();
_painters[0].drawPixmap ( 0, 0, *_planes[0], 0, dy, width(), height()-dy );
_painters[1].drawPixmap ( 0, 0, *_planes[1], 0, dy, width(), height()-dy );
_painters[PlaneId::Normal ].drawPixmap ( 0, 0, *_planes[0], 0, dy, width(), height()-dy );
_painters[PlaneId::Selection].drawPixmap ( 0, 0, *_planes[1], 0, dy, width(), height()-dy );
paintersEnd ();
}
void CellWidget::DrawingPlanes::copyToSelect ( int sx, int sy, int w, int h )
{
painterBegin ( 1 );
_painters[1].setPen ( Qt::NoPen );
_painters[1].setBackground ( Graphics::getBrush("background") );
_painters[1].eraseRect ( sx, sy, w, h );
//_painters[1].setOpacity ( 0.5 );
_painters[1].drawPixmap ( sx, sy, *_planes[0], sx, sy, w, h );
painterEnd ( 1 );
painterBegin ( PlaneId::Selection );
_painters[PlaneId::Selection].setPen ( Qt::NoPen );
_painters[PlaneId::Selection].setBackground ( Graphics::getBrush("background") );
_painters[PlaneId::Selection].eraseRect ( sx, sy, w, h );
//_painters[PlaneId::Selection].setOpacity ( 0.5 );
_painters[PlaneId::Selection].drawPixmap ( sx, sy, *_planes[0], sx, sy, w, h );
painterEnd ( PlaneId::Selection );
}
void CellWidget::DrawingPlanes::copyToScreen ( int sx, int sy, int w, int h )
{
if ( _cellWidget->showSelection() )
_painters[2].drawPixmap ( sx, sy
, *_planes[1]
, _cellWidget->getOffsetVA().rx()+sx, _cellWidget->getOffsetVA().ry()+sy
, w, h
);
_painters[PlaneId::Widget].drawPixmap
( sx, sy
, *_planes[PlaneId::Selection]
, _cellWidget->getOffsetVA().rx()+sx, _cellWidget->getOffsetVA().ry()+sy
, w, h
);
else
_painters[2].drawPixmap ( sx, sy
, *_planes[0]
, _cellWidget->getOffsetVA().rx()+sx, _cellWidget->getOffsetVA().ry()+sy
, w, h
);
_painters[PlaneId::Widget].drawPixmap
( sx, sy
, *_planes[PlaneId::Normal]
, _cellWidget->getOffsetVA().rx()+sx, _cellWidget->getOffsetVA().ry()+sy
, w, h
);
}
void CellWidget::DrawingPlanes::copyToPrinter ( int sx, int sy, int w, int h, QPrinter* printer )
{
bool imageOnly = false;
int ximage = 0;
int yimage = 0;
if ( !printer ) return;
if ( imageOnly ) {
printer->setPaperSize ( QSizeF(w,h), QPrinter::DevicePixel );
printer->setPageMargins ( 0.0, 0.0, 0.0, 0.0, QPrinter::DevicePixel );
}
_printer = printer;
painterBegin ( PlaneId::Printer );
if ( !imageOnly ) {
QFont font ( "Bitstream Vera Sans", 12 );
font.setWeight ( QFont::Bold );
DbU::Unit x1 = _cellWidget->displayToDbuX ( sx );
DbU::Unit x2 = _cellWidget->displayToDbuX ( sx+w );
DbU::Unit y1 = _cellWidget->displayToDbuY ( sy );
DbU::Unit y2 = _cellWidget->displayToDbuY ( sy+h );
string title = "Unicorn:" + getString(_cellWidget->getCell())
+ " area [ " + DbU::getValueString(x1)
+ " " + DbU::getValueString(y1)
+ " ] [ " + DbU::getValueString(x2)
+ " " + DbU::getValueString(y2)
+ " ]";
QRect titleArea = QRect ( 0, 0, _printer->width(), 50 );
_painters[PlaneId::Printer].setFont ( font );
_painters[PlaneId::Printer].drawText ( titleArea, Qt::AlignVCenter|Qt::AlignHCenter, title.c_str() );
ximage = (_printer->width() > w) ? (_printer->width()-w)/2 : 0;
yimage = 100;
}
cerr << "sy: " << sy << " offsetVA.ry(): " << _cellWidget->getOffsetVA().ry() << endl;
cerr << "w: " << w << " h:" << h << endl;
if ( _cellWidget->showSelection() )
_painters[PlaneId::Printer].drawPixmap
( ximage, yimage
, *_planes[PlaneId::Selection]
, _cellWidget->getOffsetVA().rx()+sx, _cellWidget->getOffsetVA().ry()+sy
, w, h
);
else
_painters[PlaneId::Printer].drawPixmap
( ximage, yimage
, *_planes[PlaneId::Normal]
, _cellWidget->getOffsetVA().rx()+sx, _cellWidget->getOffsetVA().ry()+sy
, w, h
);
if ( !imageOnly ) {
_painters[PlaneId::Printer].setPen ( QPen(QBrush(QColor("black")), 1.0) );
_painters[PlaneId::Printer].drawRect ( ximage-2, 98, w+4, h+4 );
}
painterEnd ( PlaneId::Printer );
_printer = NULL;
}
@ -527,16 +598,16 @@ namespace Hurricane {
static unsigned int state;
const Component* component = dynamic_cast<const Component*>(go);
if ( !component ) return;
_goCount++;
rectangle = _cellWidget->dbuToDisplayRect ( transformation.getBox(component->getBoundingBox(basicLayer)) );
state = ( (rectangle.width() > 2) ? 1:0) | ( (rectangle.height() > 2) ? 2:0);
switch ( state ) {
case 0: break;
case 1: _cellWidget->drawScreenLine ( rectangle.bottomLeft(), rectangle.bottomRight() ); break;
case 2: _cellWidget->drawScreenLine ( rectangle.bottomLeft(), rectangle.topLeft () ); break;
case 3: _cellWidget->drawScreenRect ( rectangle ); break;
if ( component ) {
_goCount++;
rectangle = _cellWidget->dbuToDisplayRect ( transformation.getBox(component->getBoundingBox(basicLayer)) );
state = ( (rectangle.width() > 2) ? 1:0) | ( (rectangle.height() > 2) ? 2:0);
switch ( state ) {
case 0: break;
case 1: _cellWidget->drawScreenLine ( rectangle.bottomLeft(), rectangle.bottomRight() ); break;
case 2: _cellWidget->drawScreenLine ( rectangle.bottomLeft(), rectangle.topLeft () ); break;
case 3: _cellWidget->drawScreenRect ( rectangle ); break;
}
}
}
@ -548,9 +619,73 @@ namespace Hurricane {
void CellWidget::DrawingQuery::extensionGoCallback ( Go* go )
{
drawExtensionGo ( _cellWidget, go, getBasicLayer(), getArea(), getTransformation() );
}
void CellWidget::DrawingQuery::drawExtensionGo ( CellWidget* widget
, const Go* go
, const BasicLayer* basicLayer
, const Box& area
, const Transformation& transformation
)
{
if ( _drawExtensionGo )
_drawExtensionGo ( _cellWidget, go, getBasicLayer(), getArea(), getTransformation() );
_drawExtensionGo ( widget, go, basicLayer, area, transformation );
}
bool CellWidget::DrawingQuery::hasRubberCallback () const
{
return true;
}
void CellWidget::DrawingQuery::rubberCallback ( Rubber* rubber )
{
drawRubber ( rubber, getArea(), getTransformation() );
}
void CellWidget::DrawingQuery::drawRubber ( const Rubber* rubber
, const Box& area
, const Transformation& transformation
)
{
static QPoint center;
static QPoint extremity;
static QPoint steiner;
switch ( _cellWidget->getRubberShape() ) {
case CellWidget::Steiner:
center = _cellWidget->dbuToDisplayPoint(transformation.getPoint(rubber->getBarycenter()));
forEach ( Hook*, hook, rubber->getHooks() ) {
extremity = _cellWidget->dbuToDisplayPoint
( transformation.getPoint(hook->getComponent()->getCenter()) );
steiner = QPoint ( extremity.x(), center.y() );
_cellWidget->drawScreenLine ( center , steiner , PlaneId::Working, false );
_cellWidget->drawScreenLine ( steiner, extremity, PlaneId::Working, false );
}
break;
case CellWidget::Barycentric:
center = _cellWidget->dbuToDisplayPoint(transformation.getPoint(rubber->getBarycenter()));
forEach ( Hook*, hook, rubber->getHooks() ) {
extremity = _cellWidget->dbuToDisplayPoint
( transformation.getPoint(hook->getComponent()->getCenter()) );
_cellWidget->drawScreenLine ( center, extremity, PlaneId::Working, false );
}
break;
case CellWidget::Centric:
default:
center = _cellWidget->dbuToDisplayPoint(transformation.getPoint(rubber->getCenter()));
forEach ( Hook*, hook, rubber->getHooks() ) {
extremity = _cellWidget->dbuToDisplayPoint
( transformation.getPoint(hook->getComponent()->getCenter()) );
_cellWidget->drawScreenLine ( center, extremity, PlaneId::Working, false );
}
break;
}
}
@ -589,7 +724,15 @@ namespace Hurricane {
{ return false; }
void CellWidget::TextDrawingQuery::goCallback ( Go* go )
void CellWidget::TextDrawingQuery::goCallback ( Go* )
{ }
bool CellWidget::TextDrawingQuery::hasRubberCallback () const
{ return false; }
void CellWidget::TextDrawingQuery::rubberCallback ( Rubber* )
{ }
@ -597,7 +740,7 @@ namespace Hurricane {
{ return false; }
void CellWidget::TextDrawingQuery::extensionGoCallback ( Go* go )
void CellWidget::TextDrawingQuery::extensionGoCallback ( Go* )
{ }
@ -697,6 +840,7 @@ namespace Hurricane {
, _drawingQuery(this)
, _textDrawingQuery(this)
, _queryFilter(~Query::DoTerminalCells)
, _darkening(100)
, _mousePosition(0,0)
, _spot(this)
, _cell(NULL)
@ -712,6 +856,7 @@ namespace Hurricane {
, _commands()
, _redrawRectCount(0)
, _textFontHeight(20)
, _rubberShape(Steiner)
{
//setBackgroundRole ( QPalette::Dark );
//setAutoFillBackground ( false );
@ -815,6 +960,17 @@ namespace Hurricane {
}
void CellWidget::rubberChange ()
{
switch ( getRubberShape() ) {
case Centric: setRubberShape(Barycentric); break;
case Barycentric: setRubberShape(Steiner ); break;
case Steiner: setRubberShape(Centric ); break;
}
emit settingsChanged();
}
void CellWidget::setShowSelection ( bool state )
{
if ( state != _showSelection ) {
@ -853,8 +1009,8 @@ namespace Hurricane {
if ( ! ( _selectionHasChanged && _showSelection ) || _cellModificated ) {
_spot.setRestore ( false );
_drawingPlanes.copyToSelect ();
_drawingPlanes.select ( 0 );
_drawingPlanes.copyToSelect ( redrawArea );
_drawingPlanes.select ( PlaneId::Normal );
_drawingPlanes.painterBegin ();
_drawingPlanes.painter().setPen ( Qt::NoPen );
@ -863,7 +1019,7 @@ namespace Hurricane {
_drawingPlanes.painter().eraseRect ( redrawArea );
repaint ();
int darkening = (_showSelection) ? Graphics::getDarkening() : 100;
setDarkening ( (_showSelection) ? Graphics::getDarkening() : 100 );
if ( _cell ) {
@ -876,14 +1032,14 @@ namespace Hurricane {
_drawingQuery.setTransformation ( Transformation() );
forEach ( BasicLayer*, iLayer, _technology->getBasicLayers() ) {
_drawingPlanes.setPen ( Graphics::getPen ((*iLayer)->getName(),darkening) );
_drawingPlanes.setBrush ( Graphics::getBrush((*iLayer)->getName(),darkening) );
_drawingPlanes.setPen ( Graphics::getPen ((*iLayer)->getName(),getDarkening()) );
_drawingPlanes.setBrush ( Graphics::getBrush((*iLayer)->getName(),getDarkening()) );
if ( isDrawable((*iLayer)->getName()) ) {
_drawingQuery.setBasicLayer ( *iLayer );
_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells );
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoMasterCells|Query::DoRubbers) );
_drawingQuery.doQuery ();
_drawingPlanes.copyToSelect ();
_drawingPlanes.copyToSelect ( redrawArea );
repaint ();
}
QApplication::processEvents();
@ -896,13 +1052,26 @@ namespace Hurricane {
if ( /*!timeout("redraw [boundaries]",timer,10.0,timedout) &&*/ (!_redrawManager.interrupted()) ) {
if ( isDrawable("boundaries") ) {
_drawingPlanes.setPen ( Graphics::getPen ("boundaries",darkening) );
_drawingPlanes.setBrush ( Graphics::getBrush("boundaries",darkening) );
_drawingPlanes.setPen ( Graphics::getPen ("boundaries",getDarkening()) );
_drawingPlanes.setBrush ( Graphics::getBrush("boundaries",getDarkening()) );
_drawingQuery.setBasicLayer ( NULL );
_drawingQuery.setFilter ( _queryFilter & ~Query::DoComponents );
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoComponents|Query::DoRubbers) );
_drawingQuery.doQuery ();
_drawingPlanes.copyToSelect ();
_drawingPlanes.copyToSelect ( redrawArea );
repaint ();
}
}
if ( /*!timeout("redraw [rubbers]",timer,10.0,timedout) &&*/ (!_redrawManager.interrupted()) ) {
if ( isDrawable("rubber") ) {
_drawingPlanes.setPen ( Graphics::getPen ("rubber",getDarkening()) );
_drawingPlanes.setBrush ( Graphics::getBrush("rubber",getDarkening()) );
_drawingQuery.setBasicLayer ( NULL );
_drawingQuery.setFilter ( _queryFilter & ~(Query::DoComponents|Query::DoMasterCells) );
_drawingQuery.doQuery ();
_drawingPlanes.copyToSelect ( redrawArea );
repaint ();
}
}
@ -910,13 +1079,13 @@ namespace Hurricane {
QApplication::processEvents();
if ( /*!timeout("redraw [text.instances]",timer,10.0,timedout) &&*/ (!_redrawManager.interrupted()) ) {
if ( isDrawable("text.instance") ) {
_drawingPlanes.setPen ( Graphics::getPen ("text.instance",darkening) );
_drawingPlanes.setBrush ( Graphics::getBrush("text.instance",darkening) );
_drawingPlanes.setBackground ( Graphics::getBrush("boundaries" ,darkening) );
_drawingPlanes.setPen ( Graphics::getPen ("text.instance",getDarkening()) );
_drawingPlanes.setBrush ( Graphics::getBrush("text.instance",getDarkening()) );
_drawingPlanes.setBackground ( Graphics::getBrush("boundaries" ,getDarkening()) );
_textDrawingQuery.setArea ( redrawBox );
_textDrawingQuery.setTransformation ( Transformation() );
_textDrawingQuery.doQuery ();
_drawingPlanes.copyToSelect ();
_drawingPlanes.copyToSelect ( redrawArea );
repaint ();
}
}
@ -931,7 +1100,7 @@ namespace Hurricane {
_drawingQuery.setDrawExtensionGo ( (*islice)->getName() );
_drawingQuery.setFilter ( Query::DoExtensionGos );
_drawingQuery.doQuery ();
_drawingPlanes.copyToSelect ();
_drawingPlanes.copyToSelect ( redrawArea );
repaint ();
}
}
@ -941,26 +1110,27 @@ namespace Hurricane {
_cellModificated = false;
}
setDarkening ( 100 );
if ( _showSelection )
redrawSelection ( redrawArea );
popCursor ();
timer.stop ();
// cerr << "CellWidget::redraw() - " << _redrawRectCount
// << " in " << timer.getCombTime() << "s ("
// << setprecision(3) << (timer.getCombTime()/_redrawRectCount) << " s/r)";
// if ( _drawingQuery.getGoCount() )
// cerr << " " << _drawingQuery.getGoCount()
// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getGoCount()) << " s/go)";
// else
// cerr << " 0 Gos";
// if ( _drawingQuery.getInstanceCount() )
// cerr << " " << _drawingQuery.getInstanceCount()
// << " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getInstanceCount()) << " s/inst)";
// else
// cerr << " 0 Instances";
// cerr << endl;
cerr << "CellWidget::redraw() - " << _redrawRectCount
<< " in " << timer.getCombTime() << "s ("
<< setprecision(3) << (timer.getCombTime()/_redrawRectCount) << " s/r)";
if ( _drawingQuery.getGoCount() )
cerr << " " << _drawingQuery.getGoCount()
<< " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getGoCount()) << " s/go)";
else
cerr << " 0 Gos";
if ( _drawingQuery.getInstanceCount() )
cerr << " " << _drawingQuery.getInstanceCount()
<< " (" << setprecision(3) << (timer.getCombTime()/_drawingQuery.getInstanceCount()) << " s/inst)";
else
cerr << " 0 Instances";
cerr << endl;
}
@ -972,22 +1142,23 @@ namespace Hurricane {
, redrawArea.height()
);
_drawingPlanes.select ( 1 );
_drawingPlanes.select ( PlaneId::Selection );
_drawingPlanes.painterBegin ();
_drawingPlanes.painter().setPen ( Qt::NoPen );
_drawingPlanes.painter().setBackground ( Graphics::getBrush("background") );
_drawingPlanes.painter().setClipRect ( redrawArea );
if ( _cell ) {
Box redrawBox = displayToDbuBox ( redrawArea );
Box redrawBox = displayToDbuBox ( redrawArea );
SelectorSet::iterator iselector;
for_each_basic_layer ( basicLayer, _technology->getBasicLayers() ) {
forEach ( BasicLayer*, basicLayer, _technology->getBasicLayers() ) {
//if ( !isDrawableLayer(basicLayer->getName()) ) continue;
_drawingPlanes.setPen ( Graphics::getPen (basicLayer->getName()) );
_drawingPlanes.setBrush ( Graphics::getBrush(basicLayer->getName()) );
set<Selector*>::iterator iselector = _selectors.begin ();
iselector = _selectors.begin ();
for ( ; iselector != _selectors.end() ; iselector++ ) {
Occurrence occurrence = (*iselector)->getOccurrence();
Transformation transformation = occurrence.getPath().getTransformation();
@ -1000,18 +1171,48 @@ namespace Hurricane {
}
Component* component = dynamic_cast<Component*>(occurrence.getEntity());
if ( !component ) continue;
if ( !component ) break;
if ( !component->getLayer() ) continue;
if ( !component->getLayer()->contains(basicLayer) ) continue;
if ( !component->getLayer()->contains(*basicLayer) ) continue;
_drawingQuery.drawGo ( dynamic_cast<Go*>(occurrence.getEntity())
, basicLayer
, *basicLayer
, redrawBox
, transformation
);
}
end_for;
}
_drawingPlanes.setPen ( Graphics::getPen ("rubber") );
_drawingPlanes.setBrush ( Graphics::getBrush("rubber") );
for ( ; iselector != _selectors.end() ; iselector++ ) {
Occurrence occurrence = (*iselector)->getOccurrence();
Transformation transformation = occurrence.getPath().getTransformation();
Rubber* rubber = dynamic_cast<Rubber*>(occurrence.getEntity());
if ( !rubber ) break;
_drawingQuery.drawRubber ( rubber, redrawBox, transformation );
}
Name extensionName = "";
for ( ; iselector != _selectors.end() ; iselector++ ) {
Occurrence occurrence = (*iselector)->getOccurrence();
Transformation transformation = occurrence.getPath().getTransformation();
ExtensionGo* eGo = dynamic_cast<ExtensionGo*>(occurrence.getEntity());
if ( !eGo ) break;
if ( eGo->getName() != extensionName ) {
extensionName = eGo->getName();
_drawingQuery.setDrawExtensionGo ( extensionName );
}
if ( isDrawable(extensionName) )
_drawingQuery.drawExtensionGo ( this, eGo, NULL, redrawBox, transformation );
}
repaint ();
}
@ -1095,26 +1296,26 @@ namespace Hurricane {
}
void CellWidget::drawLine ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 )
void CellWidget::drawLine ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2, bool mode )
{
_redrawRectCount++;
_drawingPlanes.setLineMode ( true );
_drawingPlanes.setLineMode ( mode );
_drawingPlanes.painter().drawLine ( dbuToDisplayPoint(x1,y1), dbuToDisplayPoint(x2,y2) );
}
void CellWidget::drawLine ( const Point& p1, const Point& p2 )
void CellWidget::drawLine ( const Point& p1, const Point& p2, bool mode )
{
_redrawRectCount++;
_drawingPlanes.setLineMode ( true );
_drawingPlanes.setLineMode ( mode );
_drawingPlanes.painter().drawLine ( dbuToDisplayPoint(p1), dbuToDisplayPoint(p2) );
}
void CellWidget::drawScreenLine ( const QPoint& p1, const QPoint& p2, size_t plane )
void CellWidget::drawScreenLine ( const QPoint& p1, const QPoint& p2, size_t plane, bool mode )
{
_redrawRectCount++;
_drawingPlanes.setLineMode ( true );
_drawingPlanes.setLineMode ( mode );
_drawingPlanes.painter(plane).drawLine ( p1, p2 );
}
@ -1146,7 +1347,7 @@ namespace Hurricane {
void CellWidget::drawGrid ()
{
_drawingPlanes.painter(2).setPen ( Graphics::getPen("grid") );
_drawingPlanes.painter(PlaneId::Widget).setPen ( Graphics::getPen("grid") );
bool lambdaGrid = false;
if ( Graphics::getThreshold("grid")/DbU::lambda(1.0) < _scale/5 )
@ -1169,13 +1370,13 @@ namespace Hurricane {
center = dbuToScreenPoint(xGrid,yGrid);
if ( (xGrid % superGridStep) || (yGrid % superGridStep) ) {
if ( lambdaGrid )
_drawingPlanes.painter(2).drawPoint ( center );
_drawingPlanes.painter(PlaneId::Widget).drawPoint ( center );
} else {
if ( lambdaGrid ) {
_drawingPlanes.painter(2).drawLine ( center.x()-3, center.y() , center.x()+3, center.y() );
_drawingPlanes.painter(2).drawLine ( center.x() , center.y()-3, center.x() , center.y()+3 );
_drawingPlanes.painter(PlaneId::Widget).drawLine ( center.x()-3, center.y() , center.x()+3, center.y() );
_drawingPlanes.painter(PlaneId::Widget).drawLine ( center.x() , center.y()-3, center.x() , center.y()+3 );
} else {
_drawingPlanes.painter(2).drawPoint ( center );
_drawingPlanes.painter(PlaneId::Widget).drawPoint ( center );
}
}
}
@ -1420,14 +1621,14 @@ namespace Hurricane {
void CellWidget::paintEvent ( QPaintEvent* event )
{
_drawingPlanes.painterBegin ( 2 );
_drawingPlanes.painterBegin ( PlaneId::Widget );
_drawingPlanes.copyToScreen ();
for ( size_t i=0 ; i<_commands.size() ; i++ )
_commands[i]->draw ( this );
if ( isDrawable("grid") ) drawGrid ();
if ( isDrawable("spot") ) _spot.moveTo ( _mousePosition );
_drawingPlanes.painterEnd ( 2 );
_drawingPlanes.painterEnd ( PlaneId::Widget );
}
@ -1744,6 +1945,10 @@ namespace Hurricane {
Occurrence occurrence ( *component );
select ( occurrence );
}
forEach ( Rubber*, rubber, net->getRubbers() ) {
Occurrence occurrence ( *rubber );
select ( occurrence );
}
if ( !delayRedraw && _showSelection ) _redrawManager.refresh ();
}
@ -1755,6 +1960,10 @@ namespace Hurricane {
Occurrence occurrence ( *component );
unselect ( occurrence );
}
forEach ( Rubber*, rubber, net->getRubbers() ) {
Occurrence occurrence ( *rubber );
unselect ( occurrence );
}
if ( !delayRedraw && _showSelection ) _redrawManager.refresh ();
}
@ -1768,7 +1977,7 @@ namespace Hurricane {
void CellWidget::_unselectAll ( bool delayRedraw )
{
set<Selector*>::iterator iselector;
SelectorSet::iterator iselector;
while ( !_selectors.empty() )
(*_selectors.begin())->detachFrom ( this );

View File

@ -288,8 +288,8 @@ namespace Hurricane {
if ( getCellWidget() != cellWidget ) {
ControllerTab::setCellWidget ( cellWidget );
if ( getCellWidget() ) {
connect ( getCellWidget(), SIGNAL(selectionChanged(const set<Selector*>&,Cell*))
, _selection , SLOT (setSelection (const set<Selector*>&,Cell*)) );
connect ( getCellWidget(), SIGNAL(selectionChanged(const SelectorSet&,Cell*))
, _selection , SLOT (setSelection (const SelectorSet&,Cell*)) );
connect ( _selection , SIGNAL(occurrenceToggled(Occurrence,bool))
, getCellWidget(), SLOT (toggleSelect (Occurrence,bool)) );
connect ( getCellWidget(), SIGNAL(occurrenceToggled(Occurrence))

View File

@ -27,6 +27,8 @@
#include <QCheckBox>
#include <QSpinBox>
#include <QGroupBox>
#include <QButtonGroup>
#include <QRadioButton>
#include <QGridLayout>
#include <QVBoxLayout>
@ -50,7 +52,11 @@ namespace Hurricane {
, _doMasterCells (new QCheckBox())
, _doTerminalCells(new QCheckBox())
, _doComponents (new QCheckBox())
, _steiner (new QRadioButton())
, _centric (new QRadioButton())
, _barycentric (new QRadioButton())
, _queryFilter (Query::DoAll)
, _signalEmitter (false)
{
setAttribute ( Qt::WA_QuitOnClose, false );
setWindowTitle ( tr("Display Filter") );
@ -107,7 +113,35 @@ namespace Hurricane {
groupBox->setLayout ( gLayout );
wLayout->addWidget ( groupBox );
groupBox = new QGroupBox ( tr("Rubbers") );
QHBoxLayout* hLayout = new QHBoxLayout ();
QButtonGroup* group = new QButtonGroup ();
hLayout->setContentsMargins ( 5, 0, 5, 0 );
_centric->setText ( tr("Centric") );
_centric->setFont ( Graphics::getNormalFont() );
group->setId ( _centric, 0 );
group->addButton ( _centric );
hLayout->addWidget ( _centric );
_barycentric->setText ( tr("Barycentric") );
_barycentric->setFont ( Graphics::getNormalFont() );
group->setId ( _barycentric, 1 );
group->addButton ( _barycentric );
hLayout->addWidget ( _barycentric );
_steiner->setText ( tr("Steiner") );
_steiner->setFont ( Graphics::getNormalFont() );
group->setId ( _steiner, 2 );
group->addButton ( _steiner );
hLayout->addWidget ( _steiner );
groupBox->setLayout ( hLayout );
wLayout->addWidget ( groupBox );
wLayout->addStretch ();
setLayout ( wLayout );
connect ( _startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(startLevelChanged(int)) );
@ -125,11 +159,35 @@ namespace Hurricane {
}
_cellWidget = cw;
connect ( this, SIGNAL(filterChanged()), _cellWidget, SLOT(refresh()) );
connect ( this , SIGNAL(filterChanged()) , _cellWidget, SLOT(refresh()) );
connect ( _cellWidget , SIGNAL(settingsChanged()), this , SLOT(syncFromCellWidget()) );
connect ( _steiner , SIGNAL(clicked()) , this , SLOT(setRubberSteiner()) );
connect ( _centric , SIGNAL(clicked()) , this , SLOT(setRubberCentric()) );
connect ( _barycentric, SIGNAL(clicked()) , this , SLOT(setRubberBarycentric()) );
_signalEmitter = false;
syncFromCellWidget ();
}
void DisplayFilterWidget::syncFromCellWidget ()
{
if ( !_cellWidget ) return;
if ( _signalEmitter ) {
_signalEmitter = false;
return;
}
_doMasterCells ->setChecked ( _cellWidget->getQueryFilter() & Query::DoMasterCells );
_doTerminalCells->setChecked ( _cellWidget->getQueryFilter() & Query::DoTerminalCells );
_doComponents ->setChecked ( _cellWidget->getQueryFilter() & Query::DoComponents );
switch ( _cellWidget->getRubberShape() ) {
case CellWidget::Steiner: _steiner->setChecked(true); break;
case CellWidget::Centric: _centric->setChecked(true); break;
case CellWidget::Barycentric: _barycentric->setChecked(true); break;
}
_signalEmitter = false;
}
@ -141,6 +199,7 @@ namespace Hurricane {
_stopSpinBox->setValue ( level );
return;
}
_signalEmitter = true;
emit filterChanged();
}
}
@ -154,6 +213,7 @@ namespace Hurricane {
_startSpinBox->setValue ( level );
return;
}
_signalEmitter = true;
emit filterChanged();
}
}
@ -166,6 +226,7 @@ namespace Hurricane {
_cellWidget->setQueryFilter ( _queryFilter );
_signalEmitter = true;
emit filterChanged();
}
@ -177,6 +238,7 @@ namespace Hurricane {
_cellWidget->setQueryFilter ( _queryFilter );
_signalEmitter = true;
emit filterChanged();
}
@ -188,8 +250,39 @@ namespace Hurricane {
_cellWidget->setQueryFilter ( _queryFilter );
_signalEmitter = true;
emit filterChanged();
}
void DisplayFilterWidget::setRubberSteiner ()
{
if ( _cellWidget ) {
if ( _cellWidget->getRubberShape() != CellWidget::Steiner )
_cellWidget->setRubberShape ( CellWidget::Steiner );
//emit filterChanged();
}
}
void DisplayFilterWidget::setRubberCentric ()
{
if ( _cellWidget ) {
if ( _cellWidget->getRubberShape() != CellWidget::Centric )
_cellWidget->setRubberShape ( CellWidget::Centric );
//emit filterChanged();
}
}
void DisplayFilterWidget::setRubberBarycentric ()
{
if ( _cellWidget ) {
if ( _cellWidget->getRubberShape() != CellWidget::Barycentric )
_cellWidget->setRubberShape ( CellWidget::Barycentric );
//emit filterChanged();
}
}
}

View File

@ -40,8 +40,8 @@ namespace Hurricane {
MoveCommand::MoveCommand ()
: Command ()
, _active (false)
, _lastPosition()
, _firstEvent (true)
, _lastPosition()
{ }
@ -76,9 +76,11 @@ namespace Hurricane {
if ( _active && !event->isAutoRepeat() ) {
_active = false;
widget->popCursor ();
return true;
}
break;
}
return false;
}

View File

@ -31,7 +31,6 @@
#include "hurricane/Entity.h"
#include "hurricane/Occurrence.h"
#include "hurricane/viewer/Graphics.h"
#include "hurricane/viewer/Selector.h"
#include "hurricane/viewer/SelectionModel.h"
#include "hurricane/viewer/SelectionWidget.h"
@ -66,11 +65,11 @@ namespace Hurricane {
}
void SelectionModel::setSelection ( const set<Selector*>& selection )
void SelectionModel::setSelection ( const SelectorSet& selection )
{
if ( !isCumulative() ) _selection.clear ();
set<Selector*>::const_iterator iselector = selection.begin();
SelectorSet::const_iterator iselector = selection.begin();
vector<OccurrenceItem>::iterator iitem;
for ( ; iselector != selection.end() ; iselector++ ) {
if ( isCumulative() ) {

View File

@ -187,7 +187,7 @@ namespace Hurricane {
}
void SelectionWidget::setSelection ( const set<Selector*>& selection, Cell* cell )
void SelectionWidget::setSelection ( const SelectorSet& selection, Cell* cell )
{
_baseModel->setSelection ( selection );

View File

@ -24,8 +24,12 @@
// x-----------------------------------------------------------------x
#include "hurricane/Quark.h"
#include "hurricane/Error.h"
#include "hurricane/Quark.h"
#include "hurricane/Instance.h"
#include "hurricane/Component.h"
#include "hurricane/Rubber.h"
#include "hurricane/ExtensionGo.h"
#include "hurricane/viewer/Selector.h"
#include "hurricane/viewer/CellWidget.h"
@ -36,6 +40,52 @@ namespace Hurricane {
using namespace std;
// -------------------------------------------------------------------
// Comparison Class : "Hurricane::SelectorLess::Selector".
//
// Perform: lhs < rhs
bool SelectorLess::operator () ( const Selector* lhs, const Selector* rhs ) const
{
const Entity* lhsEntity = lhs->getOccurrence().getEntity();
const Entity* rhsEntity = rhs->getOccurrence().getEntity();
const Instance* lhsInstance = dynamic_cast<const Instance*> ( lhsEntity );
const Instance* rhsInstance = dynamic_cast<const Instance*> ( rhsEntity );
//cerr << "Instance LHS: " << (void*)lhsInstance << " RHS: " << (void*)rhsInstance << endl;
if ( lhsInstance && rhsInstance ) return lhs < rhs; // lhs & rhs are Instances.
if ( lhsInstance && !rhsInstance ) return true; // lhs only is an Instance.
if ( !lhsInstance && rhsInstance ) return false; // rhs only is an Instance.
const Component* lhsComponent = dynamic_cast<const Component*> ( lhsEntity );
const Component* rhsComponent = dynamic_cast<const Component*> ( rhsEntity );
if ( lhsComponent && rhsComponent ) return lhs < rhs; // lhs & rhs are Components.
if ( lhsComponent && !rhsComponent ) return true; // lhs only is an Component.
if ( !lhsComponent && rhsComponent ) return false; // rhs only is an Component.
const Rubber* lhsRubber = dynamic_cast<const Rubber*> ( lhsEntity );
const Rubber* rhsRubber = dynamic_cast<const Rubber*> ( rhsEntity );
if ( lhsRubber && rhsRubber ) return lhs < rhs; // lhs & rhs are Rubbers.
if ( lhsRubber && !rhsRubber ) return true; // lhs only is an Rubber.
if ( !lhsRubber && rhsRubber ) return false; // rhs only is an Rubber.
const ExtensionGo* lhsExtensionGo = dynamic_cast<const ExtensionGo*> ( lhsEntity );
const ExtensionGo* rhsExtensionGo = dynamic_cast<const ExtensionGo*> ( rhsEntity );
if ( lhsExtensionGo && rhsExtensionGo ) { // lhs & rhs are ExtensionGos.
if ( lhsExtensionGo->getName() == rhsExtensionGo->getName() )
return lhs < rhs;
return lhsExtensionGo->getName() < rhsExtensionGo->getName();
}
if ( lhsExtensionGo && !rhsExtensionGo ) return true; // lhs only is an ExtensionGo.
if ( !lhsExtensionGo && rhsExtensionGo ) return false; // rhs only is an ExtensionGo.
return lhs < rhs;
}
// -------------------------------------------------------------------
// Class : "Hurricane::Selector".

View File

@ -91,8 +91,10 @@ namespace Hurricane {
QRect zoomArea = QRect ( _startPoint, _stopPoint );
if ( ( zoomArea.width() > 10 ) && ( zoomArea.height() > 10 ) )
widget->reframe ( widget->screenToDbuBox(zoomArea) );
else
else {
cerr << Warning("Rejecting too small zoom request.") << endl;
widget->update ();
}
return false;
}

View File

@ -1,78 +0,0 @@
<?xml version="1.0"?>
<graphicsconfiguration>
<displaystyles>
<displaystyle name="Alliance">
<group name="viewer">
<drawingstyle name="fallback" color="0,0,0" border="1"/>
<drawingstyle name="background" color="50,50,50" border="1"/>
<drawingstyle name="foreground" color="255,255,255" border="1"/>
<drawingstyle name="rubber" color="192,0,192" border="1"/>
<drawingstyle name="phantom" color="139,134,130" border="1"/>
<drawingstyle name="boundaries" color="208,199,192" border="1" pattern="0000000000000000"/>
<drawingstyle name="marker" color="80,250,80" border="1"/>
<drawingstyle name="selectionDraw" color="255,255,255" border="1"/>
<drawingstyle name="selectionFill" color="255,255,255" border="1"/>
<drawingstyle name="grid" color="255,255,255" border="1"/>
<drawingstyle name="spot" color="255,255,255" border="1"/>
<drawingstyle name="gost" color="255,255,255" border="1"/>
<drawingstyle name="text" color="255,255,255" border="0" pattern="8822441188224411"/>
<drawingstyle name="undef" color="238,130,238" border="0" pattern="2244118822441188"/>
</group>
<group name="Active Layers">
<drawingstyle name="NWELL" color="210,180,140" pattern="55AA55AA55AA55AA" threshold="1.50"/>
<drawingstyle name="PWELL" color="255,255,224" pattern="55AA55AA55AA55AA" threshold="1.50"/>
<drawingstyle name="ntie" color="0,255,127" pattern="55AA55AA55AA55AA" threshold="1.50"/>
<drawingstyle name="ptie" color="238,221,130" pattern="55AA55AA55AA55AA" threshold="1.50"/>
<drawingstyle name="ndif" color="124,252,0" pattern="55AA55AA55AA55AA" threshold="1.50"/>
<drawingstyle name="pdif" color="255,255,0" pattern="55AA55AA55AA55AA" threshold="1.50"/>
<drawingstyle name="ntrans" color="255,0,0" pattern="55AA55AA55AA55AA" threshold="1.20"/>
<drawingstyle name="ptrans" color="255,0,0" pattern="55AA55AA55AA55AA" threshold="1.20"/>
<drawingstyle name="poly" color="255,0,0" pattern="55AA55AA55AA55AA" threshold="1.20"/>
</group>
<group name="Routing Layers">
<drawingstyle name="ALU1" color="0,0,255" pattern="AA55AA55AA55AA55" threshold="0.80"/>
<drawingstyle name="ALU2" color="0,255,255" pattern="8822882288228822" threshold="0.80"/>
<drawingstyle name="ALU3" color="255,182,193" pattern="4411441144114411" threshold="0.80"/>
<drawingstyle name="ALU4" color="0,255,0" pattern="2288228822882288" threshold="0.80"/>
<drawingstyle name="ALU5" color="255,255,0" pattern="1144114411441144" threshold="0.80"/>
<drawingstyle name="ALU6" color="238,130,238" pattern="8822882288228822" threshold="0.80"/>
</group>
<group name="VIA Holes">
<drawingstyle name="VIA1" color="0,255,255" threshold="0.40"/>
<drawingstyle name="VIA2" color="255,182,193" threshold="0.40"/>
<drawingstyle name="VIA3" color="0,255,0" threshold="0.40"/>
<drawingstyle name="VIA4" color="255,255,0" threshold="0.40"/>
<drawingstyle name="VIA5" color="238,130,238" threshold="0.40"/>
</group>
<group name="Obstacles">
<drawingstyle name="TALU1" color="0,0,255" pattern="006070381c0e0703" threshold="0.80" border="2"/>
<drawingstyle name="TALU2" color="0,255,255" pattern="8103060c183060c0" threshold="0.80" border="2"/>
<drawingstyle name="TALU3" color="255,182,193" pattern="8800220088002200" threshold="0.80" border="2"/>
<drawingstyle name="TALU4" color="0,255,0" pattern="2288228822882288" threshold="0.80" border="2"/>
<drawingstyle name="TALU5" color="255,255,0" pattern="1144114411441144" threshold="0.80" border="2"/>
<drawingstyle name="TALU6" color="238,130,238" pattern="8822882288228822" threshold="0.80" border="2"/>
</group>
<group name="Knick &amp; Kite">
<drawingstyle name="SPL1" color="255,0,0"/>
<drawingstyle name="AutoLayer" color="255,0,255"/>
<drawingstyle name="GALU2" color="128,255,200" pattern="8822882288228822"/>
<drawingstyle name="GALU3" color="200,200,255" pattern="4411441144114411"/>
<drawingstyle name="GCONTACT" color="255,255,190"/>
</group>
</displaystyle>
<displaystyle name="Compass" inherit="Alliance">
<group name="viewer">
<drawingstyle name="fallback" color="255,255,255" border="1"/>
<drawingstyle name="background" color="255,255,255" border="1"/>
<drawingstyle name="foreground" color="0,0,0" border="1"/>
<drawingstyle name="selectionDraw" color="0,0,0" border="1"/>
<drawingstyle name="selectionFill" color="0,0,0" border="1"/>
<drawingstyle name="grid" color="0,0,0" border="1"/>
<drawingstyle name="spot" color="0,0,0" border="1"/>
<drawingstyle name="gost" color="0,0,0" border="1"/>
<drawingstyle name="text" color="0,0,0" border="0" pattern="8822441188224411"/>
<drawingstyle name="undef" color="0,0,0" border="0" pattern="2244118822441188"/>
</group>
</displaystyle>
</displaystyles>
</graphicsconfiguration>

View File

@ -79,6 +79,7 @@ namespace Hurricane {
public slots:
void showController ();
void openHistoryCell ();
void printDisplay ();
signals:
void redrawCellWidget ();
@ -89,12 +90,14 @@ namespace Hurricane {
QAction* _openAction;
QAction* _nextAction;
QAction* _cellHistoryAction[CellHistorySize];
QAction* _printAction;
QAction* _saveAction;
QAction* _closeAction;
QAction* _exitAction;
QAction* _refreshAction;
QAction* _fitToContentsAction;
QAction* _showSelectionAction;
QAction* _rubberChangeAction;
QAction* _controllerAction;
QMenu* _fileMenu;
QMenu* _viewMenu;

View File

@ -33,6 +33,7 @@
#include <QWidget>
#include <QPixmap>
#include <QPainter>
#include <QPrinter>
#include <QRect>
#include <QPoint>
@ -92,6 +93,11 @@ namespace Hurricane {
, const Transformation&
);
typedef void ( InitExtensionGo_t )( CellWidget* );
public:
enum RubberShape { Centric = 1
, Barycentric
, Steiner
};
public:
// Constructor & Destructor.
CellWidget ( QWidget* parent=NULL );
@ -110,7 +116,9 @@ namespace Hurricane {
inline bool cumulativeSelection () const;
inline Occurrences getOccurrencesUnder ( const QRect& ) const;
Occurrences getOccurrencesUnder ( const Box& ) const;
inline set<Selector*>& getSelectorSet ();
inline SelectorSet& getSelectorSet ();
inline void setRubberShape ( RubberShape );
inline RubberShape getRubberShape () const;
inline void setStartLevel ( int );
inline void setStopLevel ( int );
inline void setQueryFilter ( int );
@ -118,7 +126,9 @@ namespace Hurricane {
inline bool timeout ( const char*, const Timer&, double timeout, bool& timedout ) const;
// Painter control & Hurricane objects drawing primitives.
inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* );
inline QPainter& getPainter ( size_t plane=3 );
inline QPainter& getPainter ( size_t plane=PlaneId::Working );
inline int getDarkening () const;
inline void copyToPrinter ( QPrinter* printer );
inline float getScale () const;
inline const QPoint& getMousePosition () const;
bool isDrawable ( const Name& );
@ -126,18 +136,19 @@ namespace Hurricane {
bool isDrawableExtension ( const Name& );
bool isSelectable ( const Name& ) const;
bool isSelectable ( const Layer* ) const;
inline void setPen ( const QPen& , size_t plane=3 );
inline void setDarkening ( int );
inline void setPen ( const QPen& , size_t plane=PlaneId::Working );
void drawBox ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit );
void drawBox ( const Box& );
void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit );
void drawLine ( const Point&, const Point& );
void drawText ( const Point&, const Name&, int angle=0, bool reverse=false );
void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit, bool mode=true );
void drawLine ( const Point&, const Point&, bool mode=true );
void drawText ( const Point&, const Name&, int angle=0, bool reverse=false );
void drawGrid ();
void drawSpot ();
void drawScreenLine ( const QPoint&, const QPoint&, size_t plane=3 );
void drawScreenRect ( const QPoint&, const QPoint&, size_t plane=3 );
void drawScreenRect ( const QRect&, size_t plane=3 );
void drawScreenPolyline ( const QPoint*, int, int, size_t plane=3 );
void drawScreenLine ( const QPoint&, const QPoint&, size_t plane=PlaneId::Working, bool mode=true );
void drawScreenRect ( const QPoint&, const QPoint&, size_t plane=PlaneId::Working );
void drawScreenRect ( const QRect& , size_t plane=PlaneId::Working );
void drawScreenPolyline ( const QPoint*, int, int, size_t plane=PlaneId::Working );
// Geometric conversions.
QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const;
QRect dbuToDisplayRect ( const Box& box ) const;
@ -175,9 +186,10 @@ namespace Hurricane {
void cellChanged ( Cell* );
void cellPreModificated ();
void cellPostModificated ();
void settingsChanged ();
void updatePalette ( Cell* );
void mousePositionChanged ( const Point& position );
void selectionChanged ( const set<Selector*>&, Cell* );
void selectionChanged ( const SelectorSet&, Cell* );
void occurrenceToggled ( Occurrence );
void showSelectionToggled ( bool );
public slots:
@ -198,6 +210,7 @@ namespace Hurricane {
void _unselect ( const Net* net, bool delayRedraw=false );
void _selectOccurrencesUnder ( Box selectArea );
void _unselectAll ( bool delayRedraw );
void rubberChange ();
void updatePalette ();
void cellPreModificate ();
void cellPostModificate ();
@ -210,7 +223,7 @@ namespace Hurricane {
void goUp ( int dy = 0 );
void goDown ( int dy = 0 );
void fitToContents ( bool delayed=false );
void setScale ( float scale );
void setScale ( float );
void setShowBoundaries ( bool state );
void reframe ( const Box& box, bool delayed=false );
void displayReframe ( bool delayed=false );
@ -277,6 +290,17 @@ namespace Hurricane {
bool _refreshInterrupt;
};
public:
class PlaneId {
public:
enum Ids { Normal = 0
, Selection = 1
, Widget = 2
, Printer = 3
, Working = 4
};
};
private:
class DrawingPlanes {
public:
@ -287,10 +311,10 @@ namespace Hurricane {
inline int height () const;
inline QSize size () const;
inline void select ( size_t i );
inline QPainter& painter ( size_t i=3 );
inline void painterBegin ( size_t i=3 );
inline QPainter& painter ( size_t i=PlaneId::Working );
inline void painterBegin ( size_t i=PlaneId::Working );
inline void paintersBegin ();
inline void painterEnd ( size_t i=3 );
inline void painterEnd ( size_t i=PlaneId::Working );
inline void paintersEnd ();
void setLineMode ( bool mode );
void setPen ( const QPen& pen );
@ -303,13 +327,17 @@ namespace Hurricane {
void shiftUp ( int dy );
void shiftDown ( int dy );
inline void copyToSelect ();
inline void copyToSelect ( const QRect& );
void copyToSelect ( int sx, int sy, int h, int w );
inline void copyToScreen ();
void copyToScreen ( int sx, int sy, int h, int w );
inline void copyToPrinter ( QPrinter* );
void copyToPrinter ( int sx, int sy, int h, int w, QPrinter* );
private:
CellWidget* _cellWidget;
QPrinter* _printer;
QPixmap* _planes[2];
QPainter _painters[3];
QPainter _painters[4];
QPen _normalPen;
QPen _linePen;
size_t _workingPlane;
@ -336,15 +364,27 @@ namespace Hurricane {
void setDrawExtensionGo ( const Name& );
virtual bool hasMasterCellCallback () const;
virtual bool hasGoCallback () const;
virtual bool hasRubberCallback () const;
virtual bool hasExtensionGoCallback () const;
virtual void masterCellCallback ();
virtual void goCallback ( Go* go );
virtual void extensionGoCallback ( Go* go );
virtual void goCallback ( Go* );
virtual void rubberCallback ( Rubber* );
virtual void extensionGoCallback ( Go* );
void drawGo ( const Go* go
, const BasicLayer* basicLayer
, const Box& area
, const Transformation& transformation
);
void drawRubber ( const Rubber* rubber
, const Box& area
, const Transformation& transformation
);
void drawExtensionGo ( CellWidget* widget
, const Go* go
, const BasicLayer* basicLayer
, const Box& area
, const Transformation& transformation
);
inline unsigned int getGoCount () const;
inline unsigned int getInstanceCount () const;
inline void resetGoCount ();
@ -368,10 +408,12 @@ namespace Hurricane {
);
virtual bool hasMasterCellCallback () const;
virtual bool hasGoCallback () const;
virtual bool hasRubberCallback () const;
virtual bool hasExtensionGoCallback () const;
virtual void masterCellCallback ();
virtual void extensionGoCallback ( Go* go );
virtual void goCallback ( Go* go );
virtual void extensionGoCallback ( Go* go );
virtual void rubberCallback ( Rubber* );
protected:
CellWidget* _cellWidget;
@ -408,6 +450,7 @@ namespace Hurricane {
DrawingQuery _drawingQuery;
TextDrawingQuery _textDrawingQuery;
int _queryFilter;
int _darkening;
QPoint _mousePosition;
Spot _spot;
Cell* _cell;
@ -418,11 +461,12 @@ namespace Hurricane {
bool _selectionHasChanged;
int _delaySelectionChanged;
bool _cellModificated;
set<Selector*> _selectors;
SelectorSet _selectors;
SelectorCriterions _selection;
vector<Command*> _commands;
size_t _redrawRectCount;
int _textFontHeight;
RubberShape _rubberShape;
friend class RedrawManager;
};
@ -521,14 +565,18 @@ namespace Hurricane {
inline QPainter& CellWidget::DrawingPlanes::painter ( size_t i )
{ return _painters[(i>2)?_workingPlane:i]; }
{ return _painters[(i>3)?_workingPlane:i]; }
inline void CellWidget::DrawingPlanes::painterBegin ( size_t i )
{
if ( i>2 ) i = _workingPlane;
if ( i<2 ) _painters[i].begin ( _planes[i] );
else _painters[i].begin ( _cellWidget );
switch ( i ) {
case 4: i = _workingPlane;
case 0:
case 1: _painters[i].begin ( _planes[i] ); break;
case 2: _painters[2].begin ( _cellWidget ); break;
case 3: _painters[3].begin ( _printer ); break;
}
}
@ -540,7 +588,7 @@ namespace Hurricane {
inline void CellWidget::DrawingPlanes::painterEnd ( size_t i )
{ _painters[(i>2)?_workingPlane:i].end (); }
{ _painters[(i>3)?_workingPlane:i].end (); }
inline void CellWidget::DrawingPlanes::paintersEnd ()
@ -554,10 +602,25 @@ namespace Hurricane {
{ copyToSelect ( 0, 0, width(), height() ); }
inline void CellWidget::DrawingPlanes::copyToSelect ( const QRect& r )
{ copyToSelect ( r.x(), r.y(), r.width(), r.height() ); }
inline void CellWidget::DrawingPlanes::copyToScreen ()
{ copyToScreen ( 0, 0, width(), height() ); }
inline void CellWidget::DrawingPlanes::copyToPrinter ( QPrinter* printer )
{
copyToPrinter ( 0
, 0
, _cellWidget->geometry().width()
, _cellWidget->geometry().height()
, printer
);
}
inline void CellWidget::addDrawExtensionGo ( const Name& name
, InitExtensionGo_t* initExtensionGo
, DrawExtensionGo_t* drawExtensionGo
@ -577,7 +640,7 @@ namespace Hurricane {
{ return _drawingPlanes; }
inline set<Selector*>& CellWidget::getSelectorSet ()
inline SelectorSet& CellWidget::getSelectorSet ()
{ return _selectors; }
@ -597,6 +660,10 @@ namespace Hurricane {
{ redrawSelection ( QRect(QPoint(0,0),_drawingPlanes.size()) ); }
inline void CellWidget::copyToPrinter ( QPrinter* printer )
{ _drawingPlanes.copyToPrinter ( printer ); }
inline int CellWidget::dbuToDisplayX ( DbU::Unit x ) const
{ return (int)rint ( (float)( x - _displayArea.getXMin() ) * _scale ); }
@ -689,6 +756,10 @@ namespace Hurricane {
{ return _drawingPlanes.painter(plane); }
inline int CellWidget::getDarkening () const
{ return _darkening; }
inline float CellWidget::getScale () const
{ return _scale; }
@ -705,10 +776,25 @@ namespace Hurricane {
{ return _queryFilter; }
inline void CellWidget::setRubberShape ( RubberShape shape )
{
_rubberShape = shape;
refresh ();
}
inline CellWidget::RubberShape CellWidget::getRubberShape () const
{ return _rubberShape; }
inline void CellWidget::setPen ( const QPen& pen, size_t plane )
{ _drawingPlanes.painter(plane).setPen(pen); }
inline void CellWidget::setDarkening ( int darkening )
{ _darkening = darkening; }
inline bool CellWidget::timeout ( const char* fname, const Timer& timer, double timeout, bool& timedout ) const
{
if ( timedout ) return true;

View File

@ -31,6 +31,7 @@
class QSpinBox;
class QCheckBox;
class QRadioButton;
namespace Hurricane {
@ -43,27 +44,35 @@ namespace Hurricane {
Q_OBJECT;
public:
DisplayFilterWidget ( QWidget* parent=NULL );
void setCellWidget ( CellWidget* );
signals:
void filterChanged ();
public slots:
void startLevelChanged ( int level );
void stopLevelChanged ( int level );
void setDoMasterCells ( int state );
void setDoComponents ( int state );
void setDoTerminalCells ( int state );
DisplayFilterWidget ( QWidget* parent=NULL );
void setCellWidget ( CellWidget* );
signals:
void filterChanged ();
public slots:
void syncFromCellWidget ();
void startLevelChanged ( int level );
void stopLevelChanged ( int level );
void setDoMasterCells ( int state );
void setDoComponents ( int state );
void setDoTerminalCells ( int state );
void setRubberSteiner ();
void setRubberCentric ();
void setRubberBarycentric ();
protected:
CellWidget* _cellWidget;
QSpinBox* _startSpinBox;
QSpinBox* _stopSpinBox;
QCheckBox* _doMasterCells;
QCheckBox* _doTerminalCells;
QCheckBox* _doComponents;
int _queryFilter;
CellWidget* _cellWidget;
QSpinBox* _startSpinBox;
QSpinBox* _stopSpinBox;
QCheckBox* _doMasterCells;
QCheckBox* _doTerminalCells;
QCheckBox* _doComponents;
QRadioButton* _steiner;
QRadioButton* _centric;
QRadioButton* _barycentric;
int _queryFilter;
bool _signalEmitter;
};

View File

@ -36,14 +36,12 @@
#include "hurricane/Commons.h"
#include "hurricane/Occurrence.h"
#include "hurricane/viewer/Graphics.h"
#include "hurricane/viewer/Selector.h"
namespace Hurricane {
class Selector;
class OccurrenceItem {
public:
enum Flags { Selected=1 };
@ -82,7 +80,7 @@ namespace Hurricane {
public:
SelectionModel ( QObject* parent=NULL );
~SelectionModel ();
void setSelection ( const set<Selector*>& selection );
void setSelection ( const SelectorSet& selection );
void toggleSelection ( Occurrence occurrence );
Occurrence toggleSelection ( const QModelIndex& index );
int rowCount ( const QModelIndex& parent=QModelIndex() ) const;

View File

@ -71,7 +71,7 @@ namespace Hurricane {
public slots:
void setShowSelection ( bool );
void selectCurrent ( const QModelIndex& current, const QModelIndex& );
void setSelection ( const set<Selector*>& selection, Cell* cell=NULL );
void setSelection ( const SelectorSet& selection, Cell* cell=NULL );
void toggleSelection ( Occurrence occurrence );
void toggleSelection ( const QModelIndex& index );
void forceRowHeight ();

View File

@ -38,6 +38,11 @@ namespace Hurricane {
class CellWidget;
struct SelectorLess {
bool operator () ( const Selector* lhs, const Selector* rhs ) const;
};
class Selector : public PrivateProperty {
public:
@ -72,6 +77,9 @@ namespace Hurricane {
inline set<CellWidget*>& Selector::getCellWidgetSet () { return _cellWidgets; }
typedef set<Selector*,SelectorLess> SelectorSet;
} // End of Hurricane namespace.