* ./hurricane/src/hviewer :
- Change: modifie GraphicsWidget, PaletteWidget, NetlistWidget & SelectionWidget to comply to the "star" model.
This commit is contained in:
parent
35e8d30026
commit
78be633226
|
@ -75,6 +75,7 @@ namespace Hurricane {
|
|||
, _hierarchyCommand()
|
||||
, _cellHistory()
|
||||
, _firstShow(false)
|
||||
, _updateState(ExternalEmit)
|
||||
{
|
||||
setObjectName("viewer");
|
||||
|
||||
|
@ -227,8 +228,6 @@ namespace Hurricane {
|
|||
_cellWidget->bindCommand ( &_hierarchyCommand );
|
||||
_controller->setCellWidget ( _cellWidget );
|
||||
|
||||
_selectCommand.bindToAction ( _showSelectionAction );
|
||||
|
||||
MousePositionWidget* _mousePosition = new MousePositionWidget ();
|
||||
statusBar()->addPermanentWidget ( _mousePosition );
|
||||
|
||||
|
@ -259,10 +258,8 @@ namespace Hurricane {
|
|||
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))
|
||||
, this , SLOT (setShowSelection (bool)) );
|
||||
connect ( _cellWidget , SIGNAL(selectionModeChanged())
|
||||
, this , SLOT (changeSelectionMode ()) );
|
||||
connect ( &_selectCommand , SIGNAL(selectionToggled (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 )
|
||||
{
|
||||
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;
|
||||
}
|
||||
_updateState = InternalEmit;
|
||||
_cellWidget->setShowSelection ( state );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ namespace Hurricane {
|
|||
typedef Hurricane::Collection<Occurrence> OccurrenceHC;
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// 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 ();
|
||||
emit styleChanged(emitter);
|
||||
|
||||
emit styleChanged ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -988,7 +989,7 @@ namespace Hurricane {
|
|||
connect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(refresh()) );
|
||||
connect ( this , SIGNAL(cellChanged(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;
|
||||
refresh ();
|
||||
|
||||
emit showSelectionToggled ( state );
|
||||
emit selectionModeChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1076,7 @@ namespace Hurricane {
|
|||
{
|
||||
if ( state != _state->cumulativeSelection() ) {
|
||||
_state->setCumulativeSelection ( state );
|
||||
emit cumulativeSelectionToggled ( state );
|
||||
emit selectionModeChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2062,14 +2063,9 @@ namespace Hurricane {
|
|||
{
|
||||
++_delaySelectionChanged;
|
||||
|
||||
if ( !_state->cumulativeSelection() ) {
|
||||
openRefreshSession ();
|
||||
unselectAll ();
|
||||
closeRefreshSession ();
|
||||
}
|
||||
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() );
|
||||
}
|
||||
|
||||
//if ( !_state->cumulativeSelection() ) unselectAll ( true );
|
||||
|
||||
Property* property = occurrence.getProperty ( Selector::getPropertyName() );
|
||||
Selector* selector = NULL;
|
||||
if ( !property )
|
||||
|
@ -2124,7 +2118,7 @@ namespace Hurricane {
|
|||
selector->attachTo(this);
|
||||
|
||||
_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 );
|
||||
|
||||
if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors,getCell());
|
||||
if ( !--_delaySelectionChanged && added ) emit selectionChanged(_selectors);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2148,7 +2142,7 @@ namespace Hurricane {
|
|||
++_delaySelectionChanged;
|
||||
|
||||
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;
|
||||
if ( !_delaySelectionChanged ) emit selectionChanged(_selectors,getCell());
|
||||
if ( !_delaySelectionChanged ) emit selectionChanged(_selectors);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2181,7 +2175,7 @@ namespace Hurricane {
|
|||
_state->getSelection().clear ();
|
||||
_unselectAll ();
|
||||
|
||||
if ( !--_delaySelectionChanged ) emit selectionChanged(_selectors,getCell());
|
||||
if ( !--_delaySelectionChanged ) emit selectionChanged(_selectors);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2265,7 +2259,7 @@ namespace Hurricane {
|
|||
openRefreshSession ();
|
||||
_unselectAll ();
|
||||
|
||||
emit selectionChanged(_selectors,getCell());
|
||||
emit selectionChanged(_selectors);
|
||||
emit cellPreModificated ();
|
||||
|
||||
closeRefreshSession ();
|
||||
|
@ -2284,7 +2278,7 @@ namespace Hurricane {
|
|||
_redrawManager.refresh ();
|
||||
|
||||
--_delaySelectionChanged;
|
||||
emit selectionChanged(_selectors,getCell());
|
||||
emit selectionChanged(_selectors);
|
||||
emit cellPostModificated ();
|
||||
|
||||
closeRefreshSession ();
|
||||
|
|
|
@ -97,9 +97,7 @@ namespace Hurricane {
|
|||
{
|
||||
if ( getCellWidget() != cellWidget ) {
|
||||
ControllerTab::setCellWidget ( cellWidget );
|
||||
if ( getCellWidget() ) {
|
||||
connect ( _graphics, SIGNAL(styleChanged(void*)), getCellWidget(), SLOT(styleChange(void*)) );
|
||||
}
|
||||
_graphics->setCellWidget ( cellWidget );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,7 +224,6 @@ namespace Hurricane {
|
|||
getCellWidget()->unselectAll ();
|
||||
getCellWidget()->closeRefreshSession ();
|
||||
}
|
||||
getCellWidget()->setCumulativeSelection ( 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*)) );
|
||||
|
@ -249,14 +246,9 @@ namespace Hurricane {
|
|||
{
|
||||
if ( getCellWidget() != cellWidget ) {
|
||||
ControllerTab::setCellWidget ( cellWidget );
|
||||
_netlistBrowser->setCellWidget<SimpleNetInformations> ( cellWidget );
|
||||
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 ( _netlistBrowser, SIGNAL(netFitted(const Net*))
|
||||
, getCellWidget(), SLOT (fitToNet (const Net*)) );
|
||||
}
|
||||
setSyncNetlist ( _syncNetlist->isChecked() );
|
||||
}
|
||||
|
@ -296,22 +288,7 @@ namespace Hurricane {
|
|||
{
|
||||
if ( getCellWidget() != cellWidget ) {
|
||||
ControllerTab::setCellWidget ( cellWidget );
|
||||
if ( getCellWidget() ) {
|
||||
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)) );
|
||||
}
|
||||
_selection->setCellWidget ( cellWidget );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +312,7 @@ namespace Hurricane {
|
|||
{
|
||||
//updateTab ();
|
||||
if ( getCellWidget() && getCellWidget()->getCell() ) {
|
||||
_selection->setSelection ( getCellWidget()->getSelectorSet(), getCellWidget()->getCell() );
|
||||
_selection->setSelection ( getCellWidget()->getSelectorSet() );
|
||||
} else
|
||||
_selection->clear ();
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Hurricane {
|
|||
, _steiner (new QRadioButton())
|
||||
, _centric (new QRadioButton())
|
||||
, _barycentric (new QRadioButton())
|
||||
, _updateState (External)
|
||||
, _updateState (ExternalEmit)
|
||||
{
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
setWindowTitle ( tr("Display Filter") );
|
||||
|
@ -145,28 +145,26 @@ namespace Hurricane {
|
|||
|
||||
connect ( _startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(startLevelChanged(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 )
|
||||
{
|
||||
if ( !cw ) {
|
||||
if ( _cellWidget ) {
|
||||
disconnect ( this , SIGNAL(queryFilterChanged()), _cellWidget, SLOT(changeQueryFilter()) );
|
||||
disconnect ( _cellWidget , SIGNAL(queryFilterChanged()), this , SLOT(changeQueryFilter()) );
|
||||
}
|
||||
_cellWidget = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
_cellWidget = cw;
|
||||
if ( !_cellWidget ) return;
|
||||
|
||||
connect ( this , SIGNAL(queryFilterChanged()), _cellWidget, 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 ();
|
||||
}
|
||||
|
||||
|
@ -179,7 +177,7 @@ namespace Hurricane {
|
|||
_updateState = InternalReceive;
|
||||
emit queryFilterChanged ();
|
||||
} else {
|
||||
if ( _updateState == External ) {
|
||||
if ( _updateState == ExternalEmit ) {
|
||||
blockAllSignals ( true );
|
||||
|
||||
_startSpinBox->setValue ( _cellWidget->getStartLevel() );
|
||||
|
@ -196,7 +194,7 @@ namespace Hurricane {
|
|||
}
|
||||
blockAllSignals ( false );
|
||||
}
|
||||
_updateState = External;
|
||||
_updateState = ExternalEmit;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace Hurricane {
|
|||
|
||||
GraphicsWidget::GraphicsWidget ( QWidget* parent )
|
||||
: QWidget (parent)
|
||||
, _cellWidget (NULL)
|
||||
, _updateState(ExternalEmit)
|
||||
{
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
setWindowTitle ( tr("Display Styles") );
|
||||
|
@ -79,15 +81,42 @@ namespace Hurricane {
|
|||
wLayout->addStretch ();
|
||||
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 );
|
||||
//cerr << "GraphicsWidget::setStyle() - " << getString(Graphics::getStyle()->getName()) << endl;
|
||||
emit styleChanged ( (void*)this );
|
||||
if ( _cellWidget ) {
|
||||
disconnect ( _cellWidget, 0, this , 0 );
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace Hurricane {
|
|||
|
||||
NetlistWidget::NetlistWidget ( QWidget* parent )
|
||||
: QWidget (parent)
|
||||
, _cellWidget(NULL)
|
||||
, _cell (NULL)
|
||||
, _baseModel (new NetlistModel(this))
|
||||
, _sortModel (new QSortFilterProxyModel(this))
|
||||
|
@ -131,8 +132,7 @@ namespace Hurricane {
|
|||
|
||||
void NetlistWidget::updateSelecteds ( const QItemSelection& , const QItemSelection& )
|
||||
{
|
||||
cerr << "open refresh session" << endl;
|
||||
emit refreshSessionOpened ();
|
||||
if ( _cellWidget ) _cellWidget->openRefreshSession ();
|
||||
|
||||
_selecteds.resetAccesses ();
|
||||
|
||||
|
@ -165,8 +165,7 @@ namespace Hurricane {
|
|||
++isel;
|
||||
}
|
||||
|
||||
emit refreshSessionClosed ();
|
||||
cerr << "close refresh session" << endl;
|
||||
if ( _cellWidget ) _cellWidget->closeRefreshSession ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -90,10 +90,8 @@ namespace Hurricane {
|
|||
{ }
|
||||
|
||||
|
||||
void PaletteItem::styleChange ()
|
||||
{
|
||||
emit styleChanged ();
|
||||
}
|
||||
void PaletteItem::changeStyle ()
|
||||
{ }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -40,12 +40,12 @@ namespace Hurricane {
|
|||
, _basicLayer(basicLayer)
|
||||
, _visible (new QCheckBox())
|
||||
, _selectable(new QCheckBox())
|
||||
, _sample (new DrawingStyleSample(this))
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout ();
|
||||
layout->setContentsMargins ( 0, 0, 0, 0 );
|
||||
|
||||
DrawingStyleSample* sample = new DrawingStyleSample(this);
|
||||
layout->addWidget ( sample );
|
||||
layout->addWidget ( _sample );
|
||||
|
||||
_visible->setChecked ( visible );
|
||||
_visible->setText ( getString(getName()).c_str() );
|
||||
|
@ -63,7 +63,6 @@ namespace Hurricane {
|
|||
|
||||
setLayout ( layout );
|
||||
|
||||
connect ( this , SIGNAL(styleChanged()), sample, SLOT (redraw ()) );
|
||||
connect ( _visible , SIGNAL(clicked ()), this , SIGNAL(visibleToggled ()) );
|
||||
connect ( _selectable, SIGNAL(clicked ()), this , SIGNAL(selectableToggled()) );
|
||||
}
|
||||
|
@ -82,6 +81,12 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void PaletteLayerItem::changeStyle ()
|
||||
{
|
||||
_sample->redraw ();
|
||||
}
|
||||
|
||||
|
||||
bool PaletteLayerItem::isItemVisible () const
|
||||
{
|
||||
return _visible->isChecked ();
|
||||
|
|
|
@ -377,17 +377,15 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void PaletteWidget::styleChange ( void* emitter )
|
||||
void PaletteWidget::changeStyle ()
|
||||
{
|
||||
if ( emitter == this ) return;
|
||||
|
||||
PaletteItems::iterator iitem = _layerItems.begin();
|
||||
for ( ; iitem != _layerItems.end() ; iitem++ )
|
||||
iitem->second->styleChange ();
|
||||
iitem->second->changeStyle ();
|
||||
|
||||
iitem = _extensionGoItems.begin();
|
||||
for ( ; iitem != _extensionGoItems.end() ; iitem++ )
|
||||
iitem->second->styleChange ();
|
||||
iitem->second->changeStyle ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ namespace Hurricane {
|
|||
|
||||
SelectCommand::SelectCommand ()
|
||||
: AreaCommand()
|
||||
, _selectAction(NULL)
|
||||
, _selectionPopup(NULL)
|
||||
{
|
||||
_selectionPopup = new SelectionPopup ();
|
||||
|
@ -59,12 +58,6 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void SelectCommand::bindToAction ( QAction* action )
|
||||
{
|
||||
_selectAction = action;
|
||||
}
|
||||
|
||||
|
||||
bool SelectCommand::mousePressEvent ( CellWidget* widget, QMouseEvent* event )
|
||||
{
|
||||
if ( isActive() ) return true;
|
||||
|
@ -105,15 +98,10 @@ namespace Hurricane {
|
|||
//widget->unselectAll ();
|
||||
widget->selectOccurrencesUnder ( widget->screenToDbuBox(selectArea) );
|
||||
|
||||
if ( _selectAction ) {
|
||||
if ( !_selectAction->isChecked() )
|
||||
_selectAction->setChecked ( true );
|
||||
if ( !widget->getState()->showSelection() )
|
||||
widget->setShowSelection ( true );
|
||||
else
|
||||
widget->refresh ();
|
||||
} else {
|
||||
widget->setShowSelection ( true );
|
||||
widget->refresh ();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Hurricane {
|
|||
{
|
||||
SelectionWidget* widget = qobject_cast<SelectionWidget*>(QObject::parent());
|
||||
if ( widget )
|
||||
return widget->isCumulative();
|
||||
return widget->cumulativeSelection();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "hurricane/viewer/Graphics.h"
|
||||
#include "hurricane/viewer/SelectionModel.h"
|
||||
#include "hurricane/viewer/SelectionWidget.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -48,6 +49,7 @@ namespace Hurricane {
|
|||
|
||||
SelectionWidget::SelectionWidget ( QWidget* parent )
|
||||
: QWidget (parent)
|
||||
, _cellWidget (NULL)
|
||||
, _baseModel (new SelectionModel(this))
|
||||
, _sortModel (new QSortFilterProxyModel(this))
|
||||
, _view (new QTableView(this))
|
||||
|
@ -55,7 +57,7 @@ namespace Hurricane {
|
|||
, _cumulative (new QCheckBox())
|
||||
, _showSelection (new QCheckBox())
|
||||
, _rowHeight (20)
|
||||
, _isEmitter (false)
|
||||
, _updateState (ExternalEmit)
|
||||
{
|
||||
setAttribute ( Qt::WA_DeleteOnClose );
|
||||
setAttribute ( Qt::WA_QuitOnClose, false );
|
||||
|
@ -119,11 +121,13 @@ namespace Hurricane {
|
|||
|
||||
connect ( _filterPatternLineEdit, SIGNAL(textChanged(const QString &))
|
||||
, 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 , 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()) , this , SLOT(clear()) );
|
||||
|
||||
connect ( _view->selectionModel(), SIGNAL(currentChanged(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 ()
|
||||
{
|
||||
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 ()
|
||||
{
|
||||
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
|
||||
|
@ -165,62 +234,39 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
bool SelectionWidget::isCumulative () const
|
||||
{
|
||||
return _cumulative->isChecked();
|
||||
}
|
||||
|
||||
|
||||
void SelectionWidget::toggleSelection ( const QModelIndex& index )
|
||||
{
|
||||
Occurrence occurrence = _baseModel->toggleSelection ( index );
|
||||
if ( occurrence.isValid() ) {
|
||||
_isEmitter = true;
|
||||
emit selectionToggled ( occurrence );
|
||||
_updateState = InternalEmit;
|
||||
_cellWidget->toggleSelection ( occurrence );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SelectionWidget::toggleSelection ( Occurrence occurrence )
|
||||
{
|
||||
if ( !_isEmitter ) {
|
||||
if ( _updateState != InternalEmit ) {
|
||||
blockAllSignals ( true );
|
||||
_baseModel->toggleSelection ( occurrence );
|
||||
_isEmitter = false;
|
||||
blockAllSignals ( false );
|
||||
}
|
||||
_updateState = ExternalEmit;
|
||||
}
|
||||
|
||||
|
||||
void SelectionWidget::setShowSelection ( bool state )
|
||||
{
|
||||
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 )
|
||||
void SelectionWidget::setSelection ( const SelectorSet& selection )
|
||||
{
|
||||
_baseModel->setSelection ( selection );
|
||||
|
||||
string windowTitle = "Selection";
|
||||
Cell* cell = (_cellWidget) ? _cellWidget->getCell() : NULL;
|
||||
if ( cell ) windowTitle += getString(cell);
|
||||
else windowTitle += "<None>";
|
||||
setWindowTitle ( tr(windowTitle.c_str()) );
|
||||
|
||||
_view->selectRow ( 0 );
|
||||
_view->resizeColumnToContents ( 0 );
|
||||
|
||||
//if ( !_cumulative->isChecked() ) emit inspect ( NULL );
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,6 +274,8 @@ namespace Hurricane {
|
|||
{
|
||||
_baseModel->clear ();
|
||||
_view->selectionModel()->clearSelection ();
|
||||
if ( _cellWidget )
|
||||
_cellWidget->unselectAll();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ namespace Hurricane {
|
|||
void unselect ( Occurrence& );
|
||||
void unselectAll ();
|
||||
public slots:
|
||||
void changeSelectionMode ();
|
||||
void setShowSelection ( bool );
|
||||
void setState ( shared_ptr<CellWidget::State>& );
|
||||
void showController ();
|
||||
|
@ -121,6 +122,7 @@ namespace Hurricane {
|
|||
list< shared_ptr<CellWidget::State> >
|
||||
_cellHistory;
|
||||
bool _firstShow;
|
||||
UpdateState _updateState;
|
||||
|
||||
protected:
|
||||
void createActions ();
|
||||
|
|
|
@ -85,6 +85,11 @@ namespace Hurricane {
|
|||
class Command;
|
||||
//class MapView;
|
||||
|
||||
enum UpdateState { ExternalEmit = 0
|
||||
, InternalEmit
|
||||
, InternalReceive
|
||||
};
|
||||
|
||||
|
||||
class CellWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
|
@ -201,14 +206,13 @@ namespace Hurricane {
|
|||
void cellPreModificated ();
|
||||
void cellPostModificated ();
|
||||
void stateChanged ( shared_ptr<CellWidget::State>& );
|
||||
void styleChanged ( void* emitter );
|
||||
void styleChanged ();
|
||||
void queryFilterChanged ();
|
||||
void updatePalette ( Cell* );
|
||||
void mousePositionChanged ( const Point& position );
|
||||
void selectionChanged ( const SelectorSet&, Cell* );
|
||||
void selectionModeChanged ();
|
||||
void selectionChanged ( const SelectorSet& );
|
||||
void selectionToggled ( Occurrence );
|
||||
void showSelectionToggled ( bool );
|
||||
void cumulativeSelectionToggled ( bool );
|
||||
void showBoundariesToggled ( bool );
|
||||
public slots:
|
||||
// Qt QWidget Slots Overload & CellWidget Specifics.
|
||||
|
@ -233,7 +237,7 @@ namespace Hurricane {
|
|||
void _unselectAll ();
|
||||
void changeQueryFilter ();
|
||||
void rubberChange ();
|
||||
void styleChange ( void* emitter );
|
||||
void setStyle ( int id );
|
||||
void updatePalette ();
|
||||
void cellPreModificate ();
|
||||
void cellPostModificate ();
|
||||
|
|
|
@ -33,13 +33,12 @@ class QSpinBox;
|
|||
class QCheckBox;
|
||||
class QRadioButton;
|
||||
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class CellWidget;
|
||||
|
||||
|
||||
class DisplayFilterWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
|
||||
|
@ -61,12 +60,6 @@ namespace Hurricane {
|
|||
protected:
|
||||
void blockAllSignals ( bool state );
|
||||
|
||||
protected:
|
||||
enum UpdateState { External = 0
|
||||
, InternalEmit
|
||||
, InternalReceive
|
||||
};
|
||||
|
||||
protected:
|
||||
CellWidget* _cellWidget;
|
||||
QSpinBox* _startSpinBox;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <QWidget>
|
||||
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
@ -38,10 +40,14 @@ namespace Hurricane {
|
|||
|
||||
public:
|
||||
GraphicsWidget ( QWidget* parent=NULL );
|
||||
signals:
|
||||
void styleChanged ( void* emitter );
|
||||
void setCellWidget ( CellWidget* );
|
||||
public slots:
|
||||
void styleChange ( int id );
|
||||
void changeStyle ();
|
||||
void setStyle ( int id );
|
||||
|
||||
protected:
|
||||
CellWidget* _cellWidget;
|
||||
UpdateState _updateState;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "hurricane/Bug.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
#include "hurricane/viewer/NetlistModel.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
class QSortFilterProxyModel;
|
||||
|
@ -55,6 +56,10 @@ namespace Hurricane {
|
|||
class Cell;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "SelectedNet".
|
||||
|
||||
|
||||
class SelectedNet {
|
||||
public:
|
||||
inline SelectedNet ();
|
||||
|
@ -88,6 +93,10 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "SelectedNetSet".
|
||||
|
||||
|
||||
class SelectedNetSet : public set<SelectedNet,SelectedNetCompare>{
|
||||
public:
|
||||
void insert ( const Net* );
|
||||
|
@ -112,18 +121,22 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "NetlistWidget".
|
||||
|
||||
|
||||
class NetlistWidget : public QWidget {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
NetlistWidget ( QWidget* parent=NULL );
|
||||
inline Cell* getCell ();
|
||||
template<typename InformationType>
|
||||
void setCellWidget ( CellWidget* );
|
||||
template<typename InformationType>
|
||||
void setCell ( Cell* );
|
||||
void goTo ( int );
|
||||
signals:
|
||||
void refreshSessionOpened ();
|
||||
void refreshSessionClosed ();
|
||||
void netSelected ( const Net* );
|
||||
void netUnselected ( const Net* );
|
||||
void netFitted ( const Net* );
|
||||
|
@ -135,6 +148,7 @@ namespace Hurricane {
|
|||
void fitToNet ();
|
||||
|
||||
private:
|
||||
CellWidget* _cellWidget;
|
||||
Cell* _cell;
|
||||
NetlistModel* _baseModel;
|
||||
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>
|
||||
void NetlistWidget::setCell ( Cell* cell )
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Hurricane {
|
|||
protected:
|
||||
QPixmap _sample;
|
||||
PaletteItem* _entry;
|
||||
protected slots:
|
||||
public slots:
|
||||
void redraw ();
|
||||
void paintEvent ( QPaintEvent* );
|
||||
};
|
||||
|
@ -75,9 +75,8 @@ namespace Hurricane {
|
|||
virtual void setItemVisible ( bool ) = 0;
|
||||
virtual void setItemSelectable ( bool );
|
||||
public slots:
|
||||
virtual void styleChange ();
|
||||
virtual void changeStyle ();
|
||||
signals:
|
||||
void styleChanged ();
|
||||
void visibleToggled ();
|
||||
void selectableToggled ();
|
||||
protected:
|
||||
|
|
|
@ -48,11 +48,14 @@ namespace Hurricane {
|
|||
virtual bool isItemSelectable () const;
|
||||
virtual void setItemVisible ( bool state );
|
||||
virtual void setItemSelectable ( bool state );
|
||||
public slots:
|
||||
virtual void changeStyle ();
|
||||
|
||||
protected:
|
||||
BasicLayer* _basicLayer;
|
||||
QCheckBox* _visible;
|
||||
QCheckBox* _selectable;
|
||||
DrawingStyleSample* _sample;
|
||||
|
||||
protected:
|
||||
PaletteLayerItem ( BasicLayer*, bool visible );
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace Hurricane {
|
|||
void updateExtensions ( Cell* cell );
|
||||
void showAll ();
|
||||
void hideAll ();
|
||||
void styleChange ( void* emitter );
|
||||
void changeStyle ();
|
||||
|
||||
protected:
|
||||
PaletteItems _layerItems;
|
||||
|
|
|
@ -60,7 +60,6 @@ namespace Hurricane {
|
|||
signals:
|
||||
void selectionToggled ( Occurrence occurrence );
|
||||
private:
|
||||
QAction* _selectAction;
|
||||
SelectionPopup* _selectionPopup;
|
||||
private:
|
||||
SelectCommand ( const SelectCommand& );
|
||||
|
|
|
@ -34,8 +34,10 @@
|
|||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Occurrence.h"
|
||||
#include "hurricane/viewer/SelectionModel.h"
|
||||
#include "hurricane/viewer/CellWidget.h"
|
||||
|
||||
|
||||
class QCloseEvent;
|
||||
class QSortFilterProxyModel;
|
||||
class QModelIndex;
|
||||
class QTableView;
|
||||
|
@ -49,7 +51,6 @@ namespace Hurricane {
|
|||
|
||||
|
||||
class Selector;
|
||||
class QCloseEvent;
|
||||
|
||||
|
||||
class SelectionWidget : public QWidget {
|
||||
|
@ -58,29 +59,31 @@ namespace Hurricane {
|
|||
public:
|
||||
SelectionWidget ( QWidget* parent=NULL );
|
||||
void inspect ( const QModelIndex& index );
|
||||
bool isCumulative () const;
|
||||
bool cumulativeSelection () const;
|
||||
signals:
|
||||
void showSelectionToggled ( bool );
|
||||
void selectionModeChanged ();
|
||||
void selectionToggled ( Occurrence );
|
||||
void cumulativeToggled ( bool );
|
||||
void selectionCleared ();
|
||||
void inspect ( Record* );
|
||||
void inspect ( Occurrence& );
|
||||
public slots:
|
||||
void setCellWidget ( CellWidget* );
|
||||
void clear ();
|
||||
void changeSelectionMode ();
|
||||
void setShowSelection ( bool );
|
||||
void setCumulativeSelection ( bool );
|
||||
void selectCurrent ( const QModelIndex& current, const QModelIndex& );
|
||||
void setSelection ( const SelectorSet& selection, Cell* cell=NULL );
|
||||
void toggleSelection ( Occurrence occurrence );
|
||||
void toggleSelection ( const QModelIndex& index );
|
||||
void setSelection ( const SelectorSet& selection );
|
||||
void toggleSelection ( Occurrence );
|
||||
void toggleSelection ( const QModelIndex& );
|
||||
void forceRowHeight ();
|
||||
private slots:
|
||||
void textFilterChanged ();
|
||||
protected:
|
||||
void blockAllSignals ( bool );
|
||||
virtual bool eventFilter ( QObject*, QEvent* );
|
||||
virtual void hideEvent ( QHideEvent* event );
|
||||
|
||||
private:
|
||||
CellWidget* _cellWidget;
|
||||
SelectionModel* _baseModel;
|
||||
QSortFilterProxyModel* _sortModel;
|
||||
QTableView* _view;
|
||||
|
@ -88,7 +91,7 @@ namespace Hurricane {
|
|||
QCheckBox* _cumulative;
|
||||
QCheckBox* _showSelection;
|
||||
int _rowHeight;
|
||||
bool _isEmitter;
|
||||
UpdateState _updateState;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue