diff --git a/hurricane/src/viewer/NetInformations.cpp b/hurricane/src/viewer/NetInformations.cpp index 750a8557..02f485e7 100644 --- a/hurricane/src/viewer/NetInformations.cpp +++ b/hurricane/src/viewer/NetInformations.cpp @@ -1,60 +1,23 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2008-2015, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./NetInformations.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ -#include - -#include "hurricane/Name.h" -#include "hurricane/Net.h" -#include "hurricane/viewer/NetInformations.h" +#include +#include "hurricane/Name.h" +#include "hurricane/Net.h" +#include "hurricane/viewer/NetInformations.h" namespace Hurricane { @@ -100,7 +63,7 @@ namespace Hurricane { int SimpleNetInformations::getColumnCount () - { return 2; } + { return 3; } QVariant SimpleNetInformations::getColumnName ( int column ) @@ -108,6 +71,7 @@ namespace Hurricane { switch ( column ) { case 0: return QVariant(QObject::tr("Net")); case 1: return QVariant(QObject::tr("Plugs")); + case 2: return QVariant(QObject::tr("RoutingPads")); } return QVariant(QObject::tr("Column Out of Bound")); } @@ -116,8 +80,15 @@ namespace Hurricane { QVariant SimpleNetInformations::getColumn ( int column ) { switch ( column ) { - case 0: return _columnNet; - case 1: return _columnPlug; + case 0: return _netName; + case 1: return (unsigned int)_plugsCount; + case 2: + if (_net->isGlobal()) { + if (not _rpsCount) return "N/A (global)"; + string s = getString(_rpsCount) + " (global)"; + return s.c_str(); + } + return (unsigned int)_rpsCount; } return QVariant(QObject::tr("Column Out of Bound")); } @@ -125,9 +96,9 @@ namespace Hurricane { SimpleNetInformations::SimpleNetInformations ( const Net* net ) : NetInformations(net) + , _netName (getString(getName()).c_str()) , _plugsCount (_net->getPlugs().getSize()) - , _columnNet (getString(getName()).c_str()) - , _columnPlug ((unsigned int)_plugsCount) + , _rpsCount (_net->getRoutingPads().getSize()) { } diff --git a/hurricane/src/viewer/NetlistWidget.cpp b/hurricane/src/viewer/NetlistWidget.cpp index 4696df5a..e0cecf4c 100644 --- a/hurricane/src/viewer/NetlistWidget.cpp +++ b/hurricane/src/viewer/NetlistWidget.cpp @@ -58,22 +58,27 @@ namespace Hurricane { _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; - _sortModel->setSourceModel ( _baseModel ); - _sortModel->setDynamicSortFilter ( true ); - _sortModel->setFilterKeyColumn ( 0 ); + _sortModel->setSourceModel ( _baseModel ); + _sortModel->setDynamicSortFilter( true ); + _sortModel->setFilterKeyColumn ( 0 ); - _view->setShowGrid ( false ); - _view->setAlternatingRowColors ( true ); - _view->setSelectionBehavior ( QAbstractItemView::SelectRows ); - _view->setSortingEnabled ( true ); - _view->setModel ( _sortModel ); + _view->setShowGrid ( false ); + _view->setAlternatingRowColors( true ); + _view->setSelectionBehavior ( QAbstractItemView::SelectRows ); + _view->setSortingEnabled ( true ); + _view->setModel ( _sortModel ); - QHeaderView* horizontalHeader = _view->horizontalHeader (); - horizontalHeader->setStretchLastSection ( true ); + QHeaderView* horizontalHeader = _view->horizontalHeader(); + horizontalHeader->setDefaultAlignment ( Qt::AlignHCenter ); + horizontalHeader->setMinimumSectionSize( (Graphics::isHighDpi()) ? 300 : 150 ); + horizontalHeader->setResizeMode ( 0, QHeaderView::Interactive ); + horizontalHeader->setResizeMode ( 1, QHeaderView::Interactive ); + horizontalHeader->setResizeMode ( 2, QHeaderView::Interactive ); + horizontalHeader->setStretchLastSection( true ); - QHeaderView* verticalHeader = _view->verticalHeader (); - verticalHeader->setVisible ( false ); - verticalHeader->setDefaultSectionSize ( _rowHeight ); + QHeaderView* verticalHeader = _view->verticalHeader(); + verticalHeader->setVisible( false ); + verticalHeader->setDefaultSectionSize( _rowHeight ); // verticalHeader->setStyleSheet( "QHeaderView::section {" // "padding-bottom: 0px;" @@ -84,29 +89,29 @@ namespace Hurricane { // "}" // ); - _filterPatternLineEdit = new QLineEdit(this); - QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); - filterPatternLabel->setBuddy(_filterPatternLineEdit); + _filterPatternLineEdit = new QLineEdit( this ); + QLabel* filterPatternLabel = new QLabel( tr("&Filter pattern:"), this ); + filterPatternLabel->setBuddy( _filterPatternLineEdit ); QGridLayout* gLayout = new QGridLayout(); - gLayout->addWidget(_view , 1, 0, 1, 2); - gLayout->addWidget(filterPatternLabel , 2, 0); - gLayout->addWidget(_filterPatternLineEdit, 2, 1); + gLayout->addWidget( _view , 1, 0, 1, 2 ); + gLayout->addWidget( filterPatternLabel , 2, 0 ); + gLayout->addWidget( _filterPatternLineEdit, 2, 1 ); - setLayout ( gLayout ); + setLayout( gLayout ); - QAction* fitAction = new QAction ( tr("&Fit to Net"), this ); - fitAction->setShortcut ( QKeySequence(tr("CTRL+F")) ); - fitAction->setStatusTip ( tr("Fit the view to the Net's bounding box") ); - addAction ( fitAction ); + QAction* fitAction = new QAction( tr("&Fit to Net"), this ); + fitAction->setShortcut ( QKeySequence(tr("CTRL+F")) ); + fitAction->setStatusTip( tr("Fit the view to the Net's bounding box") ); + addAction( fitAction ); - connect ( _filterPatternLineEdit , SIGNAL(textChanged(const QString &)) - , this , SLOT (textFilterChanged()) ); - connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)) - , this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) ); - connect ( fitAction , SIGNAL(triggered ()), this, SLOT(fitToNet ()) ); + connect( _filterPatternLineEdit , SIGNAL(textChanged(const QString &)) + , this , SLOT (textFilterChanged()) ); + connect( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)) + , this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) ); + connect( fitAction , SIGNAL(triggered ()), this, SLOT(fitToNet ()) ); - resize(300, 300); + resize( 300, 300 ); } diff --git a/hurricane/src/viewer/RecordModel.cpp b/hurricane/src/viewer/RecordModel.cpp index 75505b52..6b09c2b2 100644 --- a/hurricane/src/viewer/RecordModel.cpp +++ b/hurricane/src/viewer/RecordModel.cpp @@ -112,7 +112,6 @@ namespace Hurricane { } if ( role == Qt::FontRole ) { - //if ( index.row() == 0 ) return QVariant(); switch (index.column()) { case 0: return nameFont; case 1: return valueFont; diff --git a/hurricane/src/viewer/SelectionModel.cpp b/hurricane/src/viewer/SelectionModel.cpp index ff2302b4..557d8d11 100644 --- a/hurricane/src/viewer/SelectionModel.cpp +++ b/hurricane/src/viewer/SelectionModel.cpp @@ -176,7 +176,6 @@ namespace Hurricane { if ( !index.isValid() ) return QVariant (); if ( role == Qt::SizeHintRole ) { - if ( index.row() == 0 ) return QVariant(); switch (index.column()) { case 0: return 200; default: diff --git a/hurricane/src/viewer/SelectionPopupModel.cpp b/hurricane/src/viewer/SelectionPopupModel.cpp index d9effafa..c5925627 100644 --- a/hurricane/src/viewer/SelectionPopupModel.cpp +++ b/hurricane/src/viewer/SelectionPopupModel.cpp @@ -117,7 +117,6 @@ namespace Hurricane { } if ( role == Qt::FontRole ) { - if ( index.row() == 0 ) return QVariant(); switch (index.column()) { default: return entityFont; } diff --git a/hurricane/src/viewer/hurricane/viewer/NetInformations.h b/hurricane/src/viewer/hurricane/viewer/NetInformations.h index 599caa31..8ca7254e 100644 --- a/hurricane/src/viewer/hurricane/viewer/NetInformations.h +++ b/hurricane/src/viewer/hurricane/viewer/NetInformations.h @@ -67,16 +67,17 @@ namespace Hurricane { static QVariant getColumnName ( int column ); virtual QVariant getColumn ( int column ); inline size_t getPlugsCount () const; + inline size_t getRpsCount () const; protected: + QVariant _netName; size_t _plugsCount; - QVariant _columnNet; - QVariant _columnPlug; + size_t _rpsCount; }; - inline size_t SimpleNetInformations::getPlugsCount () const - { return _plugsCount; } + inline size_t SimpleNetInformations::getPlugsCount () const { return _plugsCount; } + inline size_t SimpleNetInformations::getRpsCount () const { return _rpsCount; } // ------------------------------------------------------------------- diff --git a/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h b/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h index 1558bb8c..bc8a8033 100644 --- a/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/NetlistWidget.h @@ -180,14 +180,17 @@ namespace Hurricane { void NetlistWidget::setCell ( Cell* cell ) { _cell = cell; - _view->selectionModel()->clear (); - _baseModel->setCell ( cell ); + _view->setVisible( false ); + _view->selectionModel()->clear(); + _baseModel->setCell( cell ); string windowTitle = "Netlist" + getString(cell); - setWindowTitle ( tr(windowTitle.c_str()) ); + setWindowTitle( tr(windowTitle.c_str()) ); - _view->selectRow ( 0 ); - _view->resizeColumnToContents ( 0 ); + _view->selectRow( 0 ); + for ( int i=0 ; i<_baseModel->columnCount() ; ++i ) + _view->resizeColumnToContents( i ); + _view->setVisible( true ); }