* ./hurricane/src/hviewer :

- Change: modifie GraphicsWidget, PaletteWidget, NetlistWidget &
        SelectionWidget to comply to the "star" model.
This commit is contained in:
Jean-Paul Chaput 2009-02-03 15:05:05 +00:00
parent 35e8d30026
commit 78be633226
22 changed files with 300 additions and 230 deletions

View File

@ -75,6 +75,7 @@ namespace Hurricane {
, _hierarchyCommand() , _hierarchyCommand()
, _cellHistory() , _cellHistory()
, _firstShow(false) , _firstShow(false)
, _updateState(ExternalEmit)
{ {
setObjectName("viewer"); setObjectName("viewer");
@ -227,8 +228,6 @@ namespace Hurricane {
_cellWidget->bindCommand ( &_hierarchyCommand ); _cellWidget->bindCommand ( &_hierarchyCommand );
_controller->setCellWidget ( _cellWidget ); _controller->setCellWidget ( _cellWidget );
_selectCommand.bindToAction ( _showSelectionAction );
MousePositionWidget* _mousePosition = new MousePositionWidget (); MousePositionWidget* _mousePosition = new MousePositionWidget ();
statusBar()->addPermanentWidget ( _mousePosition ); statusBar()->addPermanentWidget ( _mousePosition );
@ -259,10 +258,8 @@ namespace Hurricane {
connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&)) connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&))
, _mousePosition , SLOT(setPosition(const Point&)) ); , _mousePosition , SLOT(setPosition(const Point&)) );
connect ( this , SIGNAL(showSelectionToggled(bool)) connect ( _cellWidget , SIGNAL(selectionModeChanged())
, _cellWidget , SLOT (setShowSelection (bool)) ); , this , SLOT (changeSelectionMode ()) );
connect ( _cellWidget , SIGNAL(showSelectionToggled(bool))
, this , SLOT (setShowSelection (bool)) );
connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence)) connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence))
, _cellWidget , SLOT (toggleSelection (Occurrence)) ); , _cellWidget , SLOT (toggleSelection (Occurrence)) );
@ -366,21 +363,21 @@ namespace Hurricane {
} }
void CellViewer::changeSelectionMode ()
{
if ( _updateState != InternalEmit ) {
_showSelectionAction->blockSignals ( true );
_showSelectionAction->setChecked ( _cellWidget->getState()->cumulativeSelection() );
_showSelectionAction->blockSignals ( false );
}
_updateState = ExternalEmit;
}
void CellViewer::setShowSelection ( bool state ) void CellViewer::setShowSelection ( bool state )
{ {
static bool isEmitter = false; _updateState = InternalEmit;
_cellWidget->setShowSelection ( state );
if ( sender() == _showSelectionAction ) {
isEmitter = true;
emit showSelectionToggled ( state );
} else {
if ( !isEmitter ) {
_showSelectionAction->blockSignals ( true );
_showSelectionAction->setChecked ( state );
_showSelectionAction->blockSignals ( false );
} else
isEmitter = false;
}
} }

View File

@ -71,7 +71,6 @@ namespace Hurricane {
typedef Hurricane::Collection<Occurrence> OccurrenceHC; typedef Hurricane::Collection<Occurrence> OccurrenceHC;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Class : "Occurrences_IsSelectable". // Class : "Occurrences_IsSelectable".
@ -967,10 +966,12 @@ namespace Hurricane {
} }
void CellWidget::styleChange ( void* emitter ) void CellWidget::setStyle ( int id )
{ {
Graphics::setStyle ( (size_t)id );
refresh (); refresh ();
emit styleChanged(emitter);
emit styleChanged ();
} }
@ -988,7 +989,7 @@ namespace Hurricane {
connect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(refresh()) ); connect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(refresh()) );
connect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) ); connect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) );
connect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) ); connect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) );
connect ( this , SIGNAL(styleChanged(void*)) , _palette, SLOT(styleChange(void*)) ); connect ( this , SIGNAL(styleChanged()) , _palette, SLOT(changeStyle()) );
} }
@ -1066,7 +1067,7 @@ namespace Hurricane {
_selectionHasChanged = false; _selectionHasChanged = false;
refresh (); refresh ();
emit showSelectionToggled ( state ); emit selectionModeChanged ();
} }
} }
@ -1075,7 +1076,7 @@ namespace Hurricane {
{ {
if ( state != _state->cumulativeSelection() ) { if ( state != _state->cumulativeSelection() ) {
_state->setCumulativeSelection ( state ); _state->setCumulativeSelection ( state );
emit cumulativeSelectionToggled ( state ); emit selectionModeChanged ();
} }
} }
@ -2062,14 +2063,9 @@ namespace Hurricane {
{ {
++_delaySelectionChanged; ++_delaySelectionChanged;
if ( !_state->cumulativeSelection() ) {
openRefreshSession ();
unselectAll ();
closeRefreshSession ();
}
bool added = _state->getSelection().add ( net ); bool added = _state->getSelection().add ( net );
if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors,getCell()); if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors);
} }
@ -2109,8 +2105,6 @@ namespace Hurricane {
, s1.c_str(), s2.c_str() ); , s1.c_str(), s2.c_str() );
} }
//if ( !_state->cumulativeSelection() ) unselectAll ( true );
Property* property = occurrence.getProperty ( Selector::getPropertyName() ); Property* property = occurrence.getProperty ( Selector::getPropertyName() );
Selector* selector = NULL; Selector* selector = NULL;
if ( !property ) if ( !property )
@ -2124,7 +2118,7 @@ namespace Hurricane {
selector->attachTo(this); selector->attachTo(this);
_selectionHasChanged = true; _selectionHasChanged = true;
if ( !_delaySelectionChanged ) emit selectionChanged(_selectors,getCell()); if ( !_delaySelectionChanged ) emit selectionChanged(_selectors);
} }
@ -2139,7 +2133,7 @@ namespace Hurricane {
} }
bool added = _state->getSelection().add ( selectArea ); bool added = _state->getSelection().add ( selectArea );
if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors,getCell()); if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors);
} }
@ -2148,7 +2142,7 @@ namespace Hurricane {
++_delaySelectionChanged; ++_delaySelectionChanged;
bool removed = _state->getSelection().remove ( net ); bool removed = _state->getSelection().remove ( net );
if ( !--_delaySelectionChanged && removed ) emit selectionChanged(_selectors,getCell()); if ( !--_delaySelectionChanged && removed ) emit selectionChanged(_selectors);
} }
@ -2170,7 +2164,7 @@ namespace Hurricane {
} }
_selectionHasChanged = true; _selectionHasChanged = true;
if ( !_delaySelectionChanged ) emit selectionChanged(_selectors,getCell()); if ( !_delaySelectionChanged ) emit selectionChanged(_selectors);
} }
@ -2181,7 +2175,7 @@ namespace Hurricane {
_state->getSelection().clear (); _state->getSelection().clear ();
_unselectAll (); _unselectAll ();
if ( !--_delaySelectionChanged ) emit selectionChanged(_selectors,getCell()); if ( !--_delaySelectionChanged ) emit selectionChanged(_selectors);
} }
@ -2265,7 +2259,7 @@ namespace Hurricane {
openRefreshSession (); openRefreshSession ();
_unselectAll (); _unselectAll ();
emit selectionChanged(_selectors,getCell()); emit selectionChanged(_selectors);
emit cellPreModificated (); emit cellPreModificated ();
closeRefreshSession (); closeRefreshSession ();
@ -2284,7 +2278,7 @@ namespace Hurricane {
_redrawManager.refresh (); _redrawManager.refresh ();
--_delaySelectionChanged; --_delaySelectionChanged;
emit selectionChanged(_selectors,getCell()); emit selectionChanged(_selectors);
emit cellPostModificated (); emit cellPostModificated ();
closeRefreshSession (); closeRefreshSession ();

View File

@ -97,9 +97,7 @@ namespace Hurricane {
{ {
if ( getCellWidget() != cellWidget ) { if ( getCellWidget() != cellWidget ) {
ControllerTab::setCellWidget ( cellWidget ); ControllerTab::setCellWidget ( cellWidget );
if ( getCellWidget() ) { _graphics->setCellWidget ( cellWidget );
connect ( _graphics, SIGNAL(styleChanged(void*)), getCellWidget(), SLOT(styleChange(void*)) );
}
} }
} }
@ -226,8 +224,7 @@ namespace Hurricane {
getCellWidget()->unselectAll (); getCellWidget()->unselectAll ();
getCellWidget()->closeRefreshSession (); getCellWidget()->closeRefreshSession ();
} }
getCellWidget()->setCumulativeSelection ( true ); getCellWidget()->setShowSelection ( true );
getCellWidget()->setShowSelection ( true );
connect ( _netlistBrowser, SIGNAL(netSelected (const Net*)), getCellWidget(), SLOT(select (const Net*)) ); connect ( _netlistBrowser, SIGNAL(netSelected (const Net*)), getCellWidget(), SLOT(select (const Net*)) );
connect ( _netlistBrowser, SIGNAL(netUnselected(const Net*)), getCellWidget(), SLOT(unselect(const Net*)) ); connect ( _netlistBrowser, SIGNAL(netUnselected(const Net*)), getCellWidget(), SLOT(unselect(const Net*)) );
} else { } else {
@ -249,14 +246,9 @@ namespace Hurricane {
{ {
if ( getCellWidget() != cellWidget ) { if ( getCellWidget() != cellWidget ) {
ControllerTab::setCellWidget ( cellWidget ); ControllerTab::setCellWidget ( cellWidget );
_netlistBrowser->setCellWidget<SimpleNetInformations> ( cellWidget );
if ( getCellWidget() ) { if ( getCellWidget() ) {
connect ( _netlistBrowser, SIGNAL(refreshSessionOpened())
, getCellWidget(), SLOT (openRefreshSession()) );
connect ( _netlistBrowser, SIGNAL(refreshSessionClosed())
, getCellWidget(), SLOT (closeRefreshSession()) );
connect ( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) ); connect ( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) );
connect ( _netlistBrowser, SIGNAL(netFitted(const Net*))
, getCellWidget(), SLOT (fitToNet (const Net*)) );
} }
setSyncNetlist ( _syncNetlist->isChecked() ); setSyncNetlist ( _syncNetlist->isChecked() );
} }
@ -296,22 +288,7 @@ namespace Hurricane {
{ {
if ( getCellWidget() != cellWidget ) { if ( getCellWidget() != cellWidget ) {
ControllerTab::setCellWidget ( cellWidget ); ControllerTab::setCellWidget ( cellWidget );
if ( getCellWidget() ) { _selection->setCellWidget ( cellWidget );
connect ( getCellWidget(), SIGNAL(selectionChanged(const SelectorSet&,Cell*))
, _selection , SLOT (setSelection (const SelectorSet&,Cell*)) );
connect ( _selection , SIGNAL(selectionToggled(Occurrence))
, getCellWidget(), SLOT (toggleSelection (Occurrence)) );
connect ( getCellWidget(), SIGNAL(selectionToggled(Occurrence))
, _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)) );
}
} }
} }
@ -335,7 +312,7 @@ namespace Hurricane {
{ {
//updateTab (); //updateTab ();
if ( getCellWidget() && getCellWidget()->getCell() ) { if ( getCellWidget() && getCellWidget()->getCell() ) {
_selection->setSelection ( getCellWidget()->getSelectorSet(), getCellWidget()->getCell() ); _selection->setSelection ( getCellWidget()->getSelectorSet() );
} else } else
_selection->clear (); _selection->clear ();
} }

View File

@ -55,7 +55,7 @@ namespace Hurricane {
, _steiner (new QRadioButton()) , _steiner (new QRadioButton())
, _centric (new QRadioButton()) , _centric (new QRadioButton())
, _barycentric (new QRadioButton()) , _barycentric (new QRadioButton())
, _updateState (External) , _updateState (ExternalEmit)
{ {
setAttribute ( Qt::WA_QuitOnClose, false ); setAttribute ( Qt::WA_QuitOnClose, false );
setWindowTitle ( tr("Display Filter") ); setWindowTitle ( tr("Display Filter") );
@ -145,28 +145,26 @@ namespace Hurricane {
connect ( _startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(startLevelChanged(int)) ); connect ( _startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(startLevelChanged(int)) );
connect ( _stopSpinBox , SIGNAL(valueChanged(int)), this, SLOT(stopLevelChanged (int)) ); connect ( _stopSpinBox , SIGNAL(valueChanged(int)), this, SLOT(stopLevelChanged (int)) );
connect ( _steiner , SIGNAL(clicked()) , this, SLOT(setRubberSteiner()) );
connect ( _centric , SIGNAL(clicked()) , this, SLOT(setRubberCentric()) );
connect ( _barycentric , SIGNAL(clicked()) , this, SLOT(setRubberBarycentric()) );
} }
void DisplayFilterWidget::setCellWidget ( CellWidget* cw ) void DisplayFilterWidget::setCellWidget ( CellWidget* cw )
{ {
if ( !cw ) { if ( _cellWidget ) {
if ( _cellWidget ) { disconnect ( this , SIGNAL(queryFilterChanged()), _cellWidget, SLOT(changeQueryFilter()) );
disconnect ( this , SIGNAL(queryFilterChanged()), _cellWidget, SLOT(changeQueryFilter()) ); disconnect ( _cellWidget , SIGNAL(queryFilterChanged()), this , SLOT(changeQueryFilter()) );
disconnect ( _cellWidget , SIGNAL(queryFilterChanged()), this , SLOT(changeQueryFilter()) );
}
_cellWidget = NULL;
return;
} }
_cellWidget = cw; _cellWidget = cw;
if ( !_cellWidget ) return;
connect ( this , SIGNAL(queryFilterChanged()), _cellWidget, SLOT(changeQueryFilter()) ); connect ( this , SIGNAL(queryFilterChanged()), _cellWidget, SLOT(changeQueryFilter()) );
connect ( _cellWidget , SIGNAL(queryFilterChanged()), this , SLOT(changeQueryFilter()) ); connect ( _cellWidget , SIGNAL(queryFilterChanged()), this , SLOT(changeQueryFilter()) );
connect ( _steiner , SIGNAL(clicked()) , this , SLOT(setRubberSteiner()) );
connect ( _centric , SIGNAL(clicked()) , this , SLOT(setRubberCentric()) );
connect ( _barycentric, SIGNAL(clicked()) , this , SLOT(setRubberBarycentric()) );
_updateState = External; _updateState = ExternalEmit;
changeQueryFilter (); changeQueryFilter ();
} }
@ -179,7 +177,7 @@ namespace Hurricane {
_updateState = InternalReceive; _updateState = InternalReceive;
emit queryFilterChanged (); emit queryFilterChanged ();
} else { } else {
if ( _updateState == External ) { if ( _updateState == ExternalEmit ) {
blockAllSignals ( true ); blockAllSignals ( true );
_startSpinBox->setValue ( _cellWidget->getStartLevel() ); _startSpinBox->setValue ( _cellWidget->getStartLevel() );
@ -196,7 +194,7 @@ namespace Hurricane {
} }
blockAllSignals ( false ); blockAllSignals ( false );
} }
_updateState = External; _updateState = ExternalEmit;
} }
} }

View File

@ -43,7 +43,9 @@ namespace Hurricane {
GraphicsWidget::GraphicsWidget ( QWidget* parent ) GraphicsWidget::GraphicsWidget ( QWidget* parent )
: QWidget(parent) : QWidget (parent)
, _cellWidget (NULL)
, _updateState(ExternalEmit)
{ {
setAttribute ( Qt::WA_QuitOnClose, false ); setAttribute ( Qt::WA_QuitOnClose, false );
setWindowTitle ( tr("Display Styles") ); setWindowTitle ( tr("Display Styles") );
@ -79,15 +81,42 @@ namespace Hurricane {
wLayout->addStretch (); wLayout->addStretch ();
setLayout ( wLayout ); setLayout ( wLayout );
connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(styleChange(int)) ); connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(setStyle(int)) );
} }
void GraphicsWidget::styleChange ( int id ) void GraphicsWidget::setCellWidget ( CellWidget* cw )
{ {
Graphics::setStyle ( (size_t)id ); if ( _cellWidget ) {
//cerr << "GraphicsWidget::setStyle() - " << getString(Graphics::getStyle()->getName()) << endl; disconnect ( _cellWidget, 0, this , 0 );
emit styleChanged ( (void*)this ); disconnect ( this , 0, _cellWidget, 0 );
}
_cellWidget = cw;
if ( !_cellWidget ) return;
connect ( _cellWidget, SIGNAL(styleChanged()), this, SLOT(changeStyle()) );
_updateState = ExternalEmit;
changeStyle ();
}
void GraphicsWidget::changeStyle ()
{
if ( _updateState != InternalEmit ) {
// Should read style here and sets the widget accordingly.
}
_updateState = ExternalEmit;
}
void GraphicsWidget::setStyle ( int id )
{
if ( _cellWidget ) {
_updateState = InternalEmit;
_cellWidget->setStyle ( (size_t)id );
}
} }

View File

@ -52,13 +52,14 @@ namespace Hurricane {
NetlistWidget::NetlistWidget ( QWidget* parent ) NetlistWidget::NetlistWidget ( QWidget* parent )
: QWidget (parent) : QWidget (parent)
, _cell (NULL) , _cellWidget(NULL)
, _baseModel(new NetlistModel(this)) , _cell (NULL)
, _sortModel(new QSortFilterProxyModel(this)) , _baseModel (new NetlistModel(this))
, _view (new QTableView(this)) , _sortModel (new QSortFilterProxyModel(this))
, _rowHeight(20) , _view (new QTableView(this))
, _selecteds() , _rowHeight (20)
, _selecteds ()
{ {
setAttribute ( Qt::WA_DeleteOnClose ); setAttribute ( Qt::WA_DeleteOnClose );
setAttribute ( Qt::WA_QuitOnClose, false ); setAttribute ( Qt::WA_QuitOnClose, false );
@ -131,8 +132,7 @@ namespace Hurricane {
void NetlistWidget::updateSelecteds ( const QItemSelection& , const QItemSelection& ) void NetlistWidget::updateSelecteds ( const QItemSelection& , const QItemSelection& )
{ {
cerr << "open refresh session" << endl; if ( _cellWidget ) _cellWidget->openRefreshSession ();
emit refreshSessionOpened ();
_selecteds.resetAccesses (); _selecteds.resetAccesses ();
@ -165,8 +165,7 @@ namespace Hurricane {
++isel; ++isel;
} }
emit refreshSessionClosed (); if ( _cellWidget ) _cellWidget->closeRefreshSession ();
cerr << "close refresh session" << endl;
} }

View File

@ -90,10 +90,8 @@ namespace Hurricane {
{ } { }
void PaletteItem::styleChange () void PaletteItem::changeStyle ()
{ { }
emit styleChanged ();
}
} // End of Hurricane namespace. } // End of Hurricane namespace.

View File

@ -40,12 +40,12 @@ namespace Hurricane {
, _basicLayer(basicLayer) , _basicLayer(basicLayer)
, _visible (new QCheckBox()) , _visible (new QCheckBox())
, _selectable(new QCheckBox()) , _selectable(new QCheckBox())
, _sample (new DrawingStyleSample(this))
{ {
QHBoxLayout* layout = new QHBoxLayout (); QHBoxLayout* layout = new QHBoxLayout ();
layout->setContentsMargins ( 0, 0, 0, 0 ); layout->setContentsMargins ( 0, 0, 0, 0 );
DrawingStyleSample* sample = new DrawingStyleSample(this); layout->addWidget ( _sample );
layout->addWidget ( sample );
_visible->setChecked ( visible ); _visible->setChecked ( visible );
_visible->setText ( getString(getName()).c_str() ); _visible->setText ( getString(getName()).c_str() );
@ -63,7 +63,6 @@ namespace Hurricane {
setLayout ( layout ); setLayout ( layout );
connect ( this , SIGNAL(styleChanged()), sample, SLOT (redraw ()) );
connect ( _visible , SIGNAL(clicked ()), this , SIGNAL(visibleToggled ()) ); connect ( _visible , SIGNAL(clicked ()), this , SIGNAL(visibleToggled ()) );
connect ( _selectable, SIGNAL(clicked ()), this , SIGNAL(selectableToggled()) ); connect ( _selectable, SIGNAL(clicked ()), this , SIGNAL(selectableToggled()) );
} }
@ -82,6 +81,12 @@ namespace Hurricane {
} }
void PaletteLayerItem::changeStyle ()
{
_sample->redraw ();
}
bool PaletteLayerItem::isItemVisible () const bool PaletteLayerItem::isItemVisible () const
{ {
return _visible->isChecked (); return _visible->isChecked ();

View File

@ -377,17 +377,15 @@ namespace Hurricane {
} }
void PaletteWidget::styleChange ( void* emitter ) void PaletteWidget::changeStyle ()
{ {
if ( emitter == this ) return;
PaletteItems::iterator iitem = _layerItems.begin(); PaletteItems::iterator iitem = _layerItems.begin();
for ( ; iitem != _layerItems.end() ; iitem++ ) for ( ; iitem != _layerItems.end() ; iitem++ )
iitem->second->styleChange (); iitem->second->changeStyle ();
iitem = _extensionGoItems.begin(); iitem = _extensionGoItems.begin();
for ( ; iitem != _extensionGoItems.end() ; iitem++ ) for ( ; iitem != _extensionGoItems.end() ; iitem++ )
iitem->second->styleChange (); iitem->second->changeStyle ();
} }

View File

@ -43,7 +43,6 @@ namespace Hurricane {
SelectCommand::SelectCommand () SelectCommand::SelectCommand ()
: AreaCommand() : AreaCommand()
, _selectAction(NULL)
, _selectionPopup(NULL) , _selectionPopup(NULL)
{ {
_selectionPopup = new SelectionPopup (); _selectionPopup = new SelectionPopup ();
@ -59,12 +58,6 @@ namespace Hurricane {
} }
void SelectCommand::bindToAction ( QAction* action )
{
_selectAction = action;
}
bool SelectCommand::mousePressEvent ( CellWidget* widget, QMouseEvent* event ) bool SelectCommand::mousePressEvent ( CellWidget* widget, QMouseEvent* event )
{ {
if ( isActive() ) return true; if ( isActive() ) return true;
@ -105,15 +98,10 @@ namespace Hurricane {
//widget->unselectAll (); //widget->unselectAll ();
widget->selectOccurrencesUnder ( widget->screenToDbuBox(selectArea) ); widget->selectOccurrencesUnder ( widget->screenToDbuBox(selectArea) );
if ( _selectAction ) { if ( !widget->getState()->showSelection() )
if ( !_selectAction->isChecked() )
_selectAction->setChecked ( true );
else
widget->refresh ();
} else {
widget->setShowSelection ( true ); widget->setShowSelection ( true );
else
widget->refresh (); widget->refresh ();
}
return false; return false;
} }

View File

@ -52,7 +52,7 @@ namespace Hurricane {
{ {
SelectionWidget* widget = qobject_cast<SelectionWidget*>(QObject::parent()); SelectionWidget* widget = qobject_cast<SelectionWidget*>(QObject::parent());
if ( widget ) if ( widget )
return widget->isCumulative(); return widget->cumulativeSelection();
return true; return true;
} }

View File

@ -40,6 +40,7 @@
#include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/Graphics.h"
#include "hurricane/viewer/SelectionModel.h" #include "hurricane/viewer/SelectionModel.h"
#include "hurricane/viewer/SelectionWidget.h" #include "hurricane/viewer/SelectionWidget.h"
#include "hurricane/viewer/CellWidget.h"
namespace Hurricane { namespace Hurricane {
@ -48,6 +49,7 @@ namespace Hurricane {
SelectionWidget::SelectionWidget ( QWidget* parent ) SelectionWidget::SelectionWidget ( QWidget* parent )
: QWidget (parent) : QWidget (parent)
, _cellWidget (NULL)
, _baseModel (new SelectionModel(this)) , _baseModel (new SelectionModel(this))
, _sortModel (new QSortFilterProxyModel(this)) , _sortModel (new QSortFilterProxyModel(this))
, _view (new QTableView(this)) , _view (new QTableView(this))
@ -55,7 +57,7 @@ namespace Hurricane {
, _cumulative (new QCheckBox()) , _cumulative (new QCheckBox())
, _showSelection (new QCheckBox()) , _showSelection (new QCheckBox())
, _rowHeight (20) , _rowHeight (20)
, _isEmitter (false) , _updateState (ExternalEmit)
{ {
setAttribute ( Qt::WA_DeleteOnClose ); setAttribute ( Qt::WA_DeleteOnClose );
setAttribute ( Qt::WA_QuitOnClose, false ); setAttribute ( Qt::WA_QuitOnClose, false );
@ -118,12 +120,14 @@ namespace Hurricane {
setLayout ( vLayout ); setLayout ( vLayout );
connect ( _filterPatternLineEdit, SIGNAL(textChanged(const QString &)) connect ( _filterPatternLineEdit, SIGNAL(textChanged(const QString &))
, this , SLOT(textFilterChanged()) ); , this , SLOT (textFilterChanged()) );
connect ( _baseModel , SIGNAL(layoutChanged()), this, SLOT (forceRowHeight()) );
connect ( _cumulative , SIGNAL(toggled(bool)) , this, SIGNAL(cumulativeToggled(bool)) ); connect ( _baseModel , SIGNAL(layoutChanged()), this , SLOT(forceRowHeight()) );
connect ( _showSelection, SIGNAL(toggled(bool)) , this, SLOT (setShowSelection(bool)) ); connect ( _showSelection, SIGNAL(toggled(bool)) , this , SLOT(setShowSelection(bool)) );
connect ( clear , SIGNAL(clicked()) , this, SIGNAL(selectionCleared()) ); connect ( _cumulative , SIGNAL(toggled(bool)) , this , SLOT(setCumulativeSelection(bool)) );
connect ( clear , SIGNAL(clicked()) , _baseModel, SLOT(clear()) ); connect ( clear , SIGNAL(clicked()) , _baseModel, SLOT(clear()) );
connect ( clear , SIGNAL(clicked()) , this , SLOT(clear()) );
connect ( _view->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)) connect ( _view->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&))
, this , SLOT (selectCurrent (const QModelIndex&,const QModelIndex&)) ); , this , SLOT (selectCurrent (const QModelIndex&,const QModelIndex&)) );
@ -132,12 +136,6 @@ namespace Hurricane {
} }
void SelectionWidget::hideEvent ( QHideEvent* event )
{
//emit showSelected(false);
}
void SelectionWidget::forceRowHeight () void SelectionWidget::forceRowHeight ()
{ {
for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- ) for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- )
@ -158,6 +156,77 @@ namespace Hurricane {
} }
void SelectionWidget::setCellWidget ( CellWidget* cw )
{
if ( _cellWidget ) {
disconnect ( _cellWidget, 0, this , 0 );
disconnect ( this , 0, _cellWidget, 0 );
}
_cellWidget = cw;
if ( !_cellWidget ) return;
connect ( _cellWidget, SIGNAL(selectionModeChanged()), this , SLOT(changeSelectionMode()) );
connect ( _cellWidget, SIGNAL(selectionChanged(const SelectorSet&))
, this , SLOT (setSelection (const SelectorSet&)) );
connect ( _cellWidget, SIGNAL(selectionToggled(Occurrence)), this, SLOT(toggleSelection(Occurrence)) );
_updateState = ExternalEmit;
changeSelectionMode ();
}
void SelectionWidget::changeSelectionMode ()
{
if ( !_cellWidget ) return;
if ( _updateState == InternalEmit ) {
_updateState = InternalReceive;
emit selectionModeChanged ();
} else {
if ( _updateState == ExternalEmit ) {
blockAllSignals ( true );
_showSelection->setChecked ( _cellWidget->getState()->showSelection () );
_cumulative ->setChecked ( _cellWidget->getState()->cumulativeSelection() );
blockAllSignals ( false );
}
_updateState = ExternalEmit;
}
}
void SelectionWidget::blockAllSignals ( bool state )
{
_showSelection->blockSignals ( state );
_cumulative ->blockSignals ( state );
_baseModel ->blockSignals ( state );
}
void SelectionWidget::setShowSelection ( bool state )
{
_updateState = InternalEmit;
_cellWidget->setShowSelection ( state );
}
void SelectionWidget::setCumulativeSelection ( bool state )
{
_updateState = InternalEmit;
_cellWidget->setCumulativeSelection ( state );
}
bool SelectionWidget::cumulativeSelection () const
{
return _cumulative->isChecked ();
}
void SelectionWidget::textFilterChanged () void SelectionWidget::textFilterChanged ()
{ {
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() ); _sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
@ -165,62 +234,39 @@ namespace Hurricane {
} }
bool SelectionWidget::isCumulative () const
{
return _cumulative->isChecked();
}
void SelectionWidget::toggleSelection ( const QModelIndex& index ) void SelectionWidget::toggleSelection ( const QModelIndex& index )
{ {
Occurrence occurrence = _baseModel->toggleSelection ( index ); Occurrence occurrence = _baseModel->toggleSelection ( index );
if ( occurrence.isValid() ) { if ( occurrence.isValid() ) {
_isEmitter = true; _updateState = InternalEmit;
emit selectionToggled ( occurrence ); _cellWidget->toggleSelection ( occurrence );
} }
} }
void SelectionWidget::toggleSelection ( Occurrence occurrence ) void SelectionWidget::toggleSelection ( Occurrence occurrence )
{ {
if ( !_isEmitter ) { if ( _updateState != InternalEmit ) {
blockAllSignals ( true );
_baseModel->toggleSelection ( occurrence ); _baseModel->toggleSelection ( occurrence );
_isEmitter = false; blockAllSignals ( false );
} }
_updateState = ExternalEmit;
} }
void SelectionWidget::setShowSelection ( bool state ) void SelectionWidget::setSelection ( const SelectorSet& selection )
{
static bool isEmitter = false;
if ( sender() == _showSelection ) {
isEmitter = true;
emit showSelectionToggled ( state );
} else {
if ( !isEmitter ) {
_showSelection->blockSignals ( true );
_showSelection->setChecked ( state );
_showSelection->blockSignals ( false );
} else
isEmitter = false;
}
}
void SelectionWidget::setSelection ( const SelectorSet& selection, Cell* cell )
{ {
_baseModel->setSelection ( selection ); _baseModel->setSelection ( selection );
string windowTitle = "Selection"; string windowTitle = "Selection";
Cell* cell = (_cellWidget) ? _cellWidget->getCell() : NULL;
if ( cell ) windowTitle += getString(cell); if ( cell ) windowTitle += getString(cell);
else windowTitle += "<None>"; else windowTitle += "<None>";
setWindowTitle ( tr(windowTitle.c_str()) ); setWindowTitle ( tr(windowTitle.c_str()) );
_view->selectRow ( 0 ); _view->selectRow ( 0 );
_view->resizeColumnToContents ( 0 ); _view->resizeColumnToContents ( 0 );
//if ( !_cumulative->isChecked() ) emit inspect ( NULL );
} }
@ -228,6 +274,8 @@ namespace Hurricane {
{ {
_baseModel->clear (); _baseModel->clear ();
_view->selectionModel()->clearSelection (); _view->selectionModel()->clearSelection ();
if ( _cellWidget )
_cellWidget->unselectAll();
} }

View File

@ -79,6 +79,7 @@ namespace Hurricane {
void unselect ( Occurrence& ); void unselect ( Occurrence& );
void unselectAll (); void unselectAll ();
public slots: public slots:
void changeSelectionMode ();
void setShowSelection ( bool ); void setShowSelection ( bool );
void setState ( shared_ptr<CellWidget::State>& ); void setState ( shared_ptr<CellWidget::State>& );
void showController (); void showController ();
@ -121,6 +122,7 @@ namespace Hurricane {
list< shared_ptr<CellWidget::State> > list< shared_ptr<CellWidget::State> >
_cellHistory; _cellHistory;
bool _firstShow; bool _firstShow;
UpdateState _updateState;
protected: protected:
void createActions (); void createActions ();

View File

@ -85,6 +85,11 @@ namespace Hurricane {
class Command; class Command;
//class MapView; //class MapView;
enum UpdateState { ExternalEmit = 0
, InternalEmit
, InternalReceive
};
class CellWidget : public QWidget { class CellWidget : public QWidget {
Q_OBJECT; Q_OBJECT;
@ -201,14 +206,13 @@ namespace Hurricane {
void cellPreModificated (); void cellPreModificated ();
void cellPostModificated (); void cellPostModificated ();
void stateChanged ( shared_ptr<CellWidget::State>& ); void stateChanged ( shared_ptr<CellWidget::State>& );
void styleChanged ( void* emitter ); void styleChanged ();
void queryFilterChanged (); void queryFilterChanged ();
void updatePalette ( Cell* ); void updatePalette ( Cell* );
void mousePositionChanged ( const Point& position ); void mousePositionChanged ( const Point& position );
void selectionChanged ( const SelectorSet&, Cell* ); void selectionModeChanged ();
void selectionChanged ( const SelectorSet& );
void selectionToggled ( Occurrence ); void selectionToggled ( Occurrence );
void showSelectionToggled ( bool );
void cumulativeSelectionToggled ( bool );
void showBoundariesToggled ( bool ); void showBoundariesToggled ( bool );
public slots: public slots:
// Qt QWidget Slots Overload & CellWidget Specifics. // Qt QWidget Slots Overload & CellWidget Specifics.
@ -233,7 +237,7 @@ namespace Hurricane {
void _unselectAll (); void _unselectAll ();
void changeQueryFilter (); void changeQueryFilter ();
void rubberChange (); void rubberChange ();
void styleChange ( void* emitter ); void setStyle ( int id );
void updatePalette (); void updatePalette ();
void cellPreModificate (); void cellPreModificate ();
void cellPostModificate (); void cellPostModificate ();

View File

@ -33,13 +33,12 @@ class QSpinBox;
class QCheckBox; class QCheckBox;
class QRadioButton; class QRadioButton;
#include "hurricane/viewer/CellWidget.h"
namespace Hurricane { namespace Hurricane {
class CellWidget;
class DisplayFilterWidget : public QWidget { class DisplayFilterWidget : public QWidget {
Q_OBJECT; Q_OBJECT;
@ -61,12 +60,6 @@ namespace Hurricane {
protected: protected:
void blockAllSignals ( bool state ); void blockAllSignals ( bool state );
protected:
enum UpdateState { External = 0
, InternalEmit
, InternalReceive
};
protected: protected:
CellWidget* _cellWidget; CellWidget* _cellWidget;
QSpinBox* _startSpinBox; QSpinBox* _startSpinBox;

View File

@ -29,6 +29,8 @@
#include <QWidget> #include <QWidget>
#include "hurricane/viewer/CellWidget.h"
namespace Hurricane { namespace Hurricane {
@ -38,10 +40,14 @@ namespace Hurricane {
public: public:
GraphicsWidget ( QWidget* parent=NULL ); GraphicsWidget ( QWidget* parent=NULL );
signals: void setCellWidget ( CellWidget* );
void styleChanged ( void* emitter );
public slots: public slots:
void styleChange ( int id ); void changeStyle ();
void setStyle ( int id );
protected:
CellWidget* _cellWidget;
UpdateState _updateState;
}; };

View File

@ -37,6 +37,7 @@
#include "hurricane/Bug.h" #include "hurricane/Bug.h"
#include "hurricane/viewer/CellWidget.h" #include "hurricane/viewer/CellWidget.h"
#include "hurricane/viewer/NetlistModel.h" #include "hurricane/viewer/NetlistModel.h"
#include "hurricane/viewer/CellWidget.h"
class QSortFilterProxyModel; class QSortFilterProxyModel;
@ -55,6 +56,10 @@ namespace Hurricane {
class Cell; class Cell;
// -------------------------------------------------------------------
// Class : "SelectedNet".
class SelectedNet { class SelectedNet {
public: public:
inline SelectedNet (); inline SelectedNet ();
@ -88,6 +93,10 @@ namespace Hurricane {
} }
// -------------------------------------------------------------------
// Class : "SelectedNetSet".
class SelectedNetSet : public set<SelectedNet,SelectedNetCompare>{ class SelectedNetSet : public set<SelectedNet,SelectedNetCompare>{
public: public:
void insert ( const Net* ); void insert ( const Net* );
@ -112,18 +121,22 @@ namespace Hurricane {
} }
// -------------------------------------------------------------------
// Class : "NetlistWidget".
class NetlistWidget : public QWidget { class NetlistWidget : public QWidget {
Q_OBJECT; Q_OBJECT;
public: public:
NetlistWidget ( QWidget* parent=NULL ); NetlistWidget ( QWidget* parent=NULL );
inline Cell* getCell (); inline Cell* getCell ();
template<typename InformationType>
void setCellWidget ( CellWidget* );
template<typename InformationType> template<typename InformationType>
void setCell ( Cell* ); void setCell ( Cell* );
void goTo ( int ); void goTo ( int );
signals: signals:
void refreshSessionOpened ();
void refreshSessionClosed ();
void netSelected ( const Net* ); void netSelected ( const Net* );
void netUnselected ( const Net* ); void netUnselected ( const Net* );
void netFitted ( const Net* ); void netFitted ( const Net* );
@ -135,6 +148,7 @@ namespace Hurricane {
void fitToNet (); void fitToNet ();
private: private:
CellWidget* _cellWidget;
Cell* _cell; Cell* _cell;
NetlistModel* _baseModel; NetlistModel* _baseModel;
QSortFilterProxyModel* _sortModel; QSortFilterProxyModel* _sortModel;
@ -145,6 +159,22 @@ namespace Hurricane {
}; };
template<typename InformationType>
void NetlistWidget::setCellWidget ( CellWidget* cw )
{
if ( _cellWidget ) {
disconnect ( this, 0, _cellWidget, 0 );
}
_cellWidget = cw;
if ( _cellWidget ) {
setCell<InformationType> ( _cellWidget->getCell() );
connect ( this, SIGNAL(netFitted(const Net*)), _cellWidget, SLOT(fitToNet (const Net*)) );
} else
setCell<InformationType> ( NULL );
}
template<typename InformationType> template<typename InformationType>
void NetlistWidget::setCell ( Cell* cell ) void NetlistWidget::setCell ( Cell* cell )
{ {

View File

@ -55,7 +55,7 @@ namespace Hurricane {
protected: protected:
QPixmap _sample; QPixmap _sample;
PaletteItem* _entry; PaletteItem* _entry;
protected slots: public slots:
void redraw (); void redraw ();
void paintEvent ( QPaintEvent* ); void paintEvent ( QPaintEvent* );
}; };
@ -75,9 +75,8 @@ namespace Hurricane {
virtual void setItemVisible ( bool ) = 0; virtual void setItemVisible ( bool ) = 0;
virtual void setItemSelectable ( bool ); virtual void setItemSelectable ( bool );
public slots: public slots:
virtual void styleChange (); virtual void changeStyle ();
signals: signals:
void styleChanged ();
void visibleToggled (); void visibleToggled ();
void selectableToggled (); void selectableToggled ();
protected: protected:

View File

@ -42,22 +42,25 @@ namespace Hurricane {
Q_OBJECT; Q_OBJECT;
public: public:
static PaletteLayerItem* create ( BasicLayer*, bool visible=true ); static PaletteLayerItem* create ( BasicLayer*, bool visible=true );
virtual const Name& getName () const; virtual const Name& getName () const;
virtual bool isItemVisible () const; virtual bool isItemVisible () const;
virtual bool isItemSelectable () const; virtual bool isItemSelectable () const;
virtual void setItemVisible ( bool state ); virtual void setItemVisible ( bool state );
virtual void setItemSelectable ( bool state ); virtual void setItemSelectable ( bool state );
public slots:
virtual void changeStyle ();
protected: protected:
BasicLayer* _basicLayer; BasicLayer* _basicLayer;
QCheckBox* _visible; QCheckBox* _visible;
QCheckBox* _selectable; QCheckBox* _selectable;
DrawingStyleSample* _sample;
protected: protected:
PaletteLayerItem ( BasicLayer*, bool visible ); PaletteLayerItem ( BasicLayer*, bool visible );
PaletteLayerItem ( const PaletteLayerItem& ); PaletteLayerItem ( const PaletteLayerItem& );
PaletteLayerItem& operator= ( const PaletteLayerItem& ); PaletteLayerItem& operator= ( const PaletteLayerItem& );
}; };

View File

@ -68,7 +68,7 @@ namespace Hurricane {
void updateExtensions ( Cell* cell ); void updateExtensions ( Cell* cell );
void showAll (); void showAll ();
void hideAll (); void hideAll ();
void styleChange ( void* emitter ); void changeStyle ();
protected: protected:
PaletteItems _layerItems; PaletteItems _layerItems;

View File

@ -60,7 +60,6 @@ namespace Hurricane {
signals: signals:
void selectionToggled ( Occurrence occurrence ); void selectionToggled ( Occurrence occurrence );
private: private:
QAction* _selectAction;
SelectionPopup* _selectionPopup; SelectionPopup* _selectionPopup;
private: private:
SelectCommand ( const SelectCommand& ); SelectCommand ( const SelectCommand& );

View File

@ -34,8 +34,10 @@
#include "hurricane/Commons.h" #include "hurricane/Commons.h"
#include "hurricane/Occurrence.h" #include "hurricane/Occurrence.h"
#include "hurricane/viewer/SelectionModel.h" #include "hurricane/viewer/SelectionModel.h"
#include "hurricane/viewer/CellWidget.h"
class QCloseEvent;
class QSortFilterProxyModel; class QSortFilterProxyModel;
class QModelIndex; class QModelIndex;
class QTableView; class QTableView;
@ -49,38 +51,39 @@ namespace Hurricane {
class Selector; class Selector;
class QCloseEvent;
class SelectionWidget : public QWidget { class SelectionWidget : public QWidget {
Q_OBJECT; Q_OBJECT;
public: public:
SelectionWidget ( QWidget* parent=NULL ); SelectionWidget ( QWidget* parent=NULL );
void inspect ( const QModelIndex& index ); void inspect ( const QModelIndex& index );
bool isCumulative () const; bool cumulativeSelection () const;
signals: signals:
void showSelectionToggled ( bool ); void selectionModeChanged ();
void selectionToggled ( Occurrence ); void selectionToggled ( Occurrence );
void cumulativeToggled ( bool ); void inspect ( Record* );
void selectionCleared (); void inspect ( Occurrence& );
void inspect ( Record* );
void inspect ( Occurrence& );
public slots: public slots:
void clear (); void setCellWidget ( CellWidget* );
void setShowSelection ( bool ); void clear ();
void selectCurrent ( const QModelIndex& current, const QModelIndex& ); void changeSelectionMode ();
void setSelection ( const SelectorSet& selection, Cell* cell=NULL ); void setShowSelection ( bool );
void toggleSelection ( Occurrence occurrence ); void setCumulativeSelection ( bool );
void toggleSelection ( const QModelIndex& index ); void selectCurrent ( const QModelIndex& current, const QModelIndex& );
void forceRowHeight (); void setSelection ( const SelectorSet& selection );
void toggleSelection ( Occurrence );
void toggleSelection ( const QModelIndex& );
void forceRowHeight ();
private slots: private slots:
void textFilterChanged (); void textFilterChanged ();
protected: protected:
virtual bool eventFilter ( QObject*, QEvent* ); void blockAllSignals ( bool );
virtual void hideEvent ( QHideEvent* event ); virtual bool eventFilter ( QObject*, QEvent* );
private: private:
CellWidget* _cellWidget;
SelectionModel* _baseModel; SelectionModel* _baseModel;
QSortFilterProxyModel* _sortModel; QSortFilterProxyModel* _sortModel;
QTableView* _view; QTableView* _view;
@ -88,7 +91,7 @@ namespace Hurricane {
QCheckBox* _cumulative; QCheckBox* _cumulative;
QCheckBox* _showSelection; QCheckBox* _showSelection;
int _rowHeight; int _rowHeight;
bool _isEmitter; UpdateState _updateState;
}; };