* ./hurricane/src/hviewer :

- New feature: CellWidget now store it's internal state in a separate
        nested object CellWidgetState. The State is work in progress, currently
        is store the Cell*, showSelection, cumulativeSelection, selection
        criterions and showBoundaries. showBoundaries may evolve to be stored
        as part of the Palette's state.
    - Change: implement the "start" propagation model signal/slot for
        showSelection, cumulativeSelection & showBoundaries. The main concern
        is to avoid signals loop. See SelectionWidget::setShowSelection(bool)
        for an example.
    - Change: supress the minimumSize of the SelectionWidget (200 pixels is a
        waste of space when the Path is empty).
This commit is contained in:
Jean-Paul Chaput 2009-01-27 10:14:46 +00:00
parent e58c397360
commit 8961968b8b
11 changed files with 408 additions and 234 deletions

View File

@ -246,16 +246,18 @@ 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 ( _rubberChangeAction , SIGNAL(triggered()) , _cellWidget, SLOT(rubberChange()) );
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)) , this , 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 ( this , SIGNAL(showSelectionToggled(bool))
, _cellWidget , SLOT (setShowSelection (bool)) );
connect ( _cellWidget , SIGNAL(showSelectionToggled(bool))
, _showSelectionAction , SLOT(setChecked(bool)) );
, this , SLOT (setShowSelection (bool)) );
connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence,bool))
, _cellWidget , SLOT (toggleSelect (Occurrence,bool)) );
@ -323,6 +325,24 @@ namespace Hurricane {
}
void CellViewer::setShowSelection ( bool state )
{
static bool isEmitter = false;
if ( sender() == _showSelectionAction ) {
isEmitter = true;
emit showSelectionToggled ( state );
} else {
if ( !isEmitter ) {
_showSelectionAction->blockSignals ( true );
_showSelectionAction->setChecked ( state );
_showSelectionAction->blockSignals ( false );
} else
isEmitter = false;
}
}
void CellViewer::openHistoryCell ()
{
QAction* historyAction = qobject_cast<QAction*> ( sender() );

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
@ -768,8 +768,8 @@ namespace Hurricane {
// Class : "Hurricane::CellWidget::SelectorCriterions".
CellWidget::SelectorCriterions::SelectorCriterions ( CellWidget* cw )
: _cellWidget(cw)
CellWidget::SelectorCriterions::SelectorCriterions ()
: _cellWidget(NULL)
, _criterions()
{ }
@ -782,6 +782,7 @@ namespace Hurricane {
bool CellWidget::SelectorCriterions::add ( const Net* net, bool delayRedraw )
{
if ( !_cellWidget ) return false;
if ( !_cellWidget->isSelected(Occurrence(net)) ) {
_criterions.push_back ( new NetSelectorCriterion(net) );
_criterions.back()->doSelection ( _cellWidget, delayRedraw );
@ -793,6 +794,7 @@ namespace Hurricane {
bool CellWidget::SelectorCriterions::add ( Box area )
{
if ( !_cellWidget ) return false;
_criterions.push_back ( new AreaSelectorCriterion(area) );
_criterions.back()->doSelection ( _cellWidget, true );
return true;
@ -801,6 +803,7 @@ namespace Hurricane {
bool CellWidget::SelectorCriterions::remove ( const Net* net, bool delayRedraw )
{
if ( !_cellWidget ) return false;
if ( !_cellWidget->isSelected(Occurrence(net)) ) return false;
size_t i=0;
@ -820,14 +823,17 @@ namespace Hurricane {
void CellWidget::SelectorCriterions::clear ()
{
for ( size_t i=0 ; i<_criterions.size() ; i++ )
for ( size_t i=0 ; i<_criterions.size() ; i++ ) {
delete _criterions[i];
}
_criterions.clear ();
}
void CellWidget::SelectorCriterions::revalidate ()
{
if ( !_cellWidget ) return;
size_t i = 0;
size_t last = _criterions.size ();
while ( i < last ) {
@ -865,16 +871,12 @@ namespace Hurricane {
, _darkening (100)
, _mousePosition (0,0)
, _spot (this)
, _cell (NULL)
, _state (new State(NULL))
, _cellChanged (true)
, _showBoundaries (true)
, _showSelection (false)
, _cumulativeSelection (false)
, _selectionHasChanged (false)
, _delaySelectionChanged(0)
, _cellModificated (true)
, _selectors ()
, _selection (this)
, _commands ()
, _redrawRectCount (0)
, _textFontHeight (20)
@ -1004,8 +1006,8 @@ namespace Hurricane {
void CellWidget::setShowSelection ( bool state )
{
if ( state != _showSelection ) {
_showSelection = state;
if ( state != _state->showSelection() ) {
_state->setShowSelection ( state );
_selectionHasChanged = false;
refresh ();
@ -1016,7 +1018,21 @@ namespace Hurricane {
void CellWidget::setCumulativeSelection ( bool state )
{
_cumulativeSelection = state;
if ( state != _state->cumulativeSelection() ) {
_state->setCumulativeSelection ( state );
emit cumulativeSelectionToggled ( state );
}
}
void CellWidget::setShowBoundaries ( bool state )
{
if ( _state->showBoundaries() != state ) {
_state->setShowBoundaries ( state );
refresh ();
emit showBoundariesToggled ( state );
}
}
@ -1038,7 +1054,7 @@ namespace Hurricane {
pushCursor ( Qt::BusyCursor );
if ( ! ( _selectionHasChanged && _showSelection ) || _cellModificated ) {
if ( ! ( _selectionHasChanged && _state->showSelection() ) || _cellModificated ) {
_spot.setRestore ( false );
//_drawingPlanes.copyToSelect ( redrawArea );
_drawingPlanes.select ( PlaneId::Normal );
@ -1050,9 +1066,9 @@ namespace Hurricane {
_drawingPlanes.painter().eraseRect ( redrawArea );
//repaint ();
setDarkening ( (_showSelection) ? Graphics::getDarkening() : 100 );
setDarkening ( (_state->showSelection()) ? Graphics::getDarkening() : 100 );
if ( _cell ) {
if ( getCell() ) {
Box redrawBox = displayToDbuBox ( redrawArea );
@ -1123,7 +1139,7 @@ namespace Hurricane {
}
//_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells );
forEach ( ExtensionSlice*, islice, _cell->getExtensionSlices() ) {
forEach ( ExtensionSlice*, islice, getCell()->getExtensionSlices() ) {
QApplication::processEvents();
if ( /*timeout("redraw [extension]",timer,10.0,timedout) ||*/ (_redrawManager.interrupted()) ) break;
@ -1146,7 +1162,7 @@ namespace Hurricane {
if ( isDrawable("grid") ) drawGrid ( redrawArea );
setDarkening ( 100 );
if ( _showSelection )
if ( _state->showSelection() )
redrawSelection ( redrawArea );
popCursor ();
@ -1188,7 +1204,7 @@ namespace Hurricane {
_drawingPlanes.painter().setBackground ( Graphics::getBrush("background") );
_drawingPlanes.painter().setClipRect ( redrawArea );
if ( _cell ) {
if ( getCell() ) {
Box redrawBox = displayToDbuBox ( redrawArea );
SelectorSet::iterator iselector;
@ -1539,7 +1555,7 @@ namespace Hurricane {
, DbU::lambda(50)
);
if ( _cell ) boundingBox = _cell->getBoundingBox();
if ( getCell() ) boundingBox = getCell()->getBoundingBox();
reframe ( boundingBox, delayed );
}
@ -1840,27 +1856,35 @@ namespace Hurricane {
}
void CellWidget::setShowBoundaries ( bool state )
{
if ( _showBoundaries != state ) {
_showBoundaries = state;
_redrawManager.refresh ();
}
}
void CellWidget::setCell ( Cell* cell )
{
//cerr << "CellWidget::setCell() - " << cell << endl;
if ( cell == getCell() ) return;
shared_ptr<State> state ( new State(cell) );
setState ( state );
}
void CellWidget::setState ( shared_ptr<State>& state )
{
//cerr << "CellWidget::setCell() - " << cell << endl;
if ( state.get() == _state.get() ) return;
cellPreModificate ();
_state->getSelection().clear ();
_state->setCellWidget ( NULL );
_cellChanged = true;
_cell = cell;
_drawingQuery .setCell ( cell );
_textDrawingQuery.setCell ( cell );
_state = state;
emit cellChanged ( cell );
_state->setCellWidget ( this );
_drawingQuery .setCell ( getCell() );
_textDrawingQuery.setCell ( getCell() );
emit cellChanged ( getCell() );
fitToContents ( true );
@ -1878,10 +1902,10 @@ namespace Hurricane {
{
++_delaySelectionChanged;
if ( !_cumulativeSelection ) unselectAll ( true );
bool added = _selection.add ( net, delayRedraw );
if ( !_state->cumulativeSelection() ) unselectAll ( true );
bool added = _state->getSelection().add ( net, delayRedraw );
if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors,_cell);
if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors,getCell());
}
@ -1890,8 +1914,12 @@ namespace Hurricane {
if ( !occurrence.isValid() )
throw Error ( "Can't select occurrence : invalid occurrence" );
if ( occurrence.getOwnerCell() != getCell() )
throw Error ( "Can't select occurrence : incompatible occurrence" );
if ( occurrence.getOwnerCell() != getCell() ) {
string s1 = Graphics::toHtml ( getString(occurrence.getOwnerCell()) );
string s2 = Graphics::toHtml ( getString(getCell()) );
throw Error ( "Can't select occurrence : incompatible occurrence %s vs. %s"
, s1.c_str(), s2.c_str() );
}
Property* property = occurrence.getProperty ( Selector::getPropertyName() );
if ( !property )
@ -1910,10 +1938,14 @@ namespace Hurricane {
if ( !occurrence.isValid() )
throw Error ( "Can't select occurrence : invalid occurrence" );
if ( occurrence.getOwnerCell() != getCell() )
throw Error ( "Can't select occurrence : incompatible occurrence" );
if ( occurrence.getOwnerCell() != getCell() ) {
string s1 = Graphics::toHtml ( getString(occurrence.getOwnerCell()) );
string s2 = Graphics::toHtml ( getString(getCell()) );
throw Error ( "Can't select occurrence : incompatible occurrence %s vs. %s"
, s1.c_str(), s2.c_str() );
}
//if ( !_cumulativeSelection ) unselectAll ( true );
//if ( !_state->cumulativeSelection() ) unselectAll ( true );
Property* property = occurrence.getProperty ( Selector::getPropertyName() );
Selector* selector = NULL;
@ -1928,7 +1960,7 @@ namespace Hurricane {
selector->attachTo(this);
_selectionHasChanged = true;
if ( !_delaySelectionChanged ) emit selectionChanged(_selectors,_cell);
if ( !_delaySelectionChanged ) emit selectionChanged(_selectors,getCell());
}
@ -1936,10 +1968,10 @@ namespace Hurricane {
{
++_delaySelectionChanged;
if ( !_cumulativeSelection ) unselectAll ( true );
bool added = _selection.add ( selectArea );
if ( !_state->cumulativeSelection() ) unselectAll ( true );
bool added = _state->getSelection().add ( selectArea );
if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors,_cell);
if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors,getCell());
}
@ -1947,8 +1979,8 @@ namespace Hurricane {
{
++_delaySelectionChanged;
bool removed = _selection.remove ( net, delayRedraw );
if ( !--_delaySelectionChanged && removed ) emit selectionChanged(_selectors,_cell);
bool removed = _state->getSelection().remove ( net, delayRedraw );
if ( !--_delaySelectionChanged && removed ) emit selectionChanged(_selectors,getCell());
}
@ -1970,7 +2002,7 @@ namespace Hurricane {
}
_selectionHasChanged = true;
if ( !_delaySelectionChanged ) emit selectionChanged(_selectors,_cell);
if ( !_delaySelectionChanged ) emit selectionChanged(_selectors,getCell());
}
@ -1978,10 +2010,10 @@ namespace Hurricane {
{
++_delaySelectionChanged;
_selection.clear ();
_state->getSelection().clear ();
_unselectAll ( delayRedraw );
if ( !--_delaySelectionChanged ) emit selectionChanged(_selectors,_cell);
if ( !--_delaySelectionChanged ) emit selectionChanged(_selectors,getCell());
}
@ -2006,7 +2038,7 @@ namespace Hurricane {
}
_selectionHasChanged = true;
if ( _showSelection ) _redrawManager.refresh ();
if ( _state->showSelection() ) _redrawManager.refresh ();
if ( fromPopup ) emit occurrenceToggled ( occurrence );
}
@ -2023,7 +2055,7 @@ namespace Hurricane {
Occurrence occurrence ( *rubber );
select ( occurrence );
}
if ( !delayRedraw && _showSelection ) _redrawManager.refresh ();
if ( !delayRedraw && _state->showSelection() ) _redrawManager.refresh ();
}
@ -2038,7 +2070,7 @@ namespace Hurricane {
Occurrence occurrence ( *rubber );
unselect ( occurrence );
}
if ( !delayRedraw && _showSelection ) _redrawManager.refresh ();
if ( !delayRedraw && _state->showSelection() ) _redrawManager.refresh ();
}
@ -2056,7 +2088,7 @@ namespace Hurricane {
(*_selectors.begin())->detachFrom ( this );
if ( !_selectionHasChanged ) _selectionHasChanged = true;
if ( !delayRedraw && _showSelection ) _redrawManager.refresh ();
if ( !delayRedraw && _state->showSelection() ) _redrawManager.refresh ();
}
@ -2064,7 +2096,7 @@ namespace Hurricane {
{
_unselectAll ( true );
emit selectionChanged(_selectors,_cell);
emit selectionChanged(_selectors,getCell());
emit cellPreModificated ();
}
@ -2074,13 +2106,13 @@ namespace Hurricane {
_cellModificated = true;
++_delaySelectionChanged;
_selection.revalidate ();
_state->getSelection().revalidate ();
updatePalette ();
_redrawManager.refresh ();
--_delaySelectionChanged;
emit selectionChanged(_selectors,_cell);
emit selectionChanged(_selectors,getCell());
emit cellPostModificated ();
}

View File

@ -224,7 +224,7 @@ namespace Hurricane {
if ( !_cwCumulativeSelection )
getCellWidget()->unselectAll ( true );
getCellWidget()->setCumulativeSelection ( true );
getCellWidget()->setShowSelection ( true );
getCellWidget()->setShowSelection ( true );
connect ( _netlistBrowser, SIGNAL(netSelected (const Net*)), getCellWidget(), SLOT(select (const Net*)) );
connect ( _netlistBrowser, SIGNAL(netUnselected(const Net*)), getCellWidget(), SLOT(unselect(const Net*)) );
} else {
@ -296,12 +296,12 @@ namespace Hurricane {
, _selection , SLOT (toggleSelection (Occurrence)) );
connect ( _selection , SIGNAL(cumulativeToggled (bool))
, getCellWidget(), SLOT (setCumulativeSelection(bool)) );
connect ( _selection , SIGNAL(selectionCleared())
, getCellWidget(), SLOT (unselectAll ()) );
connect ( _selection , SIGNAL(showSelectionToggled(bool))
, getCellWidget(), SLOT (setShowSelection (bool)) );
connect ( getCellWidget(), SIGNAL(showSelectionToggled(bool))
, _selection , SLOT (setShowSelection (bool)) );
connect ( _selection , SIGNAL(selectionCleared())
, getCellWidget(), SLOT (unselectAll ()) );
}
}
}

View File

@ -273,6 +273,26 @@ namespace Hurricane {
}
string Graphics::toHtml ( const string& s )
{
string protect = s;
if ( !isEnabled() ) return protect;
unsigned int pos = protect.find ( '<' );
while ( pos < protect.size() ) {
protect.replace ( pos, 1, "&lt;" );
pos = protect.find ( '<', pos );
}
pos = protect.find ( '>' );
while ( pos < protect.size() ) {
protect.replace ( pos, 1, "&gt;" );
pos = protect.find ( '>', pos );
}
return protect;
}
bool Graphics::breakpointStopCb ( const string& message )
{
static BreakpointWidget* bpw = NULL;

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//

View File

@ -101,7 +101,7 @@ namespace Hurricane {
QHeaderView* horizontalHeader = _view->horizontalHeader ();
horizontalHeader->setStretchLastSection ( true );
horizontalHeader->setMinimumSectionSize ( 200 );
//horizontalHeader->setMinimumSectionSize ( 200 );
QHeaderView* verticalHeader = _view->verticalHeader ();
verticalHeader->setVisible ( false );
@ -117,13 +117,13 @@ namespace Hurricane {
connect ( _filterPatternLineEdit, SIGNAL(textChanged(const QString &))
, this , SLOT(textFilterChanged()) );
connect ( _baseModel , SIGNAL(layoutChanged()), this, SLOT(forceRowHeight()) );
connect ( _baseModel , SIGNAL(layoutChanged()), this, SLOT (forceRowHeight()) );
connect ( _cumulative , SIGNAL(toggled(bool)) , this, SIGNAL(cumulativeToggled(bool)) );
connect ( _showSelection, SIGNAL(toggled(bool)) , this, SIGNAL(showSelectionToggled(bool)) );
connect ( _showSelection, SIGNAL(toggled(bool)) , this, SLOT (setShowSelection(bool)) );
connect ( clear , SIGNAL(clicked()) , this, SIGNAL(selectionCleared()) );
connect ( clear , SIGNAL(clicked()) , _baseModel, SLOT(clear()) );
connect ( _view->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&))
, this , SLOT(selectCurrent (const QModelIndex&,const QModelIndex&)) );
, this , SLOT (selectCurrent (const QModelIndex&,const QModelIndex&)) );
setWindowTitle ( tr("Selection<None>") );
resize ( 500, 300 );
@ -180,10 +180,19 @@ namespace Hurricane {
void SelectionWidget::setShowSelection ( bool state )
{
if ( state == _showSelection->isChecked() ) return;
static bool isEmitter = false;
_showSelection->setChecked ( state );
emit showSelection ( state );
if ( sender() == _showSelection ) {
isEmitter = true;
emit showSelectionToggled ( state );
} else {
if ( !isEmitter ) {
_showSelection->blockSignals ( true );
_showSelection->setChecked ( state );
_showSelection->blockSignals ( false );
} else
isEmitter = false;
}
}
@ -206,6 +215,7 @@ namespace Hurricane {
void SelectionWidget::clear ()
{
_baseModel->clear ();
_view->selectionModel()->clearSelection ();
}

View File

@ -77,10 +77,12 @@ namespace Hurricane {
void unselect ( Occurrence& occurence );
void unselectAll ();
public slots:
void setShowSelection ( bool );
void showController ();
void openHistoryCell ();
void printDisplay ();
signals:
void showSelectionToggled ( bool );
void redrawCellWidget ();
public:

View File

@ -29,6 +29,7 @@
#include <math.h>
#include <vector>
#include <tr1/memory>
#include <QWidget>
#include <QPixmap>
@ -63,6 +64,9 @@ class QAction;
namespace Hurricane {
using std::vector;
using std::tr1::shared_ptr;
class Technology;
class BasicLayer;
class Go;
@ -84,8 +88,9 @@ namespace Hurricane {
Q_OBJECT;
private:
class DrawingPlanes;
class DrawingPlanes;
public:
class State;
typedef void ( DrawExtensionGo_t )( CellWidget*
, const Go*
, const BasicLayer*
@ -93,147 +98,150 @@ namespace Hurricane {
, const Transformation&
);
typedef void ( InitExtensionGo_t )( CellWidget* );
public:
enum RubberShape { Centric = 1
, Barycentric
, Steiner
};
enum RubberShape { Centric = 1
, Barycentric
, Steiner
};
public:
// Constructor & Destructor.
CellWidget ( QWidget* parent=NULL );
virtual ~CellWidget ();
// Accessors.
// MapView* getMapView () { return _mapView; };
void setCell ( Cell* );
inline Cell* getCell () const;
inline PaletteWidget* getPalette ();
void bindToPalette ( PaletteWidget* );
void detachFromPalette ();
void bindCommand ( Command* );
void unbindCommand ( Command* );
inline bool showBoundaries () const;
inline bool showSelection () const;
inline bool cumulativeSelection () const;
inline Occurrences getOccurrencesUnder ( const QRect& ) const;
Occurrences getOccurrencesUnder ( const Box& ) const;
inline SelectorSet& getSelectorSet ();
inline void setRubberShape ( RubberShape );
inline RubberShape getRubberShape () const;
inline void setStartLevel ( int );
inline void setStopLevel ( int );
inline void setQueryFilter ( int );
inline int getQueryFilter () const ;
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=PlaneId::Working );
inline int getDarkening () const;
inline void copyToPrinter ( QPrinter* printer );
inline float getScale () const;
inline const QPoint& getMousePosition () const;
bool isDrawable ( const Name& );
bool isDrawableLayer ( const Name& );
bool isDrawableExtension ( const Name& );
bool isSelectable ( const Name& ) const;
bool isSelectable ( const Layer* ) const;
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, 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 ( QRect );
void drawSpot ();
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, bool usePoint=true ) const;
QRect dbuToDisplayRect ( const Box& box , bool usePoint=true ) const;
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
QPoint dbuToDisplayPoint ( const Point& point ) const;
inline int dbuToDisplayX ( DbU::Unit x ) const;
inline int dbuToDisplayY ( DbU::Unit y ) const;
inline int dbuToDisplayLength ( DbU::Unit length ) const;
inline int dbuToScreenX ( DbU::Unit x ) const;
inline int dbuToScreenY ( DbU::Unit y ) const;
QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
inline QPoint dbuToScreenPoint ( const Point& point ) const;
inline DbU::Unit displayToDbuX ( int x ) const;
inline DbU::Unit displayToDbuY ( int y ) const;
inline DbU::Unit displayToDbuLength ( int length ) const;
inline Box displayToDbuBox ( const QRect& rect ) const;
inline DbU::Unit screenToDbuX ( int x ) const;
inline DbU::Unit screenToDbuY ( int y ) const;
inline Point screenToDbuPoint ( const QPoint& point ) const;
inline Box screenToDbuBox ( const QRect& rect ) const;
// Qt QWidget Functions Overloads.
void pushCursor ( Qt::CursorShape cursor );
void popCursor ();
virtual QSize minimumSizeHint () const;
virtual void showEvent ( QShowEvent* );
virtual void paintEvent ( QPaintEvent* );
virtual void resizeEvent ( QResizeEvent* );
virtual void wheelEvent ( QWheelEvent* );
virtual void keyPressEvent ( QKeyEvent* );
virtual void keyReleaseEvent ( QKeyEvent* );
virtual void mouseMoveEvent ( QMouseEvent* );
virtual void mousePressEvent ( QMouseEvent* );
virtual void mouseReleaseEvent ( QMouseEvent* );
CellWidget ( QWidget* parent=NULL );
virtual ~CellWidget ();
// Accessors.
// MapView* getMapView () { return _mapView; };
void setCell ( Cell* );
void setState ( shared_ptr<State>& );
inline Cell* getCell () const;
inline shared_ptr<State>& getState ();
inline PaletteWidget* getPalette ();
void bindToPalette ( PaletteWidget* );
void detachFromPalette ();
void bindCommand ( Command* );
void unbindCommand ( Command* );
inline bool showBoundaries () const;
inline bool showSelection () const;
inline bool cumulativeSelection () const;
inline Occurrences getOccurrencesUnder ( const QRect& ) const;
Occurrences getOccurrencesUnder ( const Box& ) const;
inline SelectorSet& getSelectorSet ();
inline void setRubberShape ( RubberShape );
inline RubberShape getRubberShape () const;
inline void setStartLevel ( int );
inline void setStopLevel ( int );
inline void setQueryFilter ( int );
inline int getQueryFilter () const ;
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=PlaneId::Working );
inline int getDarkening () const;
inline void copyToPrinter ( QPrinter* printer );
inline float getScale () const;
inline const QPoint& getMousePosition () const;
bool isDrawable ( const Name& );
bool isDrawableLayer ( const Name& );
bool isDrawableExtension ( const Name& );
bool isSelectable ( const Name& ) const;
bool isSelectable ( const Layer* ) const;
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, 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 ( QRect );
void drawSpot ();
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, bool usePoint=true ) const;
QRect dbuToDisplayRect ( const Box& box , bool usePoint=true ) const;
QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const;
QPoint dbuToDisplayPoint ( const Point& point ) const;
inline int dbuToDisplayX ( DbU::Unit x ) const;
inline int dbuToDisplayY ( DbU::Unit y ) const;
inline int dbuToDisplayLength ( DbU::Unit length ) const;
inline int dbuToScreenX ( DbU::Unit x ) const;
inline int dbuToScreenY ( DbU::Unit y ) const;
QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
inline QPoint dbuToScreenPoint ( const Point& point ) const;
inline DbU::Unit displayToDbuX ( int x ) const;
inline DbU::Unit displayToDbuY ( int y ) const;
inline DbU::Unit displayToDbuLength ( int length ) const;
inline Box displayToDbuBox ( const QRect& rect ) const;
inline DbU::Unit screenToDbuX ( int x ) const;
inline DbU::Unit screenToDbuY ( int y ) const;
inline Point screenToDbuPoint ( const QPoint& point ) const;
inline Box screenToDbuBox ( const QRect& rect ) const;
// Qt QWidget Functions Overloads.
void pushCursor ( Qt::CursorShape cursor );
void popCursor ();
virtual QSize minimumSizeHint () const;
virtual void showEvent ( QShowEvent* );
virtual void paintEvent ( QPaintEvent* );
virtual void resizeEvent ( QResizeEvent* );
virtual void wheelEvent ( QWheelEvent* );
virtual void keyPressEvent ( QKeyEvent* );
virtual void keyReleaseEvent ( QKeyEvent* );
virtual void mouseMoveEvent ( QMouseEvent* );
virtual void mousePressEvent ( QMouseEvent* );
virtual void mouseReleaseEvent ( QMouseEvent* );
signals:
void cellChanged ( Cell* );
void cellPreModificated ();
void cellPostModificated ();
void settingsChanged ();
void styleChanged ( void* emitter );
void updatePalette ( Cell* );
void mousePositionChanged ( const Point& position );
void selectionChanged ( const SelectorSet&, Cell* );
void occurrenceToggled ( Occurrence );
void showSelectionToggled ( bool );
public slots:
// Qt QWidget Slots Overload & CellWidget Specifics.
inline DrawingPlanes& getDrawingPlanes ();
inline QPoint& getOffsetVA ();
void select ( const Net* net, bool delayRedraw=false );
void select ( Occurrence occurence );
bool isSelected ( Occurrence occurence );
void selectOccurrencesUnder ( Box selectArea );
void unselect ( const Net* net, bool delayRedraw=false );
void unselect ( Occurrence occurence );
void unselectAll ( bool delayRedraw=false );
void toggleSelect ( Occurrence occurence, bool fromPopup );
void setShowSelection ( bool state );
void setCumulativeSelection ( bool state );
void _select ( const Net* net, bool delayRedraw=false );
void _unselect ( const Net* net, bool delayRedraw=false );
void _selectOccurrencesUnder ( Box selectArea );
void _unselectAll ( bool delayRedraw );
void rubberChange ();
void styleChange ( void* emitter );
void updatePalette ();
void cellPreModificate ();
void cellPostModificate ();
inline void refresh ();
void _redraw ( QRect redrawArea );
inline void redrawSelection ();
void redrawSelection ( QRect redrawArea );
void goLeft ( int dx = 0 );
void goRight ( int dx = 0 );
void goUp ( int dy = 0 );
void goDown ( int dy = 0 );
void fitToContents ( bool delayed=false );
void setScale ( float );
void setShowBoundaries ( bool state );
void reframe ( const Box& box, bool delayed=false );
void displayReframe ( bool delayed=false );
void _goLeft ( int dx );
void _goRight ( int dx );
void _goUp ( int dy );
void _goDown ( int dy );
void _refresh ();
void cellChanged ( Cell* );
void cellPreModificated ();
void cellPostModificated ();
void settingsChanged ();
void styleChanged ( void* emitter );
void updatePalette ( Cell* );
void mousePositionChanged ( const Point& position );
void selectionChanged ( const SelectorSet&, Cell* );
void occurrenceToggled ( Occurrence );
void showSelectionToggled ( bool );
void cumulativeSelectionToggled ( bool );
void showBoundariesToggled ( bool );
public slots:
// Qt QWidget Slots Overload & CellWidget Specifics.
inline DrawingPlanes& getDrawingPlanes ();
inline QPoint& getOffsetVA ();
void select ( const Net* net, bool delayRedraw=false );
void select ( Occurrence occurence );
bool isSelected ( Occurrence occurence );
void selectOccurrencesUnder ( Box selectArea );
void unselect ( const Net* net, bool delayRedraw=false );
void unselect ( Occurrence occurence );
void unselectAll ( bool delayRedraw=false );
void toggleSelect ( Occurrence occurence, bool fromPopup );
void setShowSelection ( bool state );
void setCumulativeSelection ( bool state );
void _select ( const Net* net, bool delayRedraw=false );
void _unselect ( const Net* net, bool delayRedraw=false );
void _selectOccurrencesUnder ( Box selectArea );
void _unselectAll ( bool delayRedraw );
void rubberChange ();
void styleChange ( void* emitter );
void updatePalette ();
void cellPreModificate ();
void cellPostModificate ();
inline void refresh ();
void _redraw ( QRect redrawArea );
inline void redrawSelection ();
void redrawSelection ( QRect redrawArea );
void goLeft ( int dx = 0 );
void goRight ( int dx = 0 );
void goUp ( int dy = 0 );
void goDown ( int dy = 0 );
void fitToContents ( bool delayed=false );
void setScale ( float );
void setShowBoundaries ( bool state );
void reframe ( const Box& box, bool delayed=false );
void displayReframe ( bool delayed=false );
void _goLeft ( int dx );
void _goRight ( int dx );
void _goUp ( int dy );
void _goDown ( int dy );
void _refresh ();
private:
class Spot {
@ -427,18 +435,42 @@ namespace Hurricane {
private:
class SelectorCriterions {
public:
SelectorCriterions ( CellWidget* );
~SelectorCriterions ();
bool add ( const Net* net, bool delayRedraw );
bool add ( Box area );
bool remove ( const Net* net, bool delayRedraw );
void clear ();
void revalidate ();
SelectorCriterions ();
~SelectorCriterions ();
inline void setCellWidget ( CellWidget* );
bool add ( const Net* net, bool delayRedraw );
bool add ( Box area );
bool remove ( const Net* net, bool delayRedraw );
void clear ();
void revalidate ();
inline size_t size () const;
private:
CellWidget* _cellWidget;
vector<SelectorCriterion*> _criterions;
};
public:
class State {
public:
inline State ( Cell* cell=NULL );
inline void setCell ( Cell* );
inline void setCellWidget ( CellWidget* );
inline void setShowBoundaries ( bool );
inline void setShowSelection ( bool );
inline void setCumulativeSelection ( bool );
inline Cell* getCell () const;
inline SelectorCriterions& getSelection ();
inline bool showBoundaries () const;
inline bool showSelection () const;
inline bool cumulativeSelection () const;
private:
Cell* _cell;
SelectorCriterions _selection;
bool _showBoundaries;
bool _showSelection;
bool _cumulativeSelection;
};
protected:
// Internal: Attributes.
static const int _stripWidth;
@ -459,16 +491,12 @@ namespace Hurricane {
int _darkening;
QPoint _mousePosition;
Spot _spot;
Cell* _cell;
shared_ptr<State> _state;
bool _cellChanged;
bool _showBoundaries;
bool _showSelection;
bool _cumulativeSelection;
bool _selectionHasChanged;
int _delaySelectionChanged;
bool _cellModificated;
SelectorSet _selectors;
SelectorCriterions _selection;
vector<Command*> _commands;
size_t _redrawRectCount;
int _textFontHeight;
@ -641,6 +669,67 @@ namespace Hurricane {
}
inline void CellWidget::SelectorCriterions::setCellWidget ( CellWidget* cw )
{ _cellWidget = cw; }
inline size_t CellWidget::SelectorCriterions::size () const
{ return _criterions.size(); }
inline CellWidget::State::State ( Cell* cell )
: _cell (cell)
, _selection ()
, _showBoundaries (true)
, _showSelection (false)
, _cumulativeSelection(false)
{ }
inline void CellWidget::State::setCell ( Cell* cell )
{ _cell = cell; }
inline void CellWidget::State::setCellWidget ( CellWidget* cw )
{ _selection.setCellWidget ( cw ); }
inline void CellWidget::State::setShowBoundaries ( bool state )
{ _showBoundaries = state; }
inline void CellWidget::State::setShowSelection ( bool state )
{ _showSelection = state; }
inline void CellWidget::State::setCumulativeSelection ( bool state )
{ _cumulativeSelection = state; }
inline Cell* CellWidget::State::getCell () const
{ return _cell; }
inline CellWidget::SelectorCriterions& CellWidget::State::getSelection ()
{ return _selection; }
inline bool CellWidget::State::showBoundaries () const
{ return _showBoundaries; }
inline bool CellWidget::State::showSelection () const
{ return _showSelection; }
inline bool CellWidget::State::cumulativeSelection () const
{ return _cumulativeSelection; }
inline shared_ptr<CellWidget::State>& CellWidget::getState ()
{ return _state; }
inline void CellWidget::addDrawExtensionGo ( const Name& name
, InitExtensionGo_t* initExtensionGo
, DrawExtensionGo_t* drawExtensionGo
@ -753,7 +842,7 @@ namespace Hurricane {
inline Cell* CellWidget::getCell () const
{ return _cell; }
{ return _state->getCell(); }
inline PaletteWidget* CellWidget::getPalette ()
@ -761,15 +850,15 @@ namespace Hurricane {
inline bool CellWidget::showBoundaries () const
{ return _showBoundaries; }
{ return _state->showBoundaries(); }
inline bool CellWidget::showSelection () const
{ return _showSelection; }
inline bool CellWidget::showSelection () const
{ return _state->showSelection(); }
inline bool CellWidget::cumulativeSelection () const
{ return _cumulativeSelection; }
{ return _state->cumulativeSelection(); }
inline QPainter& CellWidget::getPainter ( size_t plane )

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
//
// ===================================================================
//
@ -66,6 +66,7 @@ namespace Hurricane {
static float getThreshold ( const Name& key );
static int getDarkening ();
static const ColorScale& getColorScale ( ColorScale::ScaleType );
static string toHtml ( const string& );
static bool breakpointStopCb ( const string& message );
// Modifiers.

View File

@ -149,6 +149,7 @@ namespace Hurricane {
void NetlistWidget::setCell ( Cell* cell )
{
_cell = cell;
_view->selectionModel()->clear ();
_baseModel->setCell<InformationType> ( cell );
string windowTitle = "Netlist" + getString(cell);

View File

@ -59,16 +59,15 @@ namespace Hurricane {
SelectionWidget ( QWidget* parent=NULL );
void inspect ( const QModelIndex& index );
bool isCumulative () const;
void clear ();
signals:
void showSelection ( bool );
void showSelectionToggled ( bool );
void occurrenceToggled ( Occurrence, bool );
void cumulativeToggled ( bool );
void showSelectionToggled ( bool );
void selectionCleared ();
void inspect ( Record* );
void inspect ( Occurrence& );
public slots:
void clear ();
void setShowSelection ( bool );
void selectCurrent ( const QModelIndex& current, const QModelIndex& );
void setSelection ( const SelectorSet& selection, Cell* cell=NULL );