From 7752e70a05d3169cb8eff749101a8ba62966ae9b Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 29 Aug 2008 09:32:52 +0000 Subject: [PATCH] * ./hurricane/src/hviewer : - Bug : now CellViewer can start with a NULL Cell, note that in this case all displacement/zooming function of CellWidget became uneffective. (display only a black screen) - New widget : HGraphics to select the layout graphic's theme. - New widget : HDisplayFilter to select displayed hierarchical levels. - Distinguish between Close (one viewer) & Exit (all viewers). - Small enhancments of DisplayStyle (Description & darkening). --- hurricane/src/hviewer/CMakeLists.txt | 6 + hurricane/src/hviewer/CellViewer.cpp | 86 +++++++--- hurricane/src/hviewer/CellWidget.cpp | 4 +- hurricane/src/hviewer/DisplayStyle.cpp | 29 +++- hurricane/src/hviewer/Graphics.cpp | 44 ++++- hurricane/src/hviewer/HDisplayFilter.cpp | 153 ++++++++++++++++++ hurricane/src/hviewer/HGraphics.cpp | 120 ++++++++++++++ .../src/hviewer/hurricane/viewer/CellViewer.h | 11 +- .../src/hviewer/hurricane/viewer/CellWidget.h | 14 +- .../hviewer/hurricane/viewer/DisplayStyle.h | 11 ++ .../src/hviewer/hurricane/viewer/Graphics.h | 73 +++++---- .../hviewer/hurricane/viewer/HDisplayFilter.h | 92 +++++++++++ .../src/hviewer/hurricane/viewer/HGraphics.h | 78 +++++++++ 13 files changed, 659 insertions(+), 62 deletions(-) create mode 100644 hurricane/src/hviewer/HDisplayFilter.cpp create mode 100644 hurricane/src/hviewer/HGraphics.cpp create mode 100644 hurricane/src/hviewer/hurricane/viewer/HDisplayFilter.h create mode 100644 hurricane/src/hviewer/hurricane/viewer/HGraphics.h diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index 39a4ee24..67332921 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -9,6 +9,7 @@ hurricane/viewer/GroupPaletteEntry.h hurricane/viewer/ViewerPaletteEntry.h hurricane/viewer/HPalette.h + hurricane/viewer/HGraphics.h hurricane/viewer/DynamicLabel.h hurricane/viewer/HMousePosition.h hurricane/viewer/Selector.h @@ -19,12 +20,14 @@ hurricane/viewer/HInspectorWidget.h hurricane/viewer/HNetlistModel.h hurricane/viewer/HNetlist.h + hurricane/viewer/HDisplayFilter.h ) set ( exports hurricane/viewer/ScreenUtilities.h hurricane/viewer/HPaletteEntry.h hurricane/viewer/HPalette.h hurricane/viewer/DisplayStyle.h hurricane/viewer/Graphics.h + hurricane/viewer/HGraphics.h hurricane/viewer/Selector.h hurricane/viewer/CellWidget.h hurricane/viewer/CellWidgets.h @@ -32,10 +35,12 @@ hurricane/viewer/HInspectorWidget.h hurricane/viewer/NetInformations.h hurricane/viewer/HNetlist.h + hurricane/viewer/HDisplayFilter.h ) set ( cpps ScreenUtilities.cpp DisplayStyle.cpp Graphics.cpp + HGraphics.cpp HPaletteEntry.cpp LayerPaletteEntry.cpp GroupPaletteEntry.cpp @@ -51,6 +56,7 @@ NetInformations.cpp HNetlistModel.cpp HNetlist.cpp + HDisplayFilter.cpp ) qt4_wrap_cpp ( MOC_SRCS ${mocincludes} ) diff --git a/hurricane/src/hviewer/CellViewer.cpp b/hurricane/src/hviewer/CellViewer.cpp index 6f133a02..301e5414 100644 --- a/hurricane/src/hviewer/CellViewer.cpp +++ b/hurricane/src/hviewer/CellViewer.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include "hurricane/DataBase.h" #include "hurricane/Cell.h" @@ -66,6 +67,8 @@ #include "hurricane/viewer/HInspectorWidget.h" #include "hurricane/viewer/HNetlist.h" #include "hurricane/viewer/HMousePosition.h" +#include "hurricane/viewer/HGraphics.h" +#include "hurricane/viewer/HDisplayFilter.h" namespace Hurricane { @@ -76,11 +79,14 @@ namespace Hurricane { , _openAction(NULL) , _nextAction(NULL) , _saveAction(NULL) + , _closeAction(NULL) , _exitAction(NULL) , _refreshAction(NULL) , _fitToContentsAction(NULL) , _showSelectionAction(NULL) , _showPaletteAction(NULL) + , _graphicsSettingsAction(NULL) + , _displayFilterAction(NULL) , _runInspectorOnDataBase(NULL) , _runInspectorOnCell(NULL) , _browseNetlist(NULL) @@ -90,6 +96,8 @@ namespace Hurricane { //, _mapView(NULL) , _palette(NULL) , _mousePosition(NULL) + , _graphicsSettings(NULL) + , _displayFilter(NULL) , _cellWidget(NULL) , _cellHistory() { @@ -116,7 +124,7 @@ namespace Hurricane { _nextAction->setObjectName ( "viewer.file.nextBreakpoint" ); _nextAction->setStatusTip ( tr("Proceed to the next breakpoint") ); - for ( unsigned i=0 ; isetObjectName ( QString("viewer.file.cellHistory[%1]").arg(i) ); _cellHistoryAction[i]->setVisible ( false ); @@ -131,11 +139,17 @@ namespace Hurricane { _saveAction->setStatusTip ( tr("Save the current Cell") ); _saveAction->setVisible ( false ); + _closeAction = new QAction ( tr("&Close"), this ); + _closeAction->setObjectName ( "viewer.file.close" ); + _closeAction->setStatusTip ( tr("Close This Coriolis CellViewer") ); + _closeAction->setShortcut ( QKeySequence(tr("CTRL+W")) ); + connect ( _closeAction, SIGNAL(triggered()), this, SLOT(close()) ); + _exitAction = new QAction ( tr("&Exit"), this ); _exitAction->setObjectName ( "viewer.file.exit" ); - _exitAction->setStatusTip ( tr("Close Coriolis CellViewer") ); + _exitAction->setStatusTip ( tr("Exit All Coriolis CellViewer") ); _exitAction->setShortcut ( QKeySequence(tr("CTRL+Q")) ); - connect ( _exitAction, SIGNAL(triggered()), this, SLOT(close()) ); + connect ( _exitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()) ); _refreshAction = new QAction ( tr("&Refresh"), this ); _refreshAction->setObjectName ( "viewer.view.refresh" ); @@ -159,16 +173,24 @@ namespace Hurricane { _showPaletteAction->setCheckable ( true ); _showPaletteAction->setChecked ( true ); + _graphicsSettingsAction = new QAction ( tr("Graphics Settings"), this ); + _graphicsSettingsAction->setObjectName ( "viewer.view.graphicsSettings" ); + _graphicsSettingsAction->setStatusTip ( tr("Tune Graphics Settings") ); + + _displayFilterAction = new QAction ( tr("Display Filter"), this ); + _displayFilterAction->setObjectName ( "viewer.view.displayFilter" ); + _displayFilterAction->setStatusTip ( tr("Tune Cell Displaying") ); + _runInspectorOnDataBase= new QAction ( tr("Inspect &DataBase"), this ); - _runInspectorOnDataBase->setObjectName ( "viewer.tool.inspectDb" ); + _runInspectorOnDataBase->setObjectName ( "viewer.tools.inspectDb" ); _runInspectorOnDataBase->setStatusTip ( tr("Run Inspector on Hurricane DataBase") ); _runInspectorOnCell= new QAction ( tr("Inspect &Cell"), this ); - _runInspectorOnCell->setObjectName ( "viewer.tool.inspectCell" ); + _runInspectorOnCell->setObjectName ( "viewer.tools.inspectCell" ); _runInspectorOnCell->setStatusTip ( tr("Run Inspector on the current Cell") ); _browseNetlist= new QAction ( tr("Browse &Netlist"), this ); - _browseNetlist->setObjectName ( "viewer.tool.browseNetlist" ); + _browseNetlist->setObjectName ( "viewer.tools.browseNetlist" ); _browseNetlist->setStatusTip ( tr("Browse netlist from the current Cell") ); } @@ -189,6 +211,7 @@ namespace Hurricane { } _fileMenu->addSeparator (); _fileMenu->addAction ( _saveAction ); + _fileMenu->addAction ( _closeAction ); _fileMenu->addAction ( _exitAction ); _viewMenu = menuBar()->addMenu ( tr("View") ); @@ -197,9 +220,11 @@ namespace Hurricane { _viewMenu->addAction ( _fitToContentsAction ); _viewMenu->addAction ( _showSelectionAction ); _viewMenu->addAction ( _showPaletteAction ); + _viewMenu->addAction ( _displayFilterAction ); + _viewMenu->addAction ( _graphicsSettingsAction ); - _toolsMenu = menuBar()->addMenu ( tr("Tool") ); - _toolsMenu->setObjectName ( "viewer.tool" ); + _toolsMenu = menuBar()->addMenu ( tr("Tools") ); + _toolsMenu->setObjectName ( "viewer.tools" ); _toolsMenu->addAction ( _runInspectorOnDataBase ); _toolsMenu->addAction ( _runInspectorOnCell ); _toolsMenu->addAction ( _browseNetlist ); @@ -211,11 +236,14 @@ namespace Hurricane { { if ( _cellWidget ) return; - _cellWidget = new CellWidget (); - _palette = new HPalette (); + _cellWidget = new CellWidget (); + _palette = new HPalette (); + _graphicsSettings = new HGraphics (); + _displayFilter = new HDisplayFilter (); //_mapView = _cellWidget->getMapView (); _cellWidget->bindToPalette ( _palette ); + _displayFilter->setCellWidget ( _cellWidget ); HMousePosition* _mousePosition = new HMousePosition (); statusBar()->addPermanentWidget ( _mousePosition ); @@ -243,13 +271,16 @@ namespace Hurricane { setCentralWidget ( _cellWidget ); - connect ( _refreshAction , SIGNAL(triggered()) , _cellWidget, SLOT(redraw ())); - connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents ())); - connect ( _showSelectionAction , SIGNAL(toggled(bool)), _cellWidget, SLOT(setShowSelection (bool))); - connect ( _showPaletteAction , SIGNAL(toggled(bool)), this , SLOT(setShowPalette (bool))); - connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase())); - connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell ())); - connect ( _browseNetlist , SIGNAL(triggered()) , this , SLOT(browseNetlist ())); + connect ( _graphicsSettings , SIGNAL(styleChanged()), _cellWidget, SLOT(redraw()) ); + connect ( _refreshAction , SIGNAL(triggered()) , _cellWidget, SLOT(redraw()) ); + connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents()) ); + connect ( _showSelectionAction , SIGNAL(toggled(bool)) , _cellWidget, SLOT(setShowSelection(bool)) ); + connect ( _showPaletteAction , SIGNAL(toggled(bool)) , this , SLOT(setShowPalette(bool)) ); + connect ( _graphicsSettingsAction, SIGNAL(triggered()) , this , SLOT(showGraphicsSettings()) ); + connect ( _displayFilterAction , SIGNAL(triggered()) , this , SLOT(showDisplayFilter()) ); + connect ( _runInspectorOnDataBase, SIGNAL(triggered()) , this , SLOT(runInspectorOnDataBase())); + connect ( _runInspectorOnCell , SIGNAL(triggered()) , this , SLOT(runInspectorOnCell()) ); + connect ( _browseNetlist , SIGNAL(triggered()) , this , SLOT(browseNetlist()) ); connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&)) , _mousePosition , SLOT(setPosition(const Point&)) ); @@ -259,6 +290,8 @@ namespace Hurricane { void CellViewer::refreshHistory () { + if ( !getCell() ) return; + Cell* activeCell = getCell(); _cellHistory.remove ( activeCell ); @@ -284,8 +317,11 @@ namespace Hurricane { { _cellWidget->setCell ( cell ); - QString title - = QString("%1:<%2>").arg(_applicationName).arg(getString(cell->getName()).c_str()); + QString cellName = "None"; + if ( cell ) + cellName = getString(cell->getName()).c_str(); + + QString title = QString("%1:<%2>").arg(_applicationName).arg(cellName); setWindowTitle ( title ); refreshHistory (); @@ -338,6 +374,18 @@ namespace Hurricane { } + void CellViewer::showGraphicsSettings () + { + _graphicsSettings->show (); + } + + + void CellViewer::showDisplayFilter () + { + _displayFilter->show (); + } + + void CellViewer::openHistoryCell () { QAction* historyAction = qobject_cast ( sender() ); diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index 26788646..7730284d 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -450,7 +450,7 @@ namespace Hurricane { _drawingPlanes.painter().setClipRect ( redrawArea ); _drawingPlanes.painter().eraseRect ( redrawArea ); - int darkening = (_showSelection) ? 200 : 100; + int darkening = (_showSelection) ? Graphics::getDarkening() : 100; if ( _cell ) { @@ -826,7 +826,7 @@ namespace Hurricane { } - void CellWidget::paintEvent ( QPaintEvent* ) + void CellWidget::paintEvent ( QPaintEvent* event ) { _drawingPlanes.painterBegin ( 2 ); _drawingPlanes.copyToScreen (); diff --git a/hurricane/src/hviewer/DisplayStyle.cpp b/hurricane/src/hviewer/DisplayStyle.cpp index 5542bab3..e0c85071 100644 --- a/hurricane/src/hviewer/DisplayStyle.cpp +++ b/hurricane/src/hviewer/DisplayStyle.cpp @@ -234,7 +234,10 @@ namespace Hurricane { DisplayStyle::DisplayStyle ( const Name& name ) - : _name(name), _groups() + : _name(name) + , _description("") + , _groups() + , _darkening(200) { addDrawingStyle ( Viewer, Fallback , "FFFFFFFFFFFFFFFF", 0, 0, 0, 1, 1.0 ); addDrawingStyle ( Viewer, Background , "FFFFFFFFFFFFFFFF", 50, 50, 50, 1, 1.0 ); @@ -245,8 +248,8 @@ namespace Hurricane { addDrawingStyle ( Viewer, Marker , "FFFFFFFFFFFFFFFF", 80, 250, 80, 1, 1.0 ); addDrawingStyle ( Viewer, SelectionDraw, "FFFFFFFFFFFFFFFF", 255, 255, 255, 1, 1.0 ); addDrawingStyle ( Viewer, SelectionFill, "FFFFFFFFFFFFFFFF", 255, 255, 255, 1, 1.0 ); - addDrawingStyle ( Viewer, Grid , "FFFFFFFFFFFFFFFF", 255, 255, 255, 1, 1.0 ); - addDrawingStyle ( Viewer, Spot , "FFFFFFFFFFFFFFFF", 255, 255, 255, 1, 1.0 ); + addDrawingStyle ( Viewer, Grid , "FFFFFFFFFFFFFFFF", 255, 255, 255, 1, 8.0 ); + addDrawingStyle ( Viewer, Spot , "FFFFFFFFFFFFFFFF", 255, 255, 255, 1, 8.0 ); addDrawingStyle ( Viewer, Ghost , "FFFFFFFFFFFFFFFF", 255, 255, 255, 1, 1.0 ); addDrawingStyle ( Viewer, Text , "8822441188224411", 255, 255, 255, 0, 1.0 ); addDrawingStyle ( Viewer, Undef , "2244118822441188", 238, 130, 238, 0, 1.0 ); @@ -345,6 +348,17 @@ namespace Hurricane { } + void DisplayStyle::setDarkening ( int darkening ) + { + if ( darkening <= 0 ) { + cerr << "[ERROR] Invalid darkening factor: " << darkening << "." << endl; + return; + } + + _darkening = darkening; + } + + void DisplayStyle::addDrawingStyle ( const Name& groupKey , const Name& key , const string& pattern @@ -366,9 +380,12 @@ namespace Hurricane { { assert ( base != NULL ); - for ( size_t gi=0 ; gi < base->_groups.size() ; gi++ ) { - _groups.push_back ( base->_groups[gi]->getClone() ); - } + for ( size_t i=0 ; i<_groups.size() ; i++ ) + delete _groups[i]; + _groups.clear (); + + for ( size_t gi=0 ; gi < base->_groups.size() ; gi++ ) + _groups.push_back ( base->_groups[gi]->getClone()); } diff --git a/hurricane/src/hviewer/Graphics.cpp b/hurricane/src/hviewer/Graphics.cpp index d1b7b7eb..557bb5c8 100644 --- a/hurricane/src/hviewer/Graphics.cpp +++ b/hurricane/src/hviewer/Graphics.cpp @@ -78,6 +78,7 @@ namespace Hurricane { { _styles.push_back ( new DisplayStyle("Fallback") ); _active = _styles[0]; + _active->setDescription ( "Builtin fallback style" ); } @@ -102,13 +103,25 @@ namespace Hurricane { QFont fixedFont ( "Bitstream Vera Sans Mono", defaultFont.pointSize() ); fixedFont.setWeight ( weight ); - fixedFont.setUnderline ( italic ); + fixedFont.setItalic ( italic ); fixedFont.setUnderline ( underline ); return fixedFont; } + const QFont Graphics::getNormalFont ( bool bold, bool italic, bool underline ) + { + QFont defaultFont = QApplication::font (); + + defaultFont.setBold ( bold ); + defaultFont.setItalic ( italic ); + defaultFont.setUnderline ( underline ); + + return defaultFont; + } + + size_t Graphics::_findStyle ( const Name& name ) const { size_t si = 0; @@ -150,6 +163,17 @@ namespace Hurricane { } + void Graphics::_setStyle ( size_t id ) + { + if ( id >= _styles.size() ) { + cerr << "[WARNING] Graphics::setStyle(): no style id \"" << id << "\"." << endl; + return; + } + + _active = _styles [ id ]; + } + + DisplayStyle* Graphics::_getStyle ( const Name& key ) { size_t si = _findStyle(key); @@ -172,6 +196,12 @@ namespace Hurricane { } + void Graphics::setStyle ( size_t id ) + { + getGraphics()->_setStyle ( id ); + } + + DisplayStyle* Graphics::getStyle ( const Name& key ) { return getGraphics()->_getStyle ( key ); @@ -184,6 +214,12 @@ namespace Hurricane { } + const vector& Graphics::getStyles () + { + return getGraphics()->_getStyles (); + } + + const Name& Graphics::getGroup ( const Name& key ) { return getGraphics()->_getGroup ( key ); @@ -220,6 +256,12 @@ namespace Hurricane { } + int Graphics::getDarkening () + { + return getGraphics()->_getDarkening (); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/HDisplayFilter.cpp b/hurricane/src/hviewer/HDisplayFilter.cpp new file mode 100644 index 00000000..10bffc1e --- /dev/null +++ b/hurricane/src/hviewer/HDisplayFilter.cpp @@ -0,0 +1,153 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// 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 | +// | =============================================================== | +// | C++ Module : "./HDisplayFilter.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include +#include +#include + +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/CellWidget.h" +#include "hurricane/viewer/HDisplayFilter.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "HDisplayFilter". + + + HDisplayFilter::HDisplayFilter ( QWidget* parent ) + : QWidget(parent) + , _cellWidget(NULL) + , _startSpinBox(NULL) + , _stopSpinBox(NULL) + { + setAttribute ( Qt::WA_QuitOnClose, false ); + setWindowTitle ( tr("Display Filter") ); + setFont ( Graphics::getNormalFont(true) ); + + QGroupBox* groupBox = new QGroupBox ( tr("Hierarchy Levels") ); + QGridLayout* gLayout = new QGridLayout (); + QGridLayout* wLayout = new QGridLayout (); + + QLabel* label = new QLabel (); + label->setText ( "Hierarchy Start Level" ); + label->setFont ( Graphics::getNormalFont() ); + + _startSpinBox = new QSpinBox (); + _startSpinBox->setFont ( Graphics::getNormalFont() ); + + gLayout->addWidget ( label , 0, 0 ); + gLayout->addWidget ( _startSpinBox, 0, 1 ); + + label = new QLabel (); + label->setText ( "Hierarchy Stop Level" ); + label->setFont ( Graphics::getNormalFont() ); + + _stopSpinBox = new QSpinBox (); + _stopSpinBox->setFont ( Graphics::getNormalFont() ); + _stopSpinBox->setValue ( 100 ); + + gLayout->addWidget ( label , 1, 0 ); + gLayout->addWidget ( _stopSpinBox, 1, 1 ); + + groupBox->setLayout ( gLayout ); + wLayout->addWidget ( groupBox, 0, 0 ); + setLayout ( wLayout ); + + connect ( _startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(startLevelChanged(int)) ); + connect ( _stopSpinBox , SIGNAL(valueChanged(int)), this, SLOT(stopLevelChanged (int)) ); + } + + + void HDisplayFilter::setCellWidget ( CellWidget* cw ) + { + if ( !cw ) { + if ( _cellWidget ) + disconnect ( _cellWidget, SLOT(redraw()) ); + _cellWidget = NULL; + return; + } + _cellWidget = cw; + connect ( this, SIGNAL(filterChanged()), _cellWidget, SLOT(redraw()) ); + } + + + void HDisplayFilter::startLevelChanged ( int level ) + { + if ( _cellWidget ) { + _cellWidget->setStartLevel ( level ); + if ( _stopSpinBox->value() < level ) { + _stopSpinBox->setValue ( level ); + return; + } + emit filterChanged(); + } + } + + + void HDisplayFilter::stopLevelChanged ( int level ) + { + if ( _cellWidget ) { + _cellWidget->setStopLevel ( level ); + if ( _startSpinBox->value() > level ) { + _startSpinBox->setValue ( level ); + return; + } + emit filterChanged(); + } + } + + +} diff --git a/hurricane/src/hviewer/HGraphics.cpp b/hurricane/src/hviewer/HGraphics.cpp new file mode 100644 index 00000000..c5da9673 --- /dev/null +++ b/hurricane/src/hviewer/HGraphics.cpp @@ -0,0 +1,120 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// 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 | +// | =============================================================== | +// | C++ Module : "./HGraphics.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include +#include +#include +#include + +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/DisplayStyle.h" +#include "hurricane/viewer/HGraphics.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "HGraphics". + + + HGraphics::HGraphics ( QWidget* parent ) + : QWidget(parent) + { + setAttribute ( Qt::WA_QuitOnClose, false ); + setWindowTitle ( tr("Display Styles") ); + setFont ( Graphics::getNormalFont(true) ); + + QButtonGroup* group = new QButtonGroup (); + QGroupBox* groupBox = new QGroupBox ( tr("Display Styles") ); + QGridLayout* gLayout = new QGridLayout (); + QGridLayout* wLayout = new QGridLayout (); + + const vector& styles = Graphics::getStyles (); + DisplayStyle* activeStyle = Graphics::getStyle (); + + size_t hideFallback = (styles.size() > 1) ? 1 : 0; + for ( size_t istyle=hideFallback ; istyle < styles.size() ; istyle++ ) { + QRadioButton* button = new QRadioButton (); + button->setText ( getString(styles[istyle]->getName()).c_str() ); + if ( activeStyle == styles[istyle] ) + button->setChecked ( true ); + QLabel* label = new QLabel (); + label->setText ( styles[istyle]->getDescription().c_str() ); + label->setFont ( Graphics::getNormalFont() ); + + gLayout->addWidget ( button, istyle-hideFallback, 0 ); + gLayout->addWidget ( label , istyle-hideFallback, 1 ); + + group->setId ( button, istyle ); + group->addButton ( button ); + } + + groupBox->setLayout ( gLayout ); + wLayout->addWidget ( groupBox, 0, 0 ); + setLayout ( wLayout ); + + connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(styleChanged(int)) ); + } + + + void HGraphics::styleChanged ( int id ) + { + Graphics::setStyle ( (size_t)id ); + cerr << "HGraphics::setStyle() - " << getString(Graphics::getStyle()->getName()) << endl; + emit styleChanged (); + } + + + +} diff --git a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h index 57514926..cdd01945 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h @@ -70,13 +70,13 @@ class QMenu; #include "hurricane/Occurrence.h" - - namespace Hurricane { class Cell; class HPalette; + class HGraphics; + class HDisplayFilter; //class MapView; class CellWidget; class HMousePosition; @@ -97,6 +97,8 @@ namespace Hurricane { void unselectAll (); public slots: void setShowPalette ( bool show ); + void showGraphicsSettings (); + void showDisplayFilter (); void openHistoryCell (); void runInspectorOnDataBase (); void runInspectorOnCell (); @@ -110,11 +112,14 @@ namespace Hurricane { QAction* _nextAction; QAction* _cellHistoryAction[CellHistorySize]; QAction* _saveAction; + QAction* _closeAction; QAction* _exitAction; QAction* _refreshAction; QAction* _fitToContentsAction; QAction* _showSelectionAction; QAction* _showPaletteAction; + QAction* _graphicsSettingsAction; + QAction* _displayFilterAction; QAction* _runInspectorOnDataBase; QAction* _runInspectorOnCell; QAction* _browseNetlist; @@ -124,6 +129,8 @@ namespace Hurricane { //MapView* _mapView; HPalette* _palette; HMousePosition* _mousePosition; + HGraphics* _graphicsSettings; + HDisplayFilter* _displayFilter; CellWidget* _cellWidget; list _cellHistory; diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index 1a1f7d80..76405106 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -126,6 +126,8 @@ namespace Hurricane { void select ( Occurrence& occurence ); void unselect ( Occurrence& occurence ); void unselectAll ( bool delayRedraw=true ); + inline void setStartLevel ( int level ); + inline void setStopLevel ( int level ); // Painter control & Hurricane objects drawing primitives. bool isDrawable ( const Name& entryName ); void drawBox ( const Box& ); @@ -379,11 +381,19 @@ namespace Hurricane { { copyToScreen ( 0, 0, width(), height() ); } - inline CellWidget::DrawingPlanes& CellWidget::getDrawingPlanes () + inline void CellWidget::setStartLevel ( int level ) + { _drawingQuery.setStartLevel ( level ); } + + + inline void CellWidget::setStopLevel ( int level ) + { _drawingQuery.setStopLevel ( level ); } + + + inline CellWidget::DrawingPlanes& CellWidget::getDrawingPlanes () { return _drawingPlanes; } - inline set& CellWidget::getSelectorSet () + inline set& CellWidget::getSelectorSet () { return _selectors; } diff --git a/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h b/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h index 7d1fb09d..28b31d6c 100644 --- a/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h +++ b/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h @@ -186,6 +186,8 @@ namespace Hurricane { // Accessors. const Name& getName () const; + inline const string& getDescription () const; + inline int getDarkening () const; const Name& getGroup ( const Name& key ) const; const string& getPattern ( const Name& key ) const; QColor getColor ( const Name& key, int darkening ) const; @@ -196,7 +198,10 @@ namespace Hurricane { DrawingStyle* find ( const Name& key ) const; // Modifiers. + inline void setDescription ( const string& description ); + inline void setDescription ( const char* description ); void inheritFrom ( const DisplayStyle* base ); + void setDarkening ( int darkening ); void addDrawingStyle ( const Name& groupKey , const Name& key , const string& pattern @@ -210,7 +215,9 @@ namespace Hurricane { protected: // Internals - Attributes. const Name _name; + string _description; vector _groups; + int _darkening; // Internals - Methods. void findOrCreate ( const Name& groupKey @@ -235,6 +242,10 @@ namespace Hurricane { inline const Name& DisplayStyle::getName () const { return _name; } inline vector& DisplayStyle::getDrawingGroups () { return _groups; } + inline int DisplayStyle::getDarkening () const { return _darkening; } + inline const string& DisplayStyle::getDescription () const { return _description; } + inline void DisplayStyle::setDescription ( const string& description ) { _description = description; } + inline void DisplayStyle::setDescription ( const char* description ) { _description = description; } } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/hurricane/viewer/Graphics.h b/hurricane/src/hviewer/hurricane/viewer/Graphics.h index 795f18a6..45ef0189 100644 --- a/hurricane/src/hviewer/hurricane/viewer/Graphics.h +++ b/hurricane/src/hviewer/hurricane/viewer/Graphics.h @@ -77,45 +77,52 @@ namespace Hurricane { public: // Accessors. - static Graphics* getGraphics (); - static const QFont getFixedFont ( int weight=-1, bool italic=false, bool underline=false ); - static const Name& getGroup ( const Name& key ); - static QColor getColor ( const Name& key, int darkening=100 ); - static QPen getPen ( const Name& key, int darkening=100 ); - static QBrush getBrush ( const Name& key, int darkening=100 ); - static const string& getPattern ( const Name& key ); - static float getThreshold ( const Name& key ); + static Graphics* getGraphics (); + static const QFont getFixedFont ( int weight=-1, bool italic=false, bool underline=false ); + static const QFont getNormalFont ( bool bold=false, bool italic=false, bool underline=false ); + static const Name& getGroup ( const Name& key ); + static QColor getColor ( const Name& key, int darkening=100 ); + static QPen getPen ( const Name& key, int darkening=100 ); + static QBrush getBrush ( const Name& key, int darkening=100 ); + static const string& getPattern ( const Name& key ); + static float getThreshold ( const Name& key ); + static int getDarkening (); // Modifiers. - static void addStyle ( DisplayStyle* displayStyle ); - static void setStyle ( const Name& key ); - static DisplayStyle* getStyle ( const Name& key ); - static DisplayStyle* getStyle (); + static void addStyle ( DisplayStyle* displayStyle ); + static void setStyle ( const Name& key ); + static void setStyle ( size_t id ); + static DisplayStyle* getStyle ( const Name& key ); + static DisplayStyle* getStyle (); + static const vector& getStyles (); // Internals - Attributes. protected: - static Graphics* _singleton; - vector _styles; - DisplayStyle* _active; + static Graphics* _singleton; + vector _styles; + DisplayStyle* _active; // Internals - Constructors & Destructors. - Graphics (); - Graphics ( const Graphics& ); - Graphics& operator= ( const Graphics& ); - ~Graphics (); + Graphics (); + Graphics ( const Graphics& ); + Graphics& operator= ( const Graphics& ); + ~Graphics (); // Internals - Methods. - size_t _findStyle ( const Name& key ) const; - void _addStyle ( DisplayStyle* displayStyle ); - void _setStyle ( const Name& key ); - DisplayStyle* _getStyle ( const Name& key ); - DisplayStyle* _getStyle () const; - inline const Name& _getGroup ( const Name& key ) const; - inline QColor _getColor ( const Name& key, int darkening ) const; - inline QPen _getPen ( const Name& key, int darkening ) const; - inline QBrush _getBrush ( const Name& key, int darkening ) const; - inline const string& _getPattern ( const Name& key ) const; - inline float _getThreshold ( const Name& key ) const; + size_t _findStyle ( const Name& key ) const; + void _addStyle ( DisplayStyle* displayStyle ); + void _setStyle ( const Name& key ); + void _setStyle ( size_t id ); + DisplayStyle* _getStyle ( const Name& key ); + DisplayStyle* _getStyle () const; + inline const vector& _getStyles () const; + inline const Name& _getGroup ( const Name& key ) const; + inline QColor _getColor ( const Name& key, int darkening ) const; + inline QPen _getPen ( const Name& key, int darkening ) const; + inline QBrush _getBrush ( const Name& key, int darkening ) const; + inline const string& _getPattern ( const Name& key ) const; + inline float _getThreshold ( const Name& key ) const; + inline int _getDarkening () const; }; @@ -138,9 +145,15 @@ namespace Hurricane { inline float Graphics::_getThreshold ( const Name& name ) const { return _active->getThreshold(name); } + inline int Graphics::_getDarkening () const + { return _active->getDarkening(); } + inline DisplayStyle* Graphics::_getStyle () const { return _active; } + inline const vector& Graphics::_getStyles () const + { return _styles; } + diff --git a/hurricane/src/hviewer/hurricane/viewer/HDisplayFilter.h b/hurricane/src/hviewer/hurricane/viewer/HDisplayFilter.h new file mode 100644 index 00000000..022af24b --- /dev/null +++ b/hurricane/src/hviewer/hurricane/viewer/HDisplayFilter.h @@ -0,0 +1,92 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// 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 | +// | =============================================================== | +// | C++ Header : "./HDisplayFilter.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_HDISPLAY_FILTER_H__ +#define __HURRICANE_HDISPLAY_FILTER_H__ + + +#include + +class QSpinBox; + + +namespace Hurricane { + + + class CellWidget; + + + class HDisplayFilter : public QWidget { + Q_OBJECT; + + public: + HDisplayFilter ( QWidget* parent=NULL ); + void setCellWidget ( CellWidget* ); + + signals: + void filterChanged (); + + public slots: + void startLevelChanged ( int level ); + void stopLevelChanged ( int level ); + + protected: + CellWidget* _cellWidget; + QSpinBox* _startSpinBox; + QSpinBox* _stopSpinBox; + }; + + +} // End of Hurricane namespace. + + +#endif diff --git a/hurricane/src/hviewer/hurricane/viewer/HGraphics.h b/hurricane/src/hviewer/hurricane/viewer/HGraphics.h new file mode 100644 index 00000000..a4499a84 --- /dev/null +++ b/hurricane/src/hviewer/hurricane/viewer/HGraphics.h @@ -0,0 +1,78 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// 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 | +// | =============================================================== | +// | C++ Header : "./HGraphics.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_HGRAPHICS_H__ +#define __HURRICANE_HGRAPHICS_H__ + + +#include + + +namespace Hurricane { + + + class HGraphics : public QWidget { + Q_OBJECT; + + public: + HGraphics ( QWidget* parent=NULL ); + signals: + void styleChanged (); + public slots: + void styleChanged ( int id ); + }; + + +} // End of Hurricane namespace. + + +#endif