* ./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:
parent
e58c397360
commit
8961968b8b
|
@ -249,13 +249,15 @@ namespace Hurricane {
|
|||
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 ( _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() );
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ()) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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, "<" );
|
||||
pos = protect.find ( '<', pos );
|
||||
}
|
||||
pos = protect.find ( '>' );
|
||||
while ( pos < protect.size() ) {
|
||||
protect.replace ( pos, 1, ">" );
|
||||
pos = protect.find ( '>', pos );
|
||||
}
|
||||
return protect;
|
||||
}
|
||||
|
||||
|
||||
bool Graphics::breakpointStopCb ( const string& message )
|
||||
{
|
||||
static BreakpointWidget* bpw = NULL;
|
||||
|
|
|
@ -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
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
|
|
@ -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 );
|
||||
|
@ -119,7 +119,7 @@ namespace Hurricane {
|
|||
, this , SLOT(textFilterChanged()) );
|
||||
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&))
|
||||
|
@ -180,10 +180,19 @@ namespace Hurricane {
|
|||
|
||||
void SelectionWidget::setShowSelection ( bool state )
|
||||
{
|
||||
if ( state == _showSelection->isChecked() ) return;
|
||||
static bool isEmitter = false;
|
||||
|
||||
if ( sender() == _showSelection ) {
|
||||
isEmitter = true;
|
||||
emit showSelectionToggled ( state );
|
||||
} else {
|
||||
if ( !isEmitter ) {
|
||||
_showSelection->blockSignals ( true );
|
||||
_showSelection->setChecked ( state );
|
||||
emit showSelection ( state );
|
||||
_showSelection->blockSignals ( false );
|
||||
} else
|
||||
isEmitter = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,6 +215,7 @@ namespace Hurricane {
|
|||
void SelectionWidget::clear ()
|
||||
{
|
||||
_baseModel->clear ();
|
||||
_view->selectionModel()->clearSelection ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
@ -86,6 +90,7 @@ namespace Hurricane {
|
|||
private:
|
||||
class DrawingPlanes;
|
||||
public:
|
||||
class State;
|
||||
typedef void ( DrawExtensionGo_t )( CellWidget*
|
||||
, const Go*
|
||||
, const BasicLayer*
|
||||
|
@ -93,7 +98,6 @@ namespace Hurricane {
|
|||
, const Transformation&
|
||||
);
|
||||
typedef void ( InitExtensionGo_t )( CellWidget* );
|
||||
public:
|
||||
enum RubberShape { Centric = 1
|
||||
, Barycentric
|
||||
, Steiner
|
||||
|
@ -105,7 +109,9 @@ namespace Hurricane {
|
|||
// 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 ();
|
||||
|
@ -193,6 +199,8 @@ namespace Hurricane {
|
|||
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 ();
|
||||
|
@ -427,18 +435,42 @@ namespace Hurricane {
|
|||
private:
|
||||
class SelectorCriterions {
|
||||
public:
|
||||
SelectorCriterions ( CellWidget* );
|
||||
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; }
|
||||
{ return _state->showSelection(); }
|
||||
|
||||
|
||||
inline bool CellWidget::cumulativeSelection () const
|
||||
{ return _cumulativeSelection; }
|
||||
{ return _state->cumulativeSelection(); }
|
||||
|
||||
|
||||
inline QPainter& CellWidget::getPainter ( size_t plane )
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue