From 01ddcf4279d1ca6b84085adcd34ebde763cc41a0 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 26 Nov 2008 09:35:07 +0000 Subject: [PATCH] * ./hurricane/src/hviewer : - New feature : first try at a more ergonomic interface. The "Controller", a simple Tabbed window for managing all settings. Reorganize the way things are selected (Nets, Area, single), aglomerated selection. Use a "logical" progression Netlist -> Selection -> Inspector. - In CellWiddget, new Selection managment mecanism to ensure persistent Selection across cell modifications. New signals/slots to manage Cell modification : a. - cellPreModificated() : must be launched *before* the Cell modification by the tool about to modify it. b. - cellPostModificated() : must be lauched *after* the Cell modification This mecanism may be amended to automatically fit with the UpdateSessions. - Cleanup (part 1) : more consistent name for widgets, replace the 'H' prefix by a "Widget" suffix. Objects are modified by not filenames yet (due to svn not liking file renaming and modications at the same time). - Improved support for static building in CMakeList.txt. --- hurricane/cmake_modules/FindHURRICANE.cmake | 126 +++------ hurricane/doc/hviewer/DisplayStyle.dox | 2 +- hurricane/doc/hviewer/HInspectorWidget.dox | 4 +- hurricane/src/hviewer/CMakeLists.txt | 27 +- hurricane/src/hviewer/CellViewer.cpp | 220 +++------------ hurricane/src/hviewer/CellViewer.qrc | 1 + hurricane/src/hviewer/CellWidget.cpp | 136 +++++++-- hurricane/src/hviewer/DisplayStyle.cpp | 40 +-- hurricane/src/hviewer/Graphics.cpp | 31 +- hurricane/src/hviewer/GroupPaletteEntry.cpp | 207 -------------- hurricane/src/hviewer/HDisplayFilter.cpp | 62 ++-- .../src/hviewer/HExtensionPaletteEntry.cpp | 119 -------- hurricane/src/hviewer/HGraphics.cpp | 48 +--- hurricane/src/hviewer/HInspectorWidget.cpp | 102 +++---- hurricane/src/hviewer/HMousePosition.cpp | 50 +--- hurricane/src/hviewer/HNetlist.cpp | 132 ++++----- hurricane/src/hviewer/HNetlistModel.cpp | 73 ++--- hurricane/src/hviewer/HPalette.cpp | 266 ------------------ hurricane/src/hviewer/HPaletteEntry.cpp | 102 ------- hurricane/src/hviewer/HSelection.cpp | 121 ++++---- hurricane/src/hviewer/HSelectionModel.cpp | 61 ++-- hurricane/src/hviewer/LayerPaletteEntry.cpp | 150 ---------- hurricane/src/hviewer/RecordModel.cpp | 40 +-- hurricane/src/hviewer/ViewerPaletteEntry.cpp | 149 ---------- .../src/hviewer/hurricane/viewer/CellViewer.h | 125 ++++---- .../src/hviewer/hurricane/viewer/CellWidget.h | 260 +++++++++-------- .../hviewer/hurricane/viewer/DisplayStyle.h | 180 ++++++------ .../hurricane/viewer/GroupPaletteEntry.h | 109 ------- .../hviewer/hurricane/viewer/HDisplayFilter.h | 63 ++--- .../hurricane/viewer/HExtensionPaletteEntry.h | 77 ----- .../src/hviewer/hurricane/viewer/HGraphics.h | 45 +-- .../hurricane/viewer/HInspectorWidget.h | 47 +--- .../hviewer/hurricane/viewer/HMousePosition.h | 66 ++--- .../src/hviewer/hurricane/viewer/HNetlist.h | 75 ++--- .../hviewer/hurricane/viewer/HNetlistModel.h | 70 ++--- .../src/hviewer/hurricane/viewer/HPalette.h | 121 -------- .../hviewer/hurricane/viewer/HPaletteEntry.h | 127 --------- .../src/hviewer/hurricane/viewer/HSelection.h | 85 +++--- .../hurricane/viewer/HSelectionModel.h | 39 +-- .../hurricane/viewer/LayerPaletteEntry.h | 103 ------- .../hurricane/viewer/ViewerPaletteEntry.h | 104 ------- 41 files changed, 878 insertions(+), 3087 deletions(-) delete mode 100644 hurricane/src/hviewer/GroupPaletteEntry.cpp delete mode 100644 hurricane/src/hviewer/HExtensionPaletteEntry.cpp delete mode 100644 hurricane/src/hviewer/HPalette.cpp delete mode 100644 hurricane/src/hviewer/HPaletteEntry.cpp delete mode 100644 hurricane/src/hviewer/LayerPaletteEntry.cpp delete mode 100644 hurricane/src/hviewer/ViewerPaletteEntry.cpp delete mode 100644 hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h delete mode 100644 hurricane/src/hviewer/hurricane/viewer/HExtensionPaletteEntry.h delete mode 100644 hurricane/src/hviewer/hurricane/viewer/HPalette.h delete mode 100644 hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h delete mode 100644 hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h delete mode 100644 hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h diff --git a/hurricane/cmake_modules/FindHURRICANE.cmake b/hurricane/cmake_modules/FindHURRICANE.cmake index 09edd474..97c25454 100644 --- a/hurricane/cmake_modules/FindHURRICANE.cmake +++ b/hurricane/cmake_modules/FindHURRICANE.cmake @@ -6,6 +6,48 @@ # HURRICANE_LIBRARIES - The path to where the Hurricane library files are. +MACRO(SET_LIBRARIES_PATH configname library) + SET(${configname}_FOUND "NOTFOUND") + SET(${configname}_STATIC_FOUND "NOTFOUND") + + IF(${library}_LIBRARY_PATH) + SET(${configname}_FOUND "YES") + SET(${configname}_INCLUDE_DIR ${${library}_INCLUDE_PATH}) + SET(${configname}_LIBRARIES ${${library}_LIBRARY_PATH} ${${configname}_LIBRARIES}) + MARK_AS_ADVANCED(${configname}_INCLUDE_DIR ${configname}_LIBRARIES) + ENDIF(${library}_LIBRARY_PATH) + + IF(${library}_STATIC_LIBRARY_PATH) + SET(${configname}_STATIC_FOUND "YES") + SET(${configname}_INCLUDE_DIR ${${library}_INCLUDE_PATH}) + SET(${configname}_STATIC_LIBRARIES ${${library}_STATIC_LIBRARY_PATH} ${${configname}_STATIC_LIBRARIES}) + MARK_AS_ADVANCED(${configname}_INCLUDE_DIR ${configname}_STATIC_LIBRARIES) + ENDIF(${library}_STATIC_LIBRARY_PATH) + + IF(NOT ${library}_INCLUDE_PATH) + SET(${configname}_FOUND "NOTFOUND") + SET(${configname}_STATIC_FOUND "NOTFOUND") + ENDIF(NOT ${library}_INCLUDE_PATH) +ENDMACRO ( SET_LIBRARIES_PATH ) + +MACRO(HURRICANE_CHECK_LIBRARIES package) + IF(${package}_FOUND OR ${package}_STATIC_FOUND) + IF(NOT ${package}_FIND_QUIETLY) + IF(${package}_FOUND) + MESSAGE(STATUS "Found ${package} : ${${package}_LIBRARIES}") + ENDIF(${package}_FOUND) + IF(${package}_STATIC_FOUND) + MESSAGE(STATUS "Found ${package} (static): ${${package}_STATIC_LIBRARIES}") + ENDIF(${package}_STATIC_FOUND) + ENDIF(NOT ${package}_FIND_QUIETLY) + ELSE(${package}_FOUND OR ${package}_STATIC_FOUND) + IF(${package}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${package} was not found. ${${package}_DIR_MESSAGE}") + ENDIF(${package}_FIND_REQUIRED) + ENDIF(${package}_FOUND OR ${package}_STATIC_FOUND) +ENDMACRO(HURRICANE_CHECK_LIBRARIES) + + SET(HURRICANE_INCLUDE_PATH_DESCRIPTION "The directory containing the Hurricane include files. E.g /usr/local/include or /asim/coriolis/include") SET(HURRICANE_LIBRARY_PATH_DESCRIPTION "The directory containing the Hurricane library files. E.g /usr/local/lib or /asim/coriolis/lib") SET(HURRICANE_DIR_MESSAGE "Set the HURRICANE_INCLUDE_DIR cmake cache entry to the ${HURRICANE_INCLUDE_PATH_DESCRIPTION}") @@ -85,86 +127,10 @@ IF(UNIX) DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}" ) - # Assume we didn't find it. - SET(HURRICANE_FOUND "NOTFOUND") - SET(HURRICANE_STATIC_FOUND "NOTFOUND") - SET(HURRICANE_GRAPHICAL_FOUND "NOTFOUND") - SET(HURRICANE_GRAPHICAL_STATIC_FOUND "NOTFOUND") - SET(HURRICANE_PYTHON_FOUND "NOTFOUND") + SET_LIBRARIES_PATH(HURRICANE HURRICANE) + SET_LIBRARIES_PATH(HURRICANE_GRAPHICAL HURRICANE_VIEWER) + SET_LIBRARIES_PATH(HURRICANE_PYTHON HURRICANE_PYTHON) - IF(HURRICANE_INCLUDE_PATH) - IF(HURRICANE_LIBRARY_PATH) - SET(HURRICANE_FOUND "YES") - SET(HURRICANE_INCLUDE_DIR - ${HURRICANE_INCLUDE_PATH} - ) - SET(HURRICANE_LIBRARIES - ${HURRICANE_LIBRARY_PATH} - ) - ENDIF(HURRICANE_LIBRARY_PATH) - IF(HURRICANE_STATIC_LIBRARY_PATH) - SET(HURRICANE_STATIC_FOUND "YES") - SET(HURRICANE_INCLUDE_DIR - ${HURRICANE_INCLUDE_PATH} - ) - SET(HURRICANE_STATIC_LIBRARIES - ${HURRICANE_STATIC_LIBRARY_PATH} - ) - ENDIF(HURRICANE_STATIC_LIBRARY_PATH) - ENDIF(HURRICANE_INCLUDE_PATH) - - IF(HURRICANE_GRAPHICAL_INCLUDE_PATH) - IF(HURRICANE_GRAPHICAL_LIBRARY_PATH) - SET(HURRICANE_GRAPHICAL_FOUND "YES") - SET(HURRICANE_GRAPHICAL_INCLUDE_DIR - ${HURRICANE_GRAPHICAL_INCLUDE_PATH} - ) - SET(HURRICANE_GRAPHICAL_LIBRARIES - ${HURRICANE_GRAPHICAL_LIBRARY_PATH} - ) - ENDIF(HURRICANE_GRAPHICAL_LIBRARY_PATH) - IF(HURRICANE_GRAPHICAL_STATIC_LIBRARY_PATH) - SET(HURRICANE_GRAPHICAL_STATIC_FOUND "YES") - SET(HURRICANE_GRAPHICAL_INCLUDE_DIR - ${HURRICANE_GRAPHICAL_INCLUDE_PATH} - ) - SET(HURRICANE_GRAPHICAL_STATIC_LIBRARIES - ${HURRICANE_GRAPHICAL_STATIC_LIBRARY_PATH} - ) - ENDIF(HURRICANE_GRAPHICAL_STATIC_LIBRARY_PATH) - ENDIF(HURRICANE_GRAPHICAL_INCLUDE_PATH) - - IF(HURRICANE_PYTHON_INCLUDE_PATH) - IF(HURRICANE_PYTHON_LIBRARY_PATH) - SET(HURRICANE_PYTHON_FOUND "YES") - SET(HURRICANE_PYTHON_INCLUDE_DIR - ${HURRICANE_PYTHON_INCLUDE_PATH} - ) - SET(HURRICANE_PYTHON_LIBRARIES - ${HURRICANE_PYTHON_LIBRARY_PATH} - ) - ENDIF(HURRICANE_PYTHON_LIBRARY_PATH) - ENDIF(HURRICANE_PYTHON_INCLUDE_PATH) - - IF(HURRICANE_FOUND OR HURRICANE_STATIC_FOUND) - IF(NOT HURRICANE_FIND_QUIETLY) - MESSAGE(STATUS "Found HURRICANE : ${HURRICANE_LIBRARIES}") - ENDIF(NOT HURRICANE_FIND_QUIETLY) - ELSE(HURRICANE_FOUND OR HURRICANE_STATIC_FOUND) - IF(HURRICANE_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "HURRICANE was not found. ${HURRICANE_DIR_MESSAGE}") - ENDIF(HURRICANE_FIND_REQUIRED) - ENDIF(HURRICANE_FOUND OR HURRICANE_STATIC_FOUND) - - MARK_AS_ADVANCED( - HURRICANE_INCLUDE_PATH - HURRICANE_LIBRARY_PATH - HURRICANE_STATIC_LIBRARY_PATH - HURRICANE_GRAPHICAL_INCLUDE_PATH - HURRICANE_GRAPHICAL_LIBRARY_PATH - HURRICANE_GRAPHICAL_STATIC_LIBRARY_PATH - HURRICANE_PYTHON_INCLUDE_PATH - HURRICANE_PYTHON_LIBRARY_PATH - ) + HURRICANE_CHECK_LIBRARIES(HURRICANE) ENDIF(UNIX) diff --git a/hurricane/doc/hviewer/DisplayStyle.dox b/hurricane/doc/hviewer/DisplayStyle.dox index bec71664..11571463 100644 --- a/hurricane/doc/hviewer/DisplayStyle.dox +++ b/hurricane/doc/hviewer/DisplayStyle.dox @@ -66,7 +66,7 @@ * \Return The display threshold associated to the DrawingStyle \e key. */ - /*! \function vector& DisplayStyle::getDrawingGroups(); + /*! \function const vector& DisplayStyle::getDrawingGroups() const; * \Return The vector of groups. */ diff --git a/hurricane/doc/hviewer/HInspectorWidget.dox b/hurricane/doc/hviewer/HInspectorWidget.dox index c47dcd93..66b3749f 100644 --- a/hurricane/doc/hviewer/HInspectorWidget.dox +++ b/hurricane/doc/hviewer/HInspectorWidget.dox @@ -42,7 +42,7 @@ //! \name Constructors & Destructors // \{ - /*! \function HInspectorWidget::HInspectorWidget(QWidget* parent=NULL); + /*! \function InspectorWidget::InspectorWidget(QWidget* parent=NULL); * Construct a HInspectorWidget. The root Record to browse must * be sets immediatly afterwards with the setRootRecord() * method. @@ -54,7 +54,7 @@ //! \name Modifiers // \{ - /*! \function void HInspectorWidget::setRootRecord(Record* record); + /*! \function void InspectorWidget::setRootRecord(Record* record); * Sets the root record of the Inspector. Note that the * previous root record is freed. */ diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index 99f2d041..8c4d6b12 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -4,12 +4,10 @@ include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane ${HURRICANE_SOURCE_DIR}/src/hviewer ) - set ( mocincludes hurricane/viewer/HPaletteEntry.h - hurricane/viewer/LayerPaletteEntry.h - hurricane/viewer/HExtensionPaletteEntry.h - hurricane/viewer/GroupPaletteEntry.h - hurricane/viewer/ViewerPaletteEntry.h - hurricane/viewer/HPalette.h + set ( mocincludes hurricane/viewer/PaletteItem.h + hurricane/viewer/PaletteNamedItem.h + hurricane/viewer/PaletteLayerItem.h + hurricane/viewer/PaletteWidget.h hurricane/viewer/HGraphics.h hurricane/viewer/DynamicLabel.h hurricane/viewer/HMousePosition.h @@ -27,10 +25,9 @@ hurricane/viewer/HNetlistModel.h hurricane/viewer/HNetlist.h hurricane/viewer/HDisplayFilter.h + hurricane/viewer/ControllerWidget.h ) set ( exports hurricane/viewer/ScreenUtilities.h - hurricane/viewer/HPaletteEntry.h - hurricane/viewer/HPalette.h hurricane/viewer/DisplayStyle.h hurricane/viewer/ColorScale.h hurricane/viewer/Graphics.h @@ -41,6 +38,7 @@ hurricane/viewer/MoveCommand.h hurricane/viewer/ZoomCommand.h hurricane/viewer/SelectCommand.h + hurricane/viewer/SelectorCommand.h hurricane/viewer/CellWidget.h hurricane/viewer/CellWidgets.h hurricane/viewer/CellViewer.h @@ -52,18 +50,17 @@ hurricane/viewer/NetInformations.h hurricane/viewer/HNetlist.h hurricane/viewer/HDisplayFilter.h + hurricane/viewer/ControllerWidget.h ) set ( cpps ScreenUtilities.cpp DisplayStyle.cpp ColorScale.cpp Graphics.cpp HGraphics.cpp - HPaletteEntry.cpp - LayerPaletteEntry.cpp - HExtensionPaletteEntry.cpp - GroupPaletteEntry.cpp - ViewerPaletteEntry.cpp - HPalette.cpp + PaletteItem.cpp + PaletteNamedItem.cpp + PaletteLayerItem.cpp + PaletteWidget.cpp DynamicLabel.cpp HMousePosition.cpp Selector.cpp @@ -72,6 +69,7 @@ MoveCommand.cpp ZoomCommand.cpp SelectCommand.cpp + SelectorCommand.cpp CellWidget.cpp CellViewer.cpp RecordModel.cpp @@ -84,6 +82,7 @@ HNetlistModel.cpp HNetlist.cpp HDisplayFilter.cpp + ControllerWidget.cpp ) qt4_wrap_cpp ( MOC_SRCS ${mocincludes} ) diff --git a/hurricane/src/hviewer/CellViewer.cpp b/hurricane/src/hviewer/CellViewer.cpp index 24319f52..b1122151 100644 --- a/hurricane/src/hviewer/CellViewer.cpp +++ b/hurricane/src/hviewer/CellViewer.cpp @@ -34,15 +34,12 @@ #include "hurricane/Cell.h" //#include "MapView.h" -#include "hurricane/viewer/HPalette.h" +#include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/CellWidget.h" #include "hurricane/viewer/CellViewer.h" -#include "hurricane/viewer/HInspectorWidget.h" -#include "hurricane/viewer/HSelection.h" -#include "hurricane/viewer/HNetlist.h" +//#include "hurricane/viewer/MousePositionWidget.h" #include "hurricane/viewer/HMousePosition.h" -#include "hurricane/viewer/HGraphics.h" -#include "hurricane/viewer/HDisplayFilter.h" +#include "hurricane/viewer/ControllerWidget.h" namespace Hurricane { @@ -58,13 +55,7 @@ namespace Hurricane { , _refreshAction(NULL) , _fitToContentsAction(NULL) , _showSelectionAction(NULL) - , _showPaletteAction(NULL) - , _graphicsSettingsAction(NULL) - , _displayFilterAction(NULL) - , _runInspectorOnDataBase(NULL) - , _runInspectorOnCell(NULL) - , _browseSelection(NULL) - , _browseNetlist(NULL) + , _controllerAction(NULL) , _fileMenu(NULL) , _viewMenu(NULL) , _toolsMenu(NULL) @@ -72,15 +63,12 @@ namespace Hurricane { //, _mapView(NULL) , _palette(NULL) , _mousePosition(NULL) - , _graphicsSettings(NULL) - , _displayFilter(NULL) + , _controller(NULL) , _cellWidget(NULL) , _moveCommand() , _zoomCommand() , _selectCommand() , _cellHistory() - , _selectionBrowser(NULL) - , _netlistBrowser(NULL) { setObjectName("viewer"); @@ -89,6 +77,12 @@ namespace Hurricane { } + CellViewer::~CellViewer () + { + _controller->deleteLater (); + } + + void CellViewer::createActions () @@ -147,35 +141,10 @@ namespace Hurricane { _showSelectionAction->setShortcut ( Qt::Key_S ); _showSelectionAction->setCheckable ( true ); - _showPaletteAction = new QAction ( tr("Show &Palette"), this ); - _showPaletteAction->setObjectName ( "viewer.menuBar.view.showPalette" ); - _showPaletteAction->setStatusTip ( tr("Hide/Show the Palette sub-window") ); - _showPaletteAction->setCheckable ( true ); - _showPaletteAction->setChecked ( true ); - - _graphicsSettingsAction = new QAction ( tr("Graphics Settings"), this ); - _graphicsSettingsAction->setObjectName ( "viewer.menuBar.view.graphicsSettings" ); - _graphicsSettingsAction->setStatusTip ( tr("Tune Graphics Settings") ); - - _displayFilterAction = new QAction ( tr("Display Filter"), this ); - _displayFilterAction->setObjectName ( "viewer.menuBar.view.displayFilter" ); - _displayFilterAction->setStatusTip ( tr("Tune Cell Displaying") ); - - _runInspectorOnDataBase= new QAction ( tr("Inspect &DataBase"), this ); - _runInspectorOnDataBase->setObjectName ( "viewer.menuBar.tools.inspectDb" ); - _runInspectorOnDataBase->setStatusTip ( tr("Run Inspector on Hurricane DataBase") ); - - _runInspectorOnCell= new QAction ( tr("Inspect &Cell"), this ); - _runInspectorOnCell->setObjectName ( "viewer.menuBar.tools.inspectCell" ); - _runInspectorOnCell->setStatusTip ( tr("Run Inspector on the current Cell") ); - - _browseSelection= new QAction ( tr("Browse &Selection"), this ); - _browseSelection->setObjectName ( "viewer.menuBar.tools.browseSelection" ); - _browseSelection->setStatusTip ( tr("Browse objects currently selecteds") ); - - _browseNetlist= new QAction ( tr("Browse &Netlist"), this ); - _browseNetlist->setObjectName ( "viewer.menuBar.tools.browseNetlist" ); - _browseNetlist->setStatusTip ( tr("Browse netlist from the current Cell") ); + _controllerAction = new QAction ( tr("Controller"), this ); + _controllerAction->setObjectName ( "viewer.menuBar.tools.controller" ); + _controllerAction->setIcon ( QIcon(":/images/swiss-knife.png") ); + _controllerAction->setStatusTip ( tr("Fine Tune && Inspect DataBase") ); } @@ -204,16 +173,10 @@ namespace Hurricane { _viewMenu->addAction ( _refreshAction ); _viewMenu->addAction ( _fitToContentsAction ); _viewMenu->addAction ( _showSelectionAction ); - _viewMenu->addAction ( _showPaletteAction ); - _viewMenu->addAction ( _displayFilterAction ); - _viewMenu->addAction ( _graphicsSettingsAction ); _toolsMenu = menuBar()->addMenu ( tr("Tools") ); _toolsMenu->setObjectName ( "viewer.menuBar.tools" ); - _toolsMenu->addAction ( _runInspectorOnDataBase ); - _toolsMenu->addAction ( _runInspectorOnCell ); - _toolsMenu->addAction ( _browseSelection ); - _toolsMenu->addAction ( _browseNetlist ); + _toolsMenu->addAction ( _controllerAction ); } @@ -231,21 +194,18 @@ namespace Hurricane { { if ( _cellWidget ) return; - _cellWidget = new CellWidget (); - _palette = new HPalette (); - _graphicsSettings = new HGraphics (); - _displayFilter = new HDisplayFilter (); + _cellWidget = new CellWidget (); + _controller = new ControllerWidget (); //_mapView = _cellWidget->getMapView (); - _cellWidget->bindToPalette ( _palette ); _cellWidget->bindCommand ( &_moveCommand ); _cellWidget->bindCommand ( &_zoomCommand ); _cellWidget->bindCommand ( &_selectCommand ); - _displayFilter->setCellWidget ( _cellWidget ); + _controller->setCellWidget ( _cellWidget ); _selectCommand.bindToAction ( _showSelectionAction ); - HMousePosition* _mousePosition = new HMousePosition (); + MousePositionWidget* _mousePosition = new MousePositionWidget (); statusBar()->addPermanentWidget ( _mousePosition ); setCorner ( Qt::TopLeftCorner , Qt::LeftDockWidgetArea ); @@ -254,39 +214,29 @@ namespace Hurricane { setCorner ( Qt::BottomRightCorner, Qt::RightDockWidgetArea ); // QDockWidget* mapViewDock = new QDockWidget ( tr("Map") ); - // mapViewDock->setObjectName ( "MapView" ); + // mapViewDock->setFeatures ( QDockWidget::DockWidgetVerticalTitleBar + // | QDockWidget::DockWidgetMovable + // | QDockWidget::DockWidgetFloatable + // ); + // mapViewDock->setObjectName ( "viewer.menuBar.dock.mapView" ); // mapViewDock->setWidget ( _mapView ); // mapViewDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); // addDockWidget ( Qt::RightDockWidgetArea, mapViewDock ); - QDockWidget* layerMapDock = new QDockWidget ( tr("Layers") ); - layerMapDock->setFeatures ( QDockWidget::DockWidgetVerticalTitleBar - | QDockWidget::DockWidgetMovable - | QDockWidget::DockWidgetFloatable - ); - layerMapDock->setObjectName ( "viewer.menuBar.dock.paletteWindow" ); - layerMapDock->setWidget ( _palette ); - layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - addDockWidget ( Qt::RightDockWidgetArea, layerMapDock ); - setCentralWidget ( _cellWidget ); connect ( this , SIGNAL(redrawCellWidget()), _cellWidget, SLOT(redraw()) ); - 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 ( _browseSelection , SIGNAL(triggered()) , this , SLOT(browseSelection()) ); - connect ( _browseNetlist , SIGNAL(triggered()) , this , SLOT(browseNetlist()) ); + connect ( _controllerAction , SIGNAL(triggered()) , this , SLOT(showController()) ); connect ( _cellWidget , SIGNAL(mousePositionChanged(const Point&)) , _mousePosition , SLOT(setPosition(const Point&)) ); + connect ( _cellWidget , SIGNAL(showSelectionToggled(bool)) + , _showSelectionAction , SLOT(setChecked(bool)) ); + connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence,bool)) + , _cellWidget , SLOT (toggleSelect (Occurrence,bool)) ); - _showPaletteAction->setChecked ( false ); _cellWidget->redraw (); } @@ -345,47 +295,9 @@ namespace Hurricane { } - void CellViewer::runInspector ( Record* record ) + void CellViewer::showController () { - static HInspectorWidget* inspector = NULL; - - if ( record ) { - //if ( !inspector ) - inspector = new HInspectorWidget (); - - inspector->setRootRecord ( record ); - inspector->show (); - } else - cerr << "[ERROR] Attempt to run Inspector on NULL record." << endl; - } - - - void CellViewer::setShowPalette ( bool show ) - { - QDockWidget* paletteWindow = findChild("viewer.menuBar.dock.paletteWindow"); - - if ( !paletteWindow ) { - cerr << "paletteWindow not found." << endl; - return; - } - - if ( show ) paletteWindow->show (); - else paletteWindow->hide (); - -// if ( show ) _palette->show (); -// else _palette->hide (); - } - - - void CellViewer::showGraphicsSettings () - { - _graphicsSettings->show (); - } - - - void CellViewer::showDisplayFilter () - { - _displayFilter->show (); + _controller->show (); } @@ -404,56 +316,6 @@ namespace Hurricane { } - void CellViewer::runInspectorOnDataBase () - { - runInspector ( getRecord(DataBase::getDB()) ); - } - - - void CellViewer::runInspectorOnCell () - { - Cell* cell = _cellWidget->getCell(); - if ( cell ) runInspector ( getRecord(cell) ); - } - - - void CellViewer::browseNetlist () - { - if ( !_netlistBrowser ) { - _netlistBrowser = new HNetlist (); - _netlistBrowser->setCellWidget ( _cellWidget ); - connect ( _netlistBrowser, SIGNAL(destroyed()), this, SLOT(netlistBrowserDestroyed()) ); - } - _netlistBrowser->show (); - } - - - void CellViewer::browseSelection () - { - if ( !_selectionBrowser ) { - _selectionBrowser = new HSelection (); - _selectionBrowser->setSelection ( _cellWidget->getSelectorSet(), _cellWidget->getCell() ); - - connect ( _selectionBrowser , SIGNAL(destroyed()), this, SLOT(selectionBrowserDestroyed()) ); - connect ( _cellWidget , SIGNAL(selectionChanged(const set&,Cell*)) - , _selectionBrowser, SLOT (setSelection (const set&,Cell*)) ); - connect ( &_selectCommand , SIGNAL(selectionToggled (Occurrence,bool)) - , _cellWidget , SLOT (toggleSelect (Occurrence,bool)) ); - connect ( _selectionBrowser, SIGNAL(occurrenceToggled(Occurrence,bool)) - , _cellWidget , SLOT (toggleSelect (Occurrence,bool)) ); - connect ( _cellWidget , SIGNAL(occurrenceToggled(Occurrence)) - , _selectionBrowser, SLOT (toggleSelection (Occurrence)) ); - connect ( _selectionBrowser, SIGNAL(cumulativeToggled (bool)) - , _cellWidget , SLOT (setCumulativeSelection(bool)) ); - connect ( _selectionBrowser, SIGNAL(selectionCleared()) - , _cellWidget , SLOT (unselectAll ()) ); - connect ( _selectionBrowser, SIGNAL(showSelected (bool)) - , _cellWidget , SLOT (setShowSelection(bool)) ); - } - _selectionBrowser->show (); - } - - void CellViewer::select ( Occurrence& occurrence ) { if ( _cellWidget ) _cellWidget->select ( occurrence ); } @@ -466,22 +328,4 @@ namespace Hurricane { { if ( _cellWidget ) _cellWidget->unselectAll(); } - void CellViewer::selectionBrowserDestroyed () - { - if ( _selectionBrowser ) { - _selectionBrowser = NULL; - } else - cerr << "[ERROR] Double-destruction of the Selection Browser." << endl; - } - - - void CellViewer::netlistBrowserDestroyed () - { - if ( _netlistBrowser ) { - _netlistBrowser = NULL; - } else - cerr << "[ERROR] Double-destruction of the Netlist Browser." << endl; - } - - } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/CellViewer.qrc b/hurricane/src/hviewer/CellViewer.qrc index 65078a51..62427ecf 100644 --- a/hurricane/src/hviewer/CellViewer.qrc +++ b/hurricane/src/hviewer/CellViewer.qrc @@ -8,5 +8,6 @@ images/gtk-go-down.png images/gtk-go-forward-rtl.png images/gtk-go-forward-ltr.png + images/swiss-knife.png diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index 63d70d78..17bbc239 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -43,8 +43,8 @@ #include "hurricane/RoutingPad.h" #include "hurricane/viewer/Graphics.h" -#include "hurricane/viewer/HPaletteEntry.h" -#include "hurricane/viewer/HPalette.h" +#include "hurricane/viewer/PaletteItem.h" +#include "hurricane/viewer/PaletteWidget.h" // #include "MapView.h" #include "hurricane/viewer/Command.h" #include "hurricane/viewer/CellWidget.h" @@ -426,6 +426,10 @@ namespace Hurricane { , _showSelection(false) , _cumulativeSelection(false) , _selectionHasChanged(false) + , _delaySelectionChanged(0) + , _cellModificated(true) + , _selectors() + , _selectorCommands() , _commands() , _redrawRectCount(0) , _textFontHeight(20) @@ -456,6 +460,8 @@ namespace Hurricane { { cerr << "CellWidget::~CellWidget()" << endl; + clearSelectorCommands (); + for ( size_t i=0 ; i<_commands.size() ; i++ ) unbindCommand ( _commands[i] ); } @@ -467,7 +473,7 @@ namespace Hurricane { } - void CellWidget::bindToPalette ( HPalette* palette ) + void CellWidget::bindToPalette ( PaletteWidget* palette ) { detachFromPalette (); _palette = palette; @@ -482,6 +488,8 @@ namespace Hurricane { { if ( _palette ) { disconnect ( _palette, SIGNAL(paletteChanged()), this, SLOT(redraw()) ); + disconnect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) ); + disconnect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) ); _palette = NULL; } } @@ -509,6 +517,15 @@ namespace Hurricane { } + void CellWidget::clearSelectorCommands () + { + while ( !_selectorCommands.empty() ) { + delete _selectorCommands.back(); + _selectorCommands.pop_back (); + } + } + + void CellWidget::pushCursor ( Qt::CursorShape cursor ) { setCursor ( cursor ); @@ -538,13 +555,14 @@ namespace Hurricane { _showSelection = state; _selectionHasChanged = false; redraw (); + + emit showSelectionToggled ( state ); } } void CellWidget::setCumulativeSelection ( bool state ) { - cerr << "CellWidget::setCumulativeSelection() - " << state << endl; _cumulativeSelection = state; } @@ -559,7 +577,7 @@ namespace Hurricane { pushCursor ( Qt::BusyCursor ); - if ( ! ( _selectionHasChanged && _showSelection ) ) { + if ( ! ( _selectionHasChanged && _showSelection ) || _cellModificated ) { _spot.setRestore ( false ); _drawingPlanes.select ( 0 ); _drawingPlanes.painterBegin (); @@ -620,6 +638,7 @@ namespace Hurricane { } _drawingPlanes.painterEnd (); + _cellModificated = false; } if ( _showSelection ) @@ -689,20 +708,20 @@ namespace Hurricane { } - bool CellWidget::isDrawableLayer ( const Name& entryName ) + bool CellWidget::isDrawableLayer ( const Name& layerName ) { - HPaletteEntry* entry = (_palette) ? _palette->find(entryName) : NULL; + PaletteItem* item = (_palette) ? _palette->find(layerName) : NULL; - return (!entry || entry->isChecked()) - && ( Graphics::getThreshold(entryName)/DbU::lambda(1.0) < _scale ); + return (!item || item->isChecked()) + && ( Graphics::getThreshold(layerName)/DbU::lambda(1.0) < _scale ); } - bool CellWidget::isDrawableExtension ( const Name& entryName ) + bool CellWidget::isDrawableExtension ( const Name& extensionName ) { - HPaletteEntry* entry = (_palette) ? _palette->find(entryName) : NULL; + PaletteItem* item = (_palette) ? _palette->find(extensionName) : NULL; - return (!entry || entry->isChecked()); + return (!item || item->isChecked()); } @@ -1185,12 +1204,14 @@ namespace Hurricane { void CellWidget::select ( const Net* net, bool delayRedraw ) { - for_each_component ( component, net->getComponents() ) { - Occurrence occurrence ( component ); - select ( occurrence ); - end_for; - } - if ( !delayRedraw ) redraw (); + ++_delaySelectionChanged; + + if ( !_cumulativeSelection ) unselectAll ( true ); + // ToDo: Check here if the Net is already in the Selection. + _selectorCommands.push_back ( new NetSelectorCommand(net) ); + _selectorCommands.back()->doSelection ( this, delayRedraw ); + + if ( !--_delaySelectionChanged ) emit selectionChanged(_selectors,_cell); } @@ -1202,6 +1223,8 @@ namespace Hurricane { if ( occurrence.getOwnerCell() != getCell() ) throw Error ( "Can't select occurrence : incompatible occurrence" ); + //if ( !_cumulativeSelection ) unselectAll ( true ); + Property* property = occurrence.getProperty ( Selector::getPropertyName() ); Selector* selector = NULL; if ( !property ) @@ -1215,17 +1238,20 @@ namespace Hurricane { selector->attachTo(this); _selectionHasChanged = true; + if ( !_delaySelectionChanged ) emit selectionChanged(_selectors,_cell); } void CellWidget::selectOccurrencesUnder ( Box selectArea ) { + ++_delaySelectionChanged; + if ( !_cumulativeSelection ) unselectAll ( true ); - forEach ( Occurrence, ioccurrence, _cell->getOccurrencesUnder(selectArea) ) - select ( *ioccurrence ); + _selectorCommands.push_back ( new AreaSelectorCommand(selectArea) ); + _selectorCommands.back()->doSelection ( this, true ); - emit selectionChanged(_selectors,_cell); + if ( !--_delaySelectionChanged ) emit selectionChanged(_selectors,_cell); } @@ -1247,17 +1273,18 @@ namespace Hurricane { } _selectionHasChanged = true; + if ( !_delaySelectionChanged ) emit selectionChanged(_selectors,_cell); } void CellWidget::unselectAll ( bool delayRedraw ) { - set::iterator iselector; - while ( !_selectors.empty() ) - (*_selectors.begin())->detachFrom ( this ); + ++_delaySelectionChanged; - _selectionHasChanged = true; - if ( !delayRedraw ) redraw (); + clearSelectorCommands (); + _unselectAll ( delayRedraw ); + + if ( !--_delaySelectionChanged ) emit selectionChanged(_selectors,_cell); } @@ -1282,10 +1309,65 @@ namespace Hurricane { } _selectionHasChanged = true; - redraw (); + if ( _showSelection ) redraw (); if ( fromPopup ) emit occurrenceToggled ( occurrence ); } + void CellWidget::_select ( const Net* net, bool delayRedraw ) + { + forEach ( Component*, component, net->getComponents() ) { + Occurrence occurrence ( *component ); + select ( occurrence ); + } + if ( !delayRedraw && _showSelection ) redraw (); + } + + + void CellWidget::_selectOccurrencesUnder ( Box selectArea ) + { + forEach ( Occurrence, ioccurrence, _cell->getOccurrencesUnder(selectArea) ) + select ( *ioccurrence ); + } + + + void CellWidget::_unselectAll ( bool delayRedraw ) + { + set::iterator iselector; + while ( !_selectors.empty() ) + (*_selectors.begin())->detachFrom ( this ); + + if ( !_selectionHasChanged ) _selectionHasChanged = true; + if ( !delayRedraw && _showSelection ) redraw (); + } + + + void CellWidget::cellPreModificate () + { + _unselectAll ( true ); + + emit selectionChanged(_selectors,_cell); + emit cellPreModificated (); + } + + + void CellWidget::cellPostModificate () + { + _cellModificated = true; + + ++_delaySelectionChanged; + vector::iterator icommand = _selectorCommands.begin (); + for ( ; icommand != _selectorCommands.end() ; icommand++ ) + (*icommand)->doSelection ( this, true ); + + updatePalette (); + redraw (); + + --_delaySelectionChanged; + emit selectionChanged(_selectors,_cell); + emit cellPostModificated (); + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/DisplayStyle.cpp b/hurricane/src/hviewer/DisplayStyle.cpp index 809f5df6..a003f486 100644 --- a/hurricane/src/hviewer/DisplayStyle.cpp +++ b/hurricane/src/hviewer/DisplayStyle.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -52,6 +25,7 @@ # include +# include "hurricane/Error.h" # include "hurricane/viewer/DisplayStyle.h" # include "hurricane/viewer/Graphics.h" @@ -239,7 +213,7 @@ namespace Hurricane { } - DrawingStyle* DrawingGroup::find ( const Name& key ) + DrawingStyle* DrawingGroup::find ( const Name& key ) const { size_t i = findIndex ( key ); if ( i != InvalidIndex ) @@ -367,7 +341,7 @@ namespace Hurricane { , const Name& key , size_t& gi , size_t& si - ) + ) const { for ( gi=0 ; gi < _groups.size() ; gi++ ) { if ( _groups[gi]->getName() == groupKey ) { @@ -390,6 +364,10 @@ namespace Hurricane { return style; } + if ( key == "fallback" ) + throw Error ("Unable to find builtin \"fallback\" DrawingStyle in %s." + ,getString(getName()).c_str()); + return find ( "fallback" ); } diff --git a/hurricane/src/hviewer/Graphics.cpp b/hurricane/src/hviewer/Graphics.cpp index 2900cbb2..aa329a10 100644 --- a/hurricane/src/hviewer/Graphics.cpp +++ b/hurricane/src/hviewer/Graphics.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ diff --git a/hurricane/src/hviewer/GroupPaletteEntry.cpp b/hurricane/src/hviewer/GroupPaletteEntry.cpp deleted file mode 100644 index 206b26a4..00000000 --- a/hurricane/src/hviewer/GroupPaletteEntry.cpp +++ /dev/null @@ -1,207 +0,0 @@ - -// -*- 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 : "./GroupPaletteEntry.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#include -#include - -#include "hurricane/viewer/Graphics.h" -#include "hurricane/viewer/GroupPaletteEntry.h" -#include "hurricane/viewer/HPalette.h" - - -namespace Hurricane { - - - GroupPaletteEntry::GroupPaletteEntry ( HPalette* palette, const Name& name ) - : HPaletteEntry(palette) - , _name(name) - , _button(NULL) - , _index(0) - , _expanded(true) - { - } - - - GroupPaletteEntry* GroupPaletteEntry::create ( HPalette* palette, const Name& name ) - { - GroupPaletteEntry* entry = new GroupPaletteEntry ( palette, name ); - - entry->_postCreate (); - - return entry; - } - - - void GroupPaletteEntry::_postCreate () - { - - _index = _palette->getEntries().size(); - - QHBoxLayout* layout = new QHBoxLayout (); - layout->setContentsMargins ( 0, 0, 0, 0 ); - - _button = new QPushButton ( this ); - _button->setFlat ( true ); - _button->setText ( getString(getName()).c_str() ); - _button->setFont ( Graphics::getFixedFont(QFont::Bold,false,true) ); - - layout->addWidget ( _button ); - layout->addStretch (); - - setLayout ( layout ); - - connect ( _button, SIGNAL(clicked()), this, SLOT(toggle()) ); - } - - - bool GroupPaletteEntry::isGroup () const - { - return true; - } - - - bool GroupPaletteEntry::isBasicLayer () const - { - return false; - } - - - bool GroupPaletteEntry::isExtension () const - { - return false; - } - - - const Name& GroupPaletteEntry::getName () const - { - return _name; - } - - - BasicLayer* GroupPaletteEntry::getBasicLayer () - { - return NULL; - } - - - bool GroupPaletteEntry::isChecked () const - { - return _expanded; - } - - - void GroupPaletteEntry::setChecked ( bool state ) - { - _expanded = state; - - hideShow (); - } - - - void GroupPaletteEntry::toggle () - { - _expanded = !_expanded; - - hideShow (); - } - - - void GroupPaletteEntry::hideShow () - { - vector entries = _palette->getEntries (); - - if ( entries[_index] != this ) - cerr << "[ERROR] Incoherent index for group \"" << getString(getName()) << "\"." << endl; - - _button->setText ( getLabel().c_str() ); - - for ( size_t i=_index+1 ; iisGroup() ) break; - - if ( _expanded ) entries[i]->show (); - else entries[i]->hide (); - } - } - - - string GroupPaletteEntry::getLabel () - { - string label = getString(getName()); - - for ( size_t i=0 ; isetFont ( Graphics::getFixedFont(QFont::Bold,false,true) ); - else - _button->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) ); - - label.insert ( 0, spacingLeft, ' ' ); - label.append ( spacingRight, ' ' ); - - return label; - } - - -} // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/HDisplayFilter.cpp b/hurricane/src/hviewer/HDisplayFilter.cpp index 12496c88..86ab15c0 100644 --- a/hurricane/src/hviewer/HDisplayFilter.cpp +++ b/hurricane/src/hviewer/HDisplayFilter.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,7 +16,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./HDisplayFilter.cpp" | +// | C++ Module : "./DisplayFilterWidget.cpp" | // | *************************************************************** | // | U p d a t e s | // | | @@ -55,9 +28,11 @@ #include #include #include +#include #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/CellWidget.h" +//#include "hurricane/viewer/DisplayFilterWidget.h" #include "hurricane/viewer/HDisplayFilter.h" @@ -65,14 +40,14 @@ namespace Hurricane { // ------------------------------------------------------------------- -// Class : "HDisplayFilter". +// Class : "DisplayFilterWidget". - HDisplayFilter::HDisplayFilter ( QWidget* parent ) + DisplayFilterWidget::DisplayFilterWidget ( QWidget* parent ) : QWidget(parent) , _cellWidget(NULL) - , _startSpinBox(NULL) - , _stopSpinBox(NULL) + , _startSpinBox(new QSpinBox()) + , _stopSpinBox(new QSpinBox()) , _queryFilter(Query::DoAll) { setAttribute ( Qt::WA_QuitOnClose, false ); @@ -81,13 +56,12 @@ namespace Hurricane { QGroupBox* groupBox = new QGroupBox ( tr("Hierarchy Settings") ); QGridLayout* gLayout = new QGridLayout (); - QGridLayout* wLayout = new QGridLayout (); + QVBoxLayout* wLayout = new QVBoxLayout (); 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 ); @@ -97,7 +71,6 @@ namespace Hurricane { label->setText ( "Hierarchy Stop Level" ); label->setFont ( Graphics::getNormalFont() ); - _stopSpinBox = new QSpinBox (); _stopSpinBox->setFont ( Graphics::getNormalFont() ); _stopSpinBox->setValue ( 100 ); @@ -134,7 +107,8 @@ namespace Hurricane { connect ( filterBox, SIGNAL(stateChanged(int)), this, SLOT(setDoComponents(int)) ); groupBox->setLayout ( gLayout ); - wLayout->addWidget ( groupBox, 0, 0 ); + wLayout->addWidget ( groupBox ); + wLayout->addStretch (); setLayout ( wLayout ); connect ( _startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(startLevelChanged(int)) ); @@ -142,7 +116,7 @@ namespace Hurricane { } - void HDisplayFilter::setCellWidget ( CellWidget* cw ) + void DisplayFilterWidget::setCellWidget ( CellWidget* cw ) { if ( !cw ) { if ( _cellWidget ) @@ -155,7 +129,7 @@ namespace Hurricane { } - void HDisplayFilter::startLevelChanged ( int level ) + void DisplayFilterWidget::startLevelChanged ( int level ) { if ( _cellWidget ) { _cellWidget->setStartLevel ( level ); @@ -168,7 +142,7 @@ namespace Hurricane { } - void HDisplayFilter::stopLevelChanged ( int level ) + void DisplayFilterWidget::stopLevelChanged ( int level ) { if ( _cellWidget ) { _cellWidget->setStopLevel ( level ); @@ -181,7 +155,7 @@ namespace Hurricane { } - void HDisplayFilter::setDoMasterCells ( int state ) + void DisplayFilterWidget::setDoMasterCells ( int state ) { if ( state != Qt::Unchecked ) _queryFilter |= Query::DoMasterCells; else _queryFilter &= ~Query::DoMasterCells; @@ -192,7 +166,7 @@ namespace Hurricane { } - void HDisplayFilter::setDoTerminalCells ( int state ) + void DisplayFilterWidget::setDoTerminalCells ( int state ) { if ( state != Qt::Unchecked ) _queryFilter |= Query::DoTerminalCells; else _queryFilter &= ~Query::DoTerminalCells; @@ -203,7 +177,7 @@ namespace Hurricane { } - void HDisplayFilter::setDoComponents ( int state ) + void DisplayFilterWidget::setDoComponents ( int state ) { if ( state != Qt::Unchecked ) _queryFilter |= Query::DoComponents; else _queryFilter &= ~Query::DoComponents; diff --git a/hurricane/src/hviewer/HExtensionPaletteEntry.cpp b/hurricane/src/hviewer/HExtensionPaletteEntry.cpp deleted file mode 100644 index 83061902..00000000 --- a/hurricane/src/hviewer/HExtensionPaletteEntry.cpp +++ /dev/null @@ -1,119 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved -// -// =================================================================== -// -// $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 : "./HExtensionPaletteEntry.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#include -#include - -#include "hurricane/viewer/Graphics.h" -#include "hurricane/viewer/HExtensionPaletteEntry.h" -#include "hurricane/viewer/HPalette.h" - - -namespace Hurricane { - - - HExtensionPaletteEntry::HExtensionPaletteEntry ( HPalette* entry, const Name& name ) - : HPaletteEntry(entry) - , _name(name) - { - } - - - HExtensionPaletteEntry* HExtensionPaletteEntry::create ( HPalette* palette, const Name& name ) - { - HExtensionPaletteEntry* entry = new HExtensionPaletteEntry ( palette, name ); - - entry->_postCreate (); - - return entry; - } - - - void HExtensionPaletteEntry::_postCreate () - { - QHBoxLayout* layout = new QHBoxLayout (); - layout->setContentsMargins ( 0, 0, 0, 0 ); - - _checkBox = new QCheckBox ( this ); - _checkBox->setChecked ( false ); - _checkBox->setText ( getString(getName()).c_str() ); - _checkBox->setFont ( Graphics::getFixedFont() ); - layout->addWidget ( _checkBox ); - - setLayout ( layout ); - - connect ( _checkBox, SIGNAL(clicked()), this, SLOT(toggle()) ); - } - - - bool HExtensionPaletteEntry::isGroup () const - { - return false; - } - - - bool HExtensionPaletteEntry::isBasicLayer () const - { - return false; - } - - - bool HExtensionPaletteEntry::isExtension () const - { - return true; - } - - - const Name& HExtensionPaletteEntry::getName () const - { - return _name; - } - - - BasicLayer* HExtensionPaletteEntry::getBasicLayer () - { - return NULL; - } - - - bool HExtensionPaletteEntry::isChecked () const - { - return _checkBox->isChecked (); - } - - - void HExtensionPaletteEntry::setChecked ( bool state ) - { - _checkBox->setChecked ( state ); - } - - - void HExtensionPaletteEntry::toggle () - { - _palette->redrawCellWidget(); - } - - -} // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/HGraphics.cpp b/hurricane/src/hviewer/HGraphics.cpp index c5da9673..747ab812 100644 --- a/hurricane/src/hviewer/HGraphics.cpp +++ b/hurricane/src/hviewer/HGraphics.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,7 +16,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./HGraphics.cpp" | +// | C++ Module : "./GraphicsWidget.cpp" | // | *************************************************************** | // | U p d a t e s | // | | @@ -54,10 +27,12 @@ #include #include #include +#include #include #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/DisplayStyle.h" +//#include "hurricane/viewer/GraphicsWidget.h" #include "hurricane/viewer/HGraphics.h" @@ -65,10 +40,10 @@ namespace Hurricane { // ------------------------------------------------------------------- -// Class : "HGraphics". +// Class : "GraphicsWidget". - HGraphics::HGraphics ( QWidget* parent ) + GraphicsWidget::GraphicsWidget ( QWidget* parent ) : QWidget(parent) { setAttribute ( Qt::WA_QuitOnClose, false ); @@ -78,7 +53,7 @@ namespace Hurricane { QButtonGroup* group = new QButtonGroup (); QGroupBox* groupBox = new QGroupBox ( tr("Display Styles") ); QGridLayout* gLayout = new QGridLayout (); - QGridLayout* wLayout = new QGridLayout (); + QVBoxLayout* wLayout = new QVBoxLayout (); const vector& styles = Graphics::getStyles (); DisplayStyle* activeStyle = Graphics::getStyle (); @@ -101,17 +76,18 @@ namespace Hurricane { } groupBox->setLayout ( gLayout ); - wLayout->addWidget ( groupBox, 0, 0 ); + wLayout->addWidget ( groupBox ); + wLayout->addStretch (); setLayout ( wLayout ); connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(styleChanged(int)) ); } - void HGraphics::styleChanged ( int id ) + void GraphicsWidget::styleChanged ( int id ) { Graphics::setStyle ( (size_t)id ); - cerr << "HGraphics::setStyle() - " << getString(Graphics::getStyle()->getName()) << endl; + //cerr << "GraphicsWidget::setStyle() - " << getString(Graphics::getStyle()->getName()) << endl; emit styleChanged (); } diff --git a/hurricane/src/hviewer/HInspectorWidget.cpp b/hurricane/src/hviewer/HInspectorWidget.cpp index bc976845..040393c7 100644 --- a/hurricane/src/hviewer/HInspectorWidget.cpp +++ b/hurricane/src/hviewer/HInspectorWidget.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,7 +16,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./HInspectorWidget.cpp" | +// | C++ Module : "./InspectorWidget.cpp" | // | *************************************************************** | // | U p d a t e s | // | | @@ -63,6 +36,7 @@ #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/RecordModel.h" +//#include "hurricane/viewer/InspectorWidget.h" #include "hurricane/viewer/HInspectorWidget.h" #include "hurricane/Slot.h" @@ -70,7 +44,7 @@ namespace Hurricane { - HInspectorWidget::History::History () + InspectorWidget::History::History () : _depth(0) , _slots() , _comboBox(NULL) @@ -78,13 +52,13 @@ namespace Hurricane { } - HInspectorWidget::History::~History () + InspectorWidget::History::~History () { clear ( true ); } - void HInspectorWidget::History::push ( Slot* slot ) + void InspectorWidget::History::push ( Slot* slot ) { if ( _depth < _slots.size()-1 ) { while ( _depth < _slots.size()-1 ) pop (); @@ -98,7 +72,7 @@ namespace Hurricane { } - void HInspectorWidget::History::pop () + void InspectorWidget::History::pop () { if ( _slots.size() > 1 ) { delete _slots.back (); @@ -110,7 +84,7 @@ namespace Hurricane { } - void HInspectorWidget::History::back () + void InspectorWidget::History::back () { if ( _depth == 0 ) return; @@ -118,7 +92,7 @@ namespace Hurricane { } - void HInspectorWidget::History::goTo ( int depth ) + void InspectorWidget::History::goTo ( int depth ) { if ( ( depth < 0 ) || ( depth >= (int)_slots.size() ) ) return; @@ -126,26 +100,28 @@ namespace Hurricane { } - size_t HInspectorWidget::History::getDepth () const + size_t InspectorWidget::History::getDepth () const { return _depth; } - Slot* HInspectorWidget::History::getSlot () const + Slot* InspectorWidget::History::getSlot () const { + if ( !_slots[_depth] ) return NULL; return _slots[_depth]->getClone(); } - void HInspectorWidget::History::clear ( bool inDelete ) + void InspectorWidget::History::clear ( bool inDelete ) { if ( !_slots.empty() ) { _comboBox->clear (); // Delete the rootRecord as it's the only one not deleted // automatically through RecordModel (case of depth 0). - delete _slots[0]->getDataRecord(); + if ( _slots[0] ) + delete _slots[0]->getDataRecord(); for ( size_t i=0 ; i < _slots.size() ; i++ ) delete _slots[i]; @@ -156,7 +132,7 @@ namespace Hurricane { } - void HInspectorWidget::History::setComboBox ( QComboBox* comboBox ) + void InspectorWidget::History::setComboBox ( QComboBox* comboBox ) { assert ( comboBox != NULL ); @@ -164,21 +140,25 @@ namespace Hurricane { } - void HInspectorWidget::History::setRootRecord ( Record* rootRecord ) + void InspectorWidget::History::setRootRecord ( Record* rootRecord ) { assert ( _comboBox != NULL ); - assert ( rootRecord != NULL ); clear (); - Slot* rootSlot = ::getSlot ( "", rootRecord ); - _slots.push_back ( rootSlot ); - _comboBox->addItem ( QString("%1: %2").arg(_depth).arg(_slots[_slots.size()-1]->getDataString().c_str())); + if ( rootRecord ) { + Slot* rootSlot = ::getSlot ( "", rootRecord ); + _slots.push_back ( rootSlot ); + _comboBox->addItem ( QString("%1: %2").arg(_depth).arg(_slots[_slots.size()-1]->getDataString().c_str())); + } else { + _slots.push_back ( NULL ); + _comboBox->addItem ( "" ); + } } - HInspectorWidget::HInspectorWidget ( QWidget* parent ) + InspectorWidget::InspectorWidget ( QWidget* parent ) : QWidget(parent) , _baseModel(NULL) , _sortModel(NULL) @@ -229,28 +209,28 @@ namespace Hurricane { } - HInspectorWidget::~HInspectorWidget () + InspectorWidget::~InspectorWidget () { - //cerr << "HInspectorWidget::~HInspectorWidget()" << endl; + //cerr << "InspectorWidget::~InspectorWidget()" << endl; //cerr << "Records: " << Record::getAllocateds() << endl; //cerr << "Slots: " << Slot::getAllocateds() << endl; } - void HInspectorWidget::forceRowHeight () + void InspectorWidget::forceRowHeight () { for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- ) _view->setRowHeight ( rows, _rowHeight ); } - void HInspectorWidget::setRootRecord ( Record* record ) + void InspectorWidget::setRootRecord ( Record* record ) { _history.setRootRecord ( record ); if ( !_baseModel ) { _baseModel = new RecordModel ( this ); - _sortModel = new QSortFilterProxyModel ( this ); + _sortModel = new QSortFilterProxyModel ( this ); _sortModel->setSourceModel ( _baseModel ); _sortModel->setDynamicSortFilter ( true ); _sortModel->setFilterKeyColumn ( 1 ); @@ -269,7 +249,7 @@ namespace Hurricane { } - bool HInspectorWidget::setSlot () + bool InspectorWidget::setSlot () { bool change = true; @@ -285,7 +265,7 @@ namespace Hurricane { } - void HInspectorWidget::pushSlot ( Slot* slot ) + void InspectorWidget::pushSlot ( Slot* slot ) { _history.push ( slot ); if ( !setSlot() ) @@ -293,21 +273,21 @@ namespace Hurricane { } - void HInspectorWidget::popSlot () + void InspectorWidget::popSlot () { _history.pop (); setSlot (); } - void HInspectorWidget::back () + void InspectorWidget::back () { _history.back (); setSlot (); } - void HInspectorWidget::keyPressEvent ( QKeyEvent *event ) + void InspectorWidget::keyPressEvent ( QKeyEvent *event ) { if ( event->key() == Qt::Key_Right ) { QModelIndex index = _view->currentIndex(); @@ -327,14 +307,14 @@ namespace Hurricane { } - void HInspectorWidget::textFilterChanged () + void InspectorWidget::textFilterChanged () { _sortModel->setFilterRegExp ( _filterPatternLineEdit->text() ); forceRowHeight (); } - void HInspectorWidget::historyChanged ( int depth ) + void InspectorWidget::historyChanged ( int depth ) { if ( depth < 0 ) return; @@ -343,14 +323,14 @@ namespace Hurricane { } - void HInspectorWidget::forkInspector ( const QModelIndex& index ) + void InspectorWidget::forkInspector ( const QModelIndex& index ) { if ( index.isValid() ) { Slot* slot = _baseModel->getRecord()->getSlot(_sortModel->mapToSource(index).row()); Record* record = slot->getDataRecord(); if ( record ) { - HInspectorWidget* fork = new HInspectorWidget (); + InspectorWidget* fork = new InspectorWidget (); fork->setRootRecord ( record ); fork->show (); } diff --git a/hurricane/src/hviewer/HMousePosition.cpp b/hurricane/src/hviewer/HMousePosition.cpp index e3302630..a38ab8ea 100644 --- a/hurricane/src/hviewer/HMousePosition.cpp +++ b/hurricane/src/hviewer/HMousePosition.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,32 +16,31 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./HMousePosition.cpp" | +// | C++ Module : "./MousePositionWidget.cpp" | // | *************************************************************** | // | U p d a t e s | // | | // x-----------------------------------------------------------------x -# include +#include -# include "hurricane/viewer/DynamicLabel.h" -# include "hurricane/viewer/HMousePosition.h" +#include "hurricane/viewer/DynamicLabel.h" +//# include "hurricane/viewer/MousePositionWidget.h" +#include "hurricane/viewer/HMousePosition.h" namespace Hurricane { - HMousePosition::HMousePosition ( QWidget* parent ) + MousePositionWidget::MousePositionWidget ( QWidget* parent ) : QWidget(parent) - , _xPosition(NULL) - , _yPosition(NULL) + , _xPosition(new DynamicLabel()) + , _yPosition(new DynamicLabel()) { - _xPosition = new DynamicLabel (); _xPosition->setStaticText ( "X:" ); _xPosition->setDynamicText ( "N/A" ); - _yPosition = new DynamicLabel (); _yPosition->setStaticText ( "Y:" ); _yPosition->setDynamicText ( "N/A" ); @@ -81,7 +53,7 @@ namespace Hurricane { } - void HMousePosition::setPosition ( const Point& position ) + void MousePositionWidget::setPosition ( const Point& position ) { _xPosition->setDynamicText ( position.getX() ); _yPosition->setDynamicText ( position.getY() ); diff --git a/hurricane/src/hviewer/HNetlist.cpp b/hurricane/src/hviewer/HNetlist.cpp index 029b7c31..7de2c404 100644 --- a/hurricane/src/hviewer/HNetlist.cpp +++ b/hurricane/src/hviewer/HNetlist.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -42,7 +15,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./HNetlist.cpp" | +// | C++ Module : "./NetlistWidget.cpp" | // | *************************************************************** | // | U p d a t e s | // | | @@ -61,29 +34,30 @@ #include "hurricane/Net.h" #include "hurricane/viewer/Graphics.h" +//#include "hurricane/viewer/NetlistModel.h" +//#include "hurricane/viewer/NetlistWidget.h" #include "hurricane/viewer/HNetlistModel.h" #include "hurricane/viewer/HNetlist.h" -#include "hurricane/viewer/HInspectorWidget.h" namespace Hurricane { - HNetlist::HNetlist ( QWidget* parent ) - : QWidget(parent) - , _baseModel(NULL) - , _sortModel(NULL) - , _view(NULL) - , _rowHeight(20) - , _cellWidget(NULL) + NetlistWidget::NetlistWidget ( QWidget* parent ) + : QWidget(parent) + , _cell(NULL) + , _baseModel(NULL) + , _sortModel(NULL) + , _view(NULL) + , _rowHeight(20) { setAttribute ( Qt::WA_DeleteOnClose ); setAttribute ( Qt::WA_QuitOnClose, false ); _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; - _baseModel = new HNetlistModel ( this ); + _baseModel = new NetlistModel ( this ); _sortModel = new QSortFilterProxyModel ( this ); _sortModel->setSourceModel ( _baseModel ); @@ -109,72 +83,78 @@ namespace Hurricane { QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); filterPatternLabel->setBuddy(_filterPatternLineEdit); - QGridLayout* inspectorLayout = new QGridLayout(); - inspectorLayout->addWidget(_view , 1, 0, 1, 2); - inspectorLayout->addWidget(filterPatternLabel , 2, 0); - inspectorLayout->addWidget(_filterPatternLineEdit, 2, 1); + QGridLayout* gLayout = new QGridLayout(); + gLayout->addWidget(_view , 1, 0, 1, 2); + gLayout->addWidget(filterPatternLabel , 2, 0); + gLayout->addWidget(_filterPatternLineEdit, 2, 1); - setLayout ( inspectorLayout ); + setLayout ( gLayout ); - connect ( _filterPatternLineEdit, SIGNAL(textChanged(const QString &)) - , this , SLOT(textFilterChanged()) - ); - connect ( _view , SIGNAL(activated(const QModelIndex&)) - , this , SLOT(selectNet(const QModelIndex&)) + connect ( _filterPatternLineEdit , SIGNAL(textChanged(const QString &)) + , this , SLOT(textFilterChanged()) + ); + connect ( _view , SIGNAL(activated(const QModelIndex&)) + , this , SLOT(selectNet(const QModelIndex&)) ); +// connect ( _view->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)) +// , this , SLOT(selectCurrent (const QModelIndex&,const QModelIndex&)) ); connect ( _baseModel , SIGNAL(layoutChanged()), this, SLOT(forceRowHeight()) ); - setWindowTitle(tr("Netlist")); - resize(500, 300); - + resize(300, 300); } - void HNetlist::forceRowHeight () + void NetlistWidget::forceRowHeight () { for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- ) _view->setRowHeight ( rows, _rowHeight ); } - void HNetlist::selectNet ( const QModelIndex& index ) + void NetlistWidget::goTo ( int delta ) { - const Net* net = _baseModel->getNet ( _sortModel->mapToSource(index).row() ); - - if ( _cellWidget && net ) { - _cellWidget->unselectAll (); - _cellWidget->select ( net ); - } + if ( delta == 0 ) return; + + QModelIndex newIndex = _sortModel->index ( _view->currentIndex().row()+delta, 0, QModelIndex() ); + + if ( newIndex.isValid() ) + _view->selectRow ( newIndex.row() ); } - void HNetlist::keyPressEvent ( QKeyEvent* event ) + void NetlistWidget::selectNet ( const QModelIndex& index ) { - if ( event->key() == Qt::Key_I ) { runInspector(_view->currentIndex()); } + if ( !index.isValid() ) return; + + const Net* net = _baseModel->getNet ( _sortModel->mapToSource(index).row() ); + + if ( net ) + emit netSelected ( net ); + } + + + void NetlistWidget::selectCurrent ( const QModelIndex& current, const QModelIndex& ) + { + selectNet ( current ); + } + + + void NetlistWidget::keyPressEvent ( QKeyEvent* event ) + { + if ( event->key() == Qt::Key_Asterisk ) { selectNet(_view->currentIndex()); } + else if ( event->key() == Qt::Key_Plus ) { goTo( 1); selectNet(_view->currentIndex()); } + else if ( event->key() == Qt::Key_Minus ) { goTo(-1); selectNet(_view->currentIndex()); } else { event->ignore(); } } - void HNetlist::textFilterChanged () + void NetlistWidget::textFilterChanged () { _sortModel->setFilterRegExp ( _filterPatternLineEdit->text() ); forceRowHeight (); } - void HNetlist::runInspector ( const QModelIndex& index ) - { - if ( index.isValid() ) { - const Net* net = _baseModel->getNet ( _sortModel->mapToSource(index).row() ); - - HInspectorWidget* inspector = new HInspectorWidget (); - - inspector->setRootRecord ( getRecord(net) ); - inspector->show (); - } - } - - } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/HNetlistModel.cpp b/hurricane/src/hviewer/HNetlistModel.cpp index ea963f62..5b95b494 100644 --- a/hurricane/src/hviewer/HNetlistModel.cpp +++ b/hurricane/src/hviewer/HNetlistModel.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,7 +16,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./HNetlistModel.cpp" | +// | C++ Module : "./NetlistModel.cpp" | // | *************************************************************** | // | U p d a t e s | // | | @@ -64,26 +37,24 @@ namespace Hurricane { - HNetlistModel::HNetlistModel ( QObject* parent ) + NetlistModel::NetlistModel ( QObject* parent ) : QAbstractTableModel(parent) , _cell(NULL) , _netlist(NULL) { } - HNetlistModel::~HNetlistModel () + NetlistModel::~NetlistModel () { if ( _netlist ) delete _netlist; } - QVariant HNetlistModel::data ( const QModelIndex& index, int role ) const + QVariant NetlistModel::data ( const QModelIndex& index, int role ) const { static QFont nameFont = Graphics::getFixedFont ( QFont::Bold ); static QFont valueFont = Graphics::getFixedFont ( QFont::Normal, true ); - if ( !index.isValid() ) return QVariant (); - if ( role == Qt::SizeHintRole ) { switch (index.column()) { case 0: return 200; @@ -98,6 +69,8 @@ namespace Hurricane { } } + if ( !index.isValid() ) return QVariant (); + if ( role == Qt::DisplayRole ) { int row = index.row (); return _netlist->getRow(row)->getColumn(index.column()); @@ -106,34 +79,38 @@ namespace Hurricane { } - QVariant HNetlistModel::headerData ( int section - , Qt::Orientation orientation - , int role ) const + QVariant NetlistModel::headerData ( int section + , Qt::Orientation orientation + , int role ) const { - if ( !_netlist ) return QVariant(); - - if ( ( orientation == Qt::Vertical ) - || ( section >= _netlist->getColumnCount() ) - || (role != Qt::DisplayRole) ) + if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) ) return QVariant(); - return _netlist->getColumnName(section); + if ( !_netlist ) { + if ( section == 0 ) return QVariant("Net"); + return QVariant(); + } + + if ( section < _netlist->getColumnCount() ) + return _netlist->getColumnName(section); + + return QVariant(); } - int HNetlistModel::rowCount ( const QModelIndex& parent ) const + int NetlistModel::rowCount ( const QModelIndex& parent ) const { return (_netlist) ? _netlist->size() : 0; } - int HNetlistModel::columnCount ( const QModelIndex& parent ) const + int NetlistModel::columnCount ( const QModelIndex& parent ) const { - return (_netlist) ? _netlist->getColumnCount() : 0; + return (_netlist) ? _netlist->getColumnCount() : 1; } - const Net* HNetlistModel::getNet ( int row ) + const Net* NetlistModel::getNet ( int row ) { if ( !_netlist || ( row >= (int)_netlist->size() ) ) return NULL; diff --git a/hurricane/src/hviewer/HPalette.cpp b/hurricane/src/hviewer/HPalette.cpp deleted file mode 100644 index 791e8ecb..00000000 --- a/hurricane/src/hviewer/HPalette.cpp +++ /dev/null @@ -1,266 +0,0 @@ - -// -*- 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 : "./HPalette.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#include - -#include -#include -#include -#include - -#include "hurricane/Name.h" -#include "hurricane/DataBase.h" -#include "hurricane/Technology.h" -#include "hurricane/BasicLayer.h" -#include "hurricane/BasicLayers.h" -#include "hurricane/ExtensionSlice.h" -#include "hurricane/Cell.h" - -#include "hurricane/viewer/Graphics.h" -#include "hurricane/viewer/HPaletteEntry.h" -#include "hurricane/viewer/LayerPaletteEntry.h" -#include "hurricane/viewer/HExtensionPaletteEntry.h" -#include "hurricane/viewer/GroupPaletteEntry.h" -#include "hurricane/viewer/ViewerPaletteEntry.h" -#include "hurricane/viewer/HPalette.h" - - -namespace Hurricane { - - - - HPalette::HPalette ( QWidget* parent ) : QScrollArea(parent) - , _entries() - , _showAll(NULL) - , _hideAll(NULL) - { - setWidgetResizable ( true ); - - QWidget* adaptator = new QWidget (); - QVBoxLayout* layout = new QVBoxLayout (); - - _showAll = new QPushButton ( this ); - _showAll->setIcon ( QIcon(":/images/palette_show_all.png") ); - _showAll->setFlat ( true ); - - _hideAll = new QPushButton ( this ); - _hideAll->setIcon ( QIcon(":/images/palette_hide_all.png") ); - _hideAll->setFlat ( true ); - - connect ( _showAll, SIGNAL(clicked()), this, SLOT(showAll()) ); - connect ( _hideAll, SIGNAL(clicked()), this, SLOT(hideAll()) ); - - QHBoxLayout* topEntry = new QHBoxLayout (); - topEntry->setContentsMargins ( 0, 0, 0, 0 ); - topEntry->addWidget ( _showAll ); - topEntry->addWidget ( _hideAll ); - layout->addLayout ( topEntry ); - - //layout->setContentsMargins ( 0, 0, 0, 0 ); - - vector groups = Graphics::getStyle()->getDrawingGroups(); - vector styles = groups[0]->getDrawingStyles(); - - GroupPaletteEntry* gentry = GroupPaletteEntry::create ( this, groups[0]->getName() ); - layout->addWidget ( gentry, 0, Qt::AlignLeft ); - layout->addSpacing ( -5 ); - _entries.push_back ( gentry ); - - for ( size_t si=0 ; sigetName() == DisplayStyle::Foreground ) continue; - if ( styles[si]->getName() == DisplayStyle::Background ) continue; - if ( styles[si]->getName() == DisplayStyle::Foreground ) continue; - if ( styles[si]->getName() == DisplayStyle::SelectionDraw ) continue; - if ( styles[si]->getName() == DisplayStyle::SelectionFill ) continue; - if ( styles[si]->getName() == DisplayStyle::Foreground ) continue; - - ViewerPaletteEntry* entry = ViewerPaletteEntry::create ( this, styles[si]->getName() ); - layout->addWidget ( entry, 0, Qt::AlignLeft ); - _entries.push_back ( entry ); - } - gentry->setChecked ( false ); - - DataBase* database = DataBase::getDB(); - if ( database ) { - Technology* technology = database->getTechnology(); - if ( technology ) { - for ( size_t gi=1 ; gigetName() ); - layout->addWidget ( gentry, 0, Qt::AlignLeft ); - layout->addSpacing ( -5 ); - _entries.push_back ( gentry ); - - styles = groups[gi]->getDrawingStyles(); - for ( size_t si=0 ; sigetBasicLayer ( styles[si]->getName() ); - - if ( basicLayer ) { - LayerPaletteEntry* entry = LayerPaletteEntry::create ( this, basicLayer ); - layout->addWidget ( entry, 0, Qt::AlignLeft ); - _entries.push_back ( entry ); - } - } - gentry->setChecked ( false ); - } - bool unmatched = false; - forEach ( BasicLayer*, basicLayer, technology->getBasicLayers() ) { - if ( !find((*basicLayer)->getName()) ) { - if ( !unmatched ) { - unmatched = true; - gentry = GroupPaletteEntry::create ( this, "Unmatcheds" ); - layout->addWidget ( gentry, 0, Qt::AlignLeft ); - layout->addSpacing ( -5 ); - _entries.push_back ( gentry ); - } - LayerPaletteEntry* entry = LayerPaletteEntry::create ( this, *basicLayer ); - layout->addWidget ( entry, 0, Qt::AlignLeft ); - _entries.push_back ( entry ); - - cerr << "[WARNING] BasicLayer \"" << (*basicLayer)->getName() - << "\" has no associated DisplayStyle." << endl; - } - } - if ( unmatched ) - gentry->setChecked ( false ); - - } - } - layout->addStretch (); - - adaptator->setLayout ( layout ); - setWidget ( adaptator ); - setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff ); - setVerticalScrollBarPolicy ( Qt::ScrollBarAsNeeded ); - setFrameStyle ( QFrame::Plain ); - } - - - void HPalette::updateExtensions ( Cell* cell ) - { - QVBoxLayout* layout = qobject_cast ( widget()->layout() ); - const Name extensionName = "Extensions"; - - for ( size_t ientry=0 ; ientry<_entries.size() ; ) { - if ( ( _entries[ientry]->getName() == extensionName ) - || _entries[ientry]->isExtension() ) { - layout->removeWidget ( _entries[ientry] ); - _entries[ientry]->deleteLater (); - - for ( size_t j=ientry+1 ; j<_entries.size() ; j++ ) - _entries[j-1] = _entries[j]; - _entries.pop_back (); - } else - ientry++; - } - - if ( !cell ) return; - - GroupPaletteEntry* gentry = GroupPaletteEntry::create ( this, extensionName ); - layout->insertWidget ( -1, gentry, 0, Qt::AlignLeft ); - layout->addSpacing ( -5 ); - _entries.push_back ( gentry ); - - forEach ( ExtensionSlice*, extension, cell->getExtensionSlices() ) { - HExtensionPaletteEntry* entry = HExtensionPaletteEntry::create ( this, (*extension)->getName() ); - layout->insertWidget ( -1, entry, 0, Qt::AlignLeft ); - _entries.push_back ( entry ); - } - gentry->setChecked ( false ); - } - - - bool HPalette::isDrawable ( size_t index ) - { - if ( index < _entries.size() ) - return _entries[index]->isChecked (); - - return false; - } - - - void HPalette::showAll () - { - for ( size_t i=0 ; i<_entries.size() ; i++ ) - if ( !_entries[i]->isGroup() ) - _entries[i]->setChecked ( true ); - - emit paletteChanged(); - } - - - void HPalette::hideAll () - { - for ( size_t i=0 ; i<_entries.size() ; i++ ) - if ( !_entries[i]->isGroup() ) - _entries[i]->setChecked ( false ); - - emit paletteChanged(); - } - - - void HPalette::redrawCellWidget () - { - emit paletteChanged(); - } - - - HPaletteEntry* HPalette::find ( const Name& name ) - { - for ( size_t i=0 ; i<_entries.size() ; i++ ) { - if ( _entries[i]->getName() == name ) - return _entries[i]; - } - return NULL; - } - - -} // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/HPaletteEntry.cpp b/hurricane/src/hviewer/HPaletteEntry.cpp deleted file mode 100644 index 99838473..00000000 --- a/hurricane/src/hviewer/HPaletteEntry.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -// -*- 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 : "./HPaletteEntry.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -# include - -# include "hurricane/viewer/Graphics.h" -# include "hurricane/viewer/HPaletteEntry.h" - - -namespace Hurricane { - - - HPaletteSample::HPaletteSample ( HPaletteEntry* entry ) - : QWidget() - , _sample(QSize(20,20)) - , _entry(entry) - { - setAttribute ( Qt::WA_StaticContents ); - setSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Fixed ); - setFixedSize ( 20, 20 ); - - redraw (); - } - - - void HPaletteSample::redraw () - { - QPainter painter ( &_sample ); - - painter.setPen ( Qt::NoPen ); - painter.setBackground ( Graphics::getBrush("background") ); - painter.eraseRect ( 0, 0, 20, 20 ); - painter.setPen ( Graphics::getPen (_entry->getName()) ); - painter.setBrush ( Graphics::getBrush(_entry->getName()) ); - painter.drawRect ( 2, 2, 16, 16 ); - } - - - void HPaletteSample::paintEvent ( QPaintEvent* ) - { - QPainter painter ( this ); - painter.drawPixmap ( 0, 0, _sample ); - } - - - HPaletteEntry::HPaletteEntry ( HPalette* palette ) - : QWidget() - , _palette(palette) - { - } - - -} // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/HSelection.cpp b/hurricane/src/hviewer/HSelection.cpp index fb693653..f0589346 100644 --- a/hurricane/src/hviewer/HSelection.cpp +++ b/hurricane/src/hviewer/HSelection.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -42,7 +15,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./HSelection.cpp" | +// | C++ Module : "./SelectionWidget.cpp" | // | *************************************************************** | // | U p d a t e s | // | | @@ -65,21 +38,24 @@ #include "hurricane/Cell.h" #include "hurricane/viewer/Graphics.h" +//#include "hurricane/viewer/SelectionModel.h" +//#include "hurricane/viewer/SelectionWidget.h" #include "hurricane/viewer/HSelectionModel.h" #include "hurricane/viewer/HSelection.h" -#include "hurricane/viewer/HInspectorWidget.h" namespace Hurricane { - HSelection::HSelection ( QWidget* parent ) + SelectionWidget::SelectionWidget ( QWidget* parent ) : QWidget(parent) - , _baseModel(NULL) - , _sortModel(NULL) - , _view(NULL) - , _cumulative(NULL) + , _baseModel(new SelectionModel(this)) + , _sortModel(new QSortFilterProxyModel(this)) + , _view(new QTableView(this)) + , _filterPatternLineEdit(new QLineEdit(this)) + , _cumulative(new QCheckBox()) + , _showSelection(new QCheckBox()) , _rowHeight(20) { setAttribute ( Qt::WA_DeleteOnClose ); @@ -87,7 +63,6 @@ namespace Hurricane { _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; - _filterPatternLineEdit = new QLineEdit(this); QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); filterPatternLabel->setBuddy(_filterPatternLineEdit); @@ -99,26 +74,26 @@ namespace Hurricane { separator->setFrameShape ( QFrame::HLine ); separator->setFrameShadow ( QFrame::Sunken ); - _cumulative = new QCheckBox (); _cumulative->setText ( tr("Cumulative Selection") ); _cumulative->setChecked ( false ); + _showSelection->setText ( tr("Show Selection") ); + _showSelection->setChecked ( false ); + QPushButton* clear = new QPushButton (); clear->setText ( tr("Clear") ); QHBoxLayout* hLayout2 = new QHBoxLayout (); hLayout2->addWidget ( _cumulative ); hLayout2->addStretch (); + hLayout2->addWidget ( _showSelection ); + hLayout2->addStretch (); hLayout2->addWidget ( clear ); - _baseModel = new HSelectionModel ( this ); - - _sortModel = new QSortFilterProxyModel ( this ); _sortModel->setSourceModel ( _baseModel ); _sortModel->setDynamicSortFilter ( true ); _sortModel->setFilterKeyColumn ( 0 ); - _view = new QTableView(this); _view->setShowGrid(false); _view->setAlternatingRowColors(true); _view->setSelectionBehavior(QAbstractItemView::SelectRows); @@ -134,61 +109,64 @@ namespace Hurricane { verticalHeader->setVisible ( false ); QVBoxLayout* vLayout = new QVBoxLayout (); + //vLayout->setSpacing ( 0 ); + vLayout->addLayout ( hLayout2 ); + vLayout->addWidget ( separator ); vLayout->addWidget ( _view ); vLayout->addLayout ( hLayout1 ); - vLayout->addWidget ( separator ); - vLayout->addLayout ( hLayout2 ); setLayout ( vLayout ); 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 ( clear , SIGNAL(clicked()) , this, SIGNAL(selectionCleared()) ); - connect ( clear , SIGNAL(clicked()) , _baseModel, SLOT(clear()) ); + , this , SLOT(textFilterChanged()) ); + connect ( _baseModel , SIGNAL(layoutChanged()), this, SLOT(forceRowHeight()) ); + connect ( _cumulative , SIGNAL(toggled(bool)) , this, SIGNAL(cumulativeToggled(bool)) ); + connect ( _showSelection, SIGNAL(toggled(bool)) , this, SIGNAL(showSelectionToggled(bool)) ); + connect ( clear , SIGNAL(clicked()) , this, SIGNAL(selectionCleared()) ); + connect ( clear , SIGNAL(clicked()) , _baseModel, SLOT(clear()) ); + connect ( _view->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)) + , this , SLOT(selectCurrent (const QModelIndex&,const QModelIndex&)) ); setWindowTitle ( tr("Selection") ); resize ( 500, 300 ); } - void HSelection::hideEvent ( QHideEvent* event ) + void SelectionWidget::hideEvent ( QHideEvent* event ) { - emit showSelected(false); + //emit showSelected(false); } - void HSelection::forceRowHeight () + void SelectionWidget::forceRowHeight () { for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- ) _view->setRowHeight ( rows, _rowHeight ); } - void HSelection::keyPressEvent ( QKeyEvent* event ) + void SelectionWidget::keyPressEvent ( QKeyEvent* event ) { - if ( event->key() == Qt::Key_I ) { runInspector ( _view->currentIndex() ); } + if ( event->key() == Qt::Key_I ) { inspect ( _view->currentIndex() ); } else if ( event->key() == Qt::Key_T ) { toggleSelection ( _view->currentIndex() ); } else event->ignore(); } - void HSelection::textFilterChanged () + void SelectionWidget::textFilterChanged () { _sortModel->setFilterRegExp ( _filterPatternLineEdit->text() ); forceRowHeight (); } - bool HSelection::isCumulative () const + bool SelectionWidget::isCumulative () const { return _cumulative->isChecked(); } - void HSelection::toggleSelection ( const QModelIndex& index ) + void SelectionWidget::toggleSelection ( const QModelIndex& index ) { Occurrence occurrence = _baseModel->toggleSelection ( index ); if ( occurrence.isValid() ) @@ -196,13 +174,22 @@ namespace Hurricane { } - void HSelection::toggleSelection ( Occurrence occurrence ) + void SelectionWidget::toggleSelection ( Occurrence occurrence ) { _baseModel->toggleSelection ( occurrence ); } - void HSelection::setSelection ( const set& selection, Cell* cell ) + void SelectionWidget::setShowSelection ( bool state ) + { + if ( state == _showSelection->isChecked() ) return; + + _showSelection->setChecked ( state ); + emit showSelection ( state ); + } + + + void SelectionWidget::setSelection ( const set& selection, Cell* cell ) { _baseModel->setSelection ( selection ); @@ -216,15 +203,17 @@ namespace Hurricane { } - void HSelection::runInspector ( const QModelIndex& index ) + void SelectionWidget::selectCurrent ( const QModelIndex& current, const QModelIndex& ) + { + inspect ( current ); + } + + + void SelectionWidget::inspect ( const QModelIndex& index ) { if ( index.isValid() ) { Occurrence occurrence = _baseModel->getOccurrence ( _sortModel->mapToSource(index).row() ); - - HInspectorWidget* inspector = new HInspectorWidget (); - - inspector->setRootRecord ( getRecord(occurrence) ); - inspector->show (); + emit inspect ( getRecord(occurrence) ); } } diff --git a/hurricane/src/hviewer/HSelectionModel.cpp b/hurricane/src/hviewer/HSelectionModel.cpp index 7bcefe8e..306c3f68 100644 --- a/hurricane/src/hviewer/HSelectionModel.cpp +++ b/hurricane/src/hviewer/HSelectionModel.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,7 +16,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./HSelectionModel.cpp" | +// | C++ Module : "./SelectionModel.cpp" | // | *************************************************************** | // | U p d a t e s | // | | @@ -59,6 +32,8 @@ #include "hurricane/Occurrence.h" #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/Selector.h" +//#include "hurricane/viewer/SelectionModel.h" +//#include "hurricane/viewer/SelectionWidget.h" #include "hurricane/viewer/HSelectionModel.h" #include "hurricane/viewer/HSelection.h" @@ -66,19 +41,19 @@ namespace Hurricane { - HSelectionModel::HSelectionModel ( QObject* parent ) + SelectionModel::SelectionModel ( QObject* parent ) : QAbstractTableModel(parent) , _selection() { } - HSelectionModel::~HSelectionModel () + SelectionModel::~SelectionModel () { } - bool HSelectionModel::isCumulative () const + bool SelectionModel::isCumulative () const { - HSelection* widget = qobject_cast(QObject::parent()); + SelectionWidget* widget = qobject_cast(QObject::parent()); if ( widget ) return widget->isCumulative(); @@ -86,14 +61,14 @@ namespace Hurricane { } - void HSelectionModel::clear () + void SelectionModel::clear () { _selection.clear (); emit layoutChanged (); } - void HSelectionModel::setSelection ( const set& selection ) + void SelectionModel::setSelection ( const set& selection ) { if ( !isCumulative() ) _selection.clear (); @@ -114,7 +89,7 @@ namespace Hurricane { } - Occurrence HSelectionModel::toggleSelection ( const QModelIndex& index ) + Occurrence SelectionModel::toggleSelection ( const QModelIndex& index ) { if ( index.isValid() && ( index.row() < (int)_selection.size() ) ) { _selection[index.row()].toggle(); @@ -127,7 +102,7 @@ namespace Hurricane { } - void HSelectionModel::toggleSelection ( Occurrence occurrence ) + void SelectionModel::toggleSelection ( Occurrence occurrence ) { bool found = false; size_t i = 0; @@ -151,7 +126,7 @@ namespace Hurricane { } - QVariant HSelectionModel::data ( const QModelIndex& index, int role ) const + QVariant SelectionModel::data ( const QModelIndex& index, int role ) const { static QFont occurrenceFont = Graphics::getFixedFont ( QFont::Normal ); static QFont entityFont = Graphics::getFixedFont ( QFont::Bold, false ); @@ -189,7 +164,7 @@ namespace Hurricane { } - QVariant HSelectionModel::headerData ( int section + QVariant SelectionModel::headerData ( int section , Qt::Orientation orientation , int role ) const { @@ -205,19 +180,19 @@ namespace Hurricane { } - int HSelectionModel::rowCount ( const QModelIndex& parent ) const + int SelectionModel::rowCount ( const QModelIndex& parent ) const { return _selection.size(); } - int HSelectionModel::columnCount ( const QModelIndex& parent ) const + int SelectionModel::columnCount ( const QModelIndex& parent ) const { return 2; } - const Occurrence HSelectionModel::getOccurrence ( int row ) + const Occurrence SelectionModel::getOccurrence ( int row ) { if ( row >= (int)_selection.size() ) return Occurrence(); diff --git a/hurricane/src/hviewer/LayerPaletteEntry.cpp b/hurricane/src/hviewer/LayerPaletteEntry.cpp deleted file mode 100644 index e903fce4..00000000 --- a/hurricane/src/hviewer/LayerPaletteEntry.cpp +++ /dev/null @@ -1,150 +0,0 @@ - -// -*- 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 : "./LayerPaletteEntry.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -# include -# include - -# include "hurricane/BasicLayer.h" - -# include "hurricane/viewer/Graphics.h" -# include "hurricane/viewer/LayerPaletteEntry.h" -# include "hurricane/viewer/HPalette.h" - - -namespace Hurricane { - - - LayerPaletteEntry::LayerPaletteEntry ( HPalette* entry, BasicLayer* basicLayer ) - : HPaletteEntry(entry) - , _basicLayer(basicLayer) - { - } - - - LayerPaletteEntry* LayerPaletteEntry::create ( HPalette* palette, BasicLayer* basicLayer ) - { - LayerPaletteEntry* entry = new LayerPaletteEntry ( palette, basicLayer ); - - entry->_postCreate (); - - return entry; - } - - - void LayerPaletteEntry::_postCreate () - { - QHBoxLayout* layout = new QHBoxLayout (); - layout->setContentsMargins ( 0, 0, 0, 0 ); - - layout->addWidget ( new HPaletteSample(this) ); - - _checkBox = new QCheckBox ( this ); - _checkBox->setChecked ( true ); - _checkBox->setText ( getString(getName()).c_str() ); - _checkBox->setFont ( Graphics::getFixedFont() ); - layout->addWidget ( _checkBox ); - - setLayout ( layout ); - - connect ( _checkBox, SIGNAL(clicked()), this, SLOT(toggle()) ); - } - - - bool LayerPaletteEntry::isGroup () const - { - return false; - } - - - bool LayerPaletteEntry::isBasicLayer () const - { - return true; - } - - - bool LayerPaletteEntry::isExtension () const - { - return false; - } - - - const Name& LayerPaletteEntry::getName () const - { - return _basicLayer->getName(); - } - - - BasicLayer* LayerPaletteEntry::getBasicLayer () - { - return _basicLayer; - } - - - bool LayerPaletteEntry::isChecked () const - { - return _checkBox->isChecked (); - } - - - void LayerPaletteEntry::setChecked ( bool state ) - { - _checkBox->setChecked ( state ); - } - - - void LayerPaletteEntry::toggle () - { - _palette->redrawCellWidget(); - } - - -} // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/RecordModel.cpp b/hurricane/src/hviewer/RecordModel.cpp index a3a87d21..56de01d7 100644 --- a/hurricane/src/hviewer/RecordModel.cpp +++ b/hurricane/src/hviewer/RecordModel.cpp @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -78,6 +51,15 @@ namespace Hurricane { bool RecordModel::setSlot ( Slot* slot, size_t depth ) { + if ( !slot ) { + _slot = NULL; + _record = NULL; + _depth = depth; + + emit layoutChanged (); + return false; + } + Record* record = slot->getDataRecord (); if ( !record ) { delete slot; diff --git a/hurricane/src/hviewer/ViewerPaletteEntry.cpp b/hurricane/src/hviewer/ViewerPaletteEntry.cpp deleted file mode 100644 index 0b7c14cc..00000000 --- a/hurricane/src/hviewer/ViewerPaletteEntry.cpp +++ /dev/null @@ -1,149 +0,0 @@ - -// -*- 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 : "./ViewerPaletteEntry.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -# include -# include - -# include "hurricane/BasicLayer.h" - -# include "hurricane/viewer/Graphics.h" -# include "hurricane/viewer/ViewerPaletteEntry.h" -# include "hurricane/viewer/HPalette.h" - - -namespace Hurricane { - - - ViewerPaletteEntry::ViewerPaletteEntry ( HPalette* entry, const Name& name ) - : HPaletteEntry(entry) - , _name(name) - { - } - - - ViewerPaletteEntry* ViewerPaletteEntry::create ( HPalette* palette, const Name& name ) - { - ViewerPaletteEntry* entry = new ViewerPaletteEntry ( palette, name ); - - entry->_postCreate (); - - return entry; - } - - - void ViewerPaletteEntry::_postCreate () - { - QHBoxLayout* layout = new QHBoxLayout (); - layout->setContentsMargins ( 0, 0, 0, 0 ); - - layout->addWidget ( new HPaletteSample(this) ); - - _checkBox = new QCheckBox ( this ); - _checkBox->setChecked ( true ); - _checkBox->setText ( getString(getName()).c_str() ); - layout->addWidget ( _checkBox ); - - setLayout ( layout ); - - connect ( _checkBox, SIGNAL(clicked()), this, SLOT(toggle()) ); - } - - - bool ViewerPaletteEntry::isGroup () const - { - return false; - } - - - bool ViewerPaletteEntry::isBasicLayer () const - { - return false; - } - - - bool ViewerPaletteEntry::isExtension () const - { - return false; - } - - - const Name& ViewerPaletteEntry::getName () const - { - return _name; - } - - - BasicLayer* ViewerPaletteEntry::getBasicLayer () - { - return NULL; - } - - - bool ViewerPaletteEntry::isChecked () const - { - return _checkBox->isChecked (); - } - - - void ViewerPaletteEntry::setChecked ( bool state ) - { - _checkBox->setChecked ( state ); - } - - - void ViewerPaletteEntry::toggle () - { - _palette->redrawCellWidget(); - } - - -} // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h index 72d3d875..35415281 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellViewer.h @@ -23,8 +23,8 @@ // x-----------------------------------------------------------------x -#ifndef __CELL_VIEWER_H__ -#define __CELL_VIEWER_H__ +#ifndef __HURRICANE_CELL_VIEWER__ +#define __HURRICANE_CELL_VIEWER__ #include @@ -56,82 +56,65 @@ namespace Hurricane { class HDisplayFilter; //class MapView; class CellWidget; - class HMousePosition; - class HNetlist; + class MousePositionWidget; class HSelection; + class ControllerWidget; class CellViewer : public QMainWindow { Q_OBJECT; public: - CellViewer ( QWidget* parent=NULL ); - QMenu* createDebugMenu (); - inline void setApplicationName ( const QString& name ); - void setCell ( Cell* cell ); - Cell* getCell (); - virtual Cell* getCellFromDb ( const char* name ); - inline CellWidget* getCellWidget (); - void select ( Occurrence& occurence ); - void unselect ( Occurrence& occurence ); - void unselectAll (); - public slots: - void setShowPalette ( bool show ); - void showGraphicsSettings (); - void showDisplayFilter (); - void openHistoryCell (); - void runInspectorOnDataBase (); - void runInspectorOnCell (); - void browseSelection (); - void browseNetlist (); - void selectionBrowserDestroyed (); - void netlistBrowserDestroyed (); - signals: - void redrawCellWidget (); - - public: - enum { CellHistorySize = 10 }; - protected: - QString _applicationName; - QAction* _openAction; - 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* _browseSelection; - QAction* _browseNetlist; - QMenu* _fileMenu; - QMenu* _viewMenu; - QMenu* _toolsMenu; - QMenu* _debugMenu; - //MapView* _mapView; - HPalette* _palette; - HMousePosition* _mousePosition; - HGraphics* _graphicsSettings; - HDisplayFilter* _displayFilter; - CellWidget* _cellWidget; - MoveCommand _moveCommand; - ZoomCommand _zoomCommand; - SelectCommand _selectCommand; - list _cellHistory; - HSelection* _selectionBrowser; - HNetlist* _netlistBrowser; - - protected: - void createActions (); - void createMenus (); - void createLayout (); - void refreshHistory (); - void runInspector ( Record* record ); + CellViewer ( QWidget* parent=NULL ); + virtual ~CellViewer (); + QMenu* createDebugMenu (); + inline void setApplicationName ( const QString& name ); + void setCell ( Cell* cell ); + Cell* getCell (); + virtual Cell* getCellFromDb ( const char* name ); + inline CellWidget* getCellWidget (); + void select ( Occurrence& occurence ); + void unselect ( Occurrence& occurence ); + void unselectAll (); + public slots: + void showController (); + void openHistoryCell (); + signals: + void redrawCellWidget (); + + public: + enum { CellHistorySize = 10 }; + protected: + QString _applicationName; + QAction* _openAction; + QAction* _nextAction; + QAction* _cellHistoryAction[CellHistorySize]; + QAction* _saveAction; + QAction* _closeAction; + QAction* _exitAction; + QAction* _refreshAction; + QAction* _fitToContentsAction; + QAction* _showSelectionAction; + QAction* _controllerAction; + QMenu* _fileMenu; + QMenu* _viewMenu; + QMenu* _toolsMenu; + QMenu* _debugMenu; + //MapView* _mapView; + HPalette* _palette; + MousePositionWidget* _mousePosition; + ControllerWidget* _controller; + CellWidget* _cellWidget; + MoveCommand _moveCommand; + ZoomCommand _zoomCommand; + SelectCommand _selectCommand; + list _cellHistory; + + protected: + void createActions (); + void createMenus (); + void createLayout (); + void refreshHistory (); }; diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index ec455c6b..3add48ab 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -52,6 +52,7 @@ class QAction; #include "hurricane/viewer/DisplayStyle.h" #include "hurricane/viewer/CellWidgets.h" #include "hurricane/viewer/Selector.h" +#include "hurricane/viewer/SelectorCommand.h" @@ -70,8 +71,7 @@ namespace Hurricane { class Pad; class Selector; - class HPaletteEntry; - class HPalette; + class PaletteWidget; class Command; //class MapView; @@ -91,104 +91,113 @@ namespace Hurricane { typedef void ( InitExtensionGo_t )( CellWidget* ); public: // Constructor & Destructor. - CellWidget ( QWidget* parent=NULL ); - virtual ~CellWidget (); - // Accessors. - // MapView* getMapView () { return _mapView; }; - void setCell ( Cell* cell ); - inline Cell* getCell () const; - inline HPalette* getPalette (); - void bindToPalette ( HPalette* palette ); - void detachFromPalette (); - void bindCommand ( Command* command ); - void unbindCommand ( Command* command ); - inline bool showBoundaries () const; - inline set& getSelectorSet (); - inline bool showSelection () const; - inline void setStartLevel ( int level ); - inline void setStopLevel ( int level ); - inline void setQueryFilter ( int filter ); + CellWidget ( QWidget* parent=NULL ); + virtual ~CellWidget (); + // Accessors. + // MapView* getMapView () { return _mapView; }; + void setCell ( Cell* ); + inline Cell* getCell () const; + inline PaletteWidget* getPalette (); + void bindToPalette ( PaletteWidget* ); + void detachFromPalette (); + void bindCommand ( Command* ); + void unbindCommand ( Command* ); + void clearSelectorCommands (); + inline bool showBoundaries () const; + inline set& getSelectorSet (); + inline bool showSelection () const; + inline void setStartLevel ( int ); + inline void setStopLevel ( int ); + inline void setQueryFilter ( int ); // Painter control & Hurricane objects drawing primitives. - inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* ); - inline QPainter& getPainter (); - inline float getScale () const; - bool isDrawableLayer ( const Name& ); - bool isDrawableExtension ( const Name& ); - void drawBox ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit ); - void drawBox ( const Box& ); - void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit ); - void drawLine ( const Point&, const Point& ); - void drawText ( const Point&, const Name&, int angle=0, bool reverse=false ); - void drawGrid (); - void drawSpot (); - void drawScreenRect ( const QPoint&, const QPoint& ); - void drawScreenPolyline ( const QPoint*, int, int ); - // Geometric conversions. - QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const; - QRect dbuToDisplayRect ( const Box& box ) const; - QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const; - QPoint dbuToDisplayPoint ( const Point& point ) const; - inline int dbuToDisplayX ( DbU::Unit x ) const; - inline int dbuToDisplayY ( DbU::Unit y ) const; - inline int dbuToDisplayLength ( DbU::Unit length ) const; - inline int dbuToScreenX ( DbU::Unit x ) const; - inline int dbuToScreenY ( DbU::Unit y ) const; - QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const; - inline QPoint dbuToScreenPoint ( const Point& point ) const; - inline DbU::Unit displayToDbuX ( int x ) const; - inline DbU::Unit displayToDbuY ( int y ) const; - inline DbU::Unit displayToDbuLength ( int length ) const; - inline Box displayToDbuBox ( const QRect& rect ) const; - inline DbU::Unit screenToDbuX ( int x ) const; - inline DbU::Unit screenToDbuY ( int y ) const; - inline Point screenToDbuPoint ( const QPoint& point ) const; - inline Box screenToDbuBox ( const QRect& rect ) const; - // Qt QWidget Functions Overloads. - void pushCursor ( Qt::CursorShape cursor ); - void popCursor (); - QSize minimumSizeHint () const; - void paintEvent ( QPaintEvent* ); - void resizeEvent ( QResizeEvent* ); - void keyPressEvent ( QKeyEvent* ); - void mouseMoveEvent ( QMouseEvent* ); - void mousePressEvent ( QMouseEvent* ); - void mouseReleaseEvent ( QMouseEvent* ); - signals: - void cellChanged ( Cell* ); - void updatePalette ( Cell* ); - void mousePositionChanged ( const Point& position ); - void selectionChanged ( const set&, Cell* ); - void occurrenceToggled ( Occurrence ); - public slots: - // Qt QWidget Slots Overload & CellWidget Specifics. - inline DrawingPlanes& getDrawingPlanes (); - inline QPoint& getOffsetVA (); - void select ( const Net* net, bool delayRedraw=false ); - void select ( Occurrence occurence ); - void selectOccurrencesUnder ( Box selectArea ); - void unselect ( Occurrence occurence ); - void unselectAll ( bool delayRedraw=false ); - void toggleSelect ( Occurrence occurence, bool fromPopup ); - void setShowSelection ( bool state ); - void setCumulativeSelection ( bool state ); - void updatePalette (); - inline void redraw (); - void redraw ( QRect redrawArea ); - inline void redrawSelection (); - void redrawSelection ( QRect redrawArea ); - void goLeft ( int dx = 0 ); - void goRight ( int dx = 0 ); - void goUp ( int dy = 0 ); - void goDown ( int dy = 0 ); - void fitToContents (); - void setScale ( float scale ); - void setShowBoundaries ( bool state ); - void reframe ( const Box& box ); - void displayReframe (); - void shiftLeft ( int dx ); - void shiftRight ( int dx ); - void shiftUp ( int dy ); - void shiftDown ( int dy ); + inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* ); + inline QPainter& getPainter (); + inline float getScale () const; + bool isDrawableLayer ( const Name& ); + bool isDrawableExtension ( const Name& ); + void drawBox ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit ); + void drawBox ( const Box& ); + void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit ); + void drawLine ( const Point&, const Point& ); + void drawText ( const Point&, const Name&, int angle=0, bool reverse=false ); + void drawGrid (); + void drawSpot (); + void drawScreenRect ( const QPoint&, const QPoint& ); + void drawScreenPolyline ( const QPoint*, int, int ); + // Geometric conversions. + QRect dbuToDisplayRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 ) const; + QRect dbuToDisplayRect ( const Box& box ) const; + QPoint dbuToDisplayPoint ( DbU::Unit x, DbU::Unit y ) const; + QPoint dbuToDisplayPoint ( const Point& point ) const; + inline int dbuToDisplayX ( DbU::Unit x ) const; + inline int dbuToDisplayY ( DbU::Unit y ) const; + inline int dbuToDisplayLength ( DbU::Unit length ) const; + inline int dbuToScreenX ( DbU::Unit x ) const; + inline int dbuToScreenY ( DbU::Unit y ) const; + QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const; + inline QPoint dbuToScreenPoint ( const Point& point ) const; + inline DbU::Unit displayToDbuX ( int x ) const; + inline DbU::Unit displayToDbuY ( int y ) const; + inline DbU::Unit displayToDbuLength ( int length ) const; + inline Box displayToDbuBox ( const QRect& rect ) const; + inline DbU::Unit screenToDbuX ( int x ) const; + inline DbU::Unit screenToDbuY ( int y ) const; + inline Point screenToDbuPoint ( const QPoint& point ) const; + inline Box screenToDbuBox ( const QRect& rect ) const; + // Qt QWidget Functions Overloads. + void pushCursor ( Qt::CursorShape cursor ); + void popCursor (); + QSize minimumSizeHint () const; + void paintEvent ( QPaintEvent* ); + void resizeEvent ( QResizeEvent* ); + void keyPressEvent ( QKeyEvent* ); + void mouseMoveEvent ( QMouseEvent* ); + void mousePressEvent ( QMouseEvent* ); + void mouseReleaseEvent ( QMouseEvent* ); + signals: + void cellChanged ( Cell* ); + void cellPreModificated (); + void cellPostModificated (); + void updatePalette ( Cell* ); + void mousePositionChanged ( const Point& position ); + void selectionChanged ( const set&, Cell* ); + void occurrenceToggled ( Occurrence ); + void showSelectionToggled ( bool ); + public slots: + // Qt QWidget Slots Overload & CellWidget Specifics. + inline DrawingPlanes& getDrawingPlanes (); + inline QPoint& getOffsetVA (); + void select ( const Net* net, bool delayRedraw=false ); + void select ( Occurrence occurence ); + void selectOccurrencesUnder ( Box selectArea ); + void unselect ( Occurrence occurence ); + void unselectAll ( bool delayRedraw=false ); + void toggleSelect ( Occurrence occurence, bool fromPopup ); + void setShowSelection ( bool state ); + void setCumulativeSelection ( bool state ); + void _select ( const Net* net, bool delayRedraw=false ); + void _selectOccurrencesUnder ( Box selectArea ); + void _unselectAll ( bool delayRedraw ); + void updatePalette (); + void cellPreModificate (); + void cellPostModificate (); + inline void redraw (); + void redraw ( QRect redrawArea ); + inline void redrawSelection (); + void redrawSelection ( QRect redrawArea ); + void goLeft ( int dx = 0 ); + void goRight ( int dx = 0 ); + void goUp ( int dy = 0 ); + void goDown ( int dy = 0 ); + void fitToContents (); + void setScale ( float scale ); + void setShowBoundaries ( bool state ); + void reframe ( const Box& box ); + void displayReframe (); + void shiftLeft ( int dx ); + void shiftRight ( int dx ); + void shiftUp ( int dy ); + void shiftDown ( int dy ); private: class Spot { @@ -306,30 +315,33 @@ namespace Hurricane { protected: // Internal: Attributes. - static const int _stripWidth; - vector _cursors; - // MapView* _mapView; - Technology* _technology; - HPalette* _palette; - Box _displayArea; - Box _visibleArea; - float _scale; - QPoint _offsetVA; - DrawingPlanes _drawingPlanes; - DrawingQuery _drawingQuery; - TextDrawingQuery _textDrawingQuery; - int _queryFilter; - QPoint _mousePosition; - Spot _spot; - Cell* _cell; - bool _showBoundaries; - bool _showSelection; - bool _cumulativeSelection; - bool _selectionHasChanged; - set _selectors; - vector _commands; - size_t _redrawRectCount; - int _textFontHeight; + static const int _stripWidth; + vector _cursors; + // MapView* _mapView; + Technology* _technology; + PaletteWidget* _palette; + Box _displayArea; + Box _visibleArea; + float _scale; + QPoint _offsetVA; + DrawingPlanes _drawingPlanes; + DrawingQuery _drawingQuery; + TextDrawingQuery _textDrawingQuery; + int _queryFilter; + QPoint _mousePosition; + Spot _spot; + Cell* _cell; + bool _showBoundaries; + bool _showSelection; + bool _cumulativeSelection; + bool _selectionHasChanged; + int _delaySelectionChanged; + bool _cellModificated; + set _selectors; + vector _selectorCommands; + vector _commands; + size_t _redrawRectCount; + int _textFontHeight; }; @@ -545,7 +557,7 @@ namespace Hurricane { { return _cell; } - inline HPalette* CellWidget::getPalette () + inline PaletteWidget* CellWidget::getPalette () { return _palette; } diff --git a/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h b/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h index 4f803a91..4995e008 100644 --- a/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h +++ b/hurricane/src/hviewer/hurricane/viewer/DisplayStyle.h @@ -103,24 +103,24 @@ namespace Hurricane { public: // Constructors & Destructors. - DrawingGroup ( const Name& name ); - ~DrawingGroup (); - DrawingGroup* getClone (); - void qtAllocate (); + DrawingGroup ( const Name& name ); + ~DrawingGroup (); + DrawingGroup* getClone (); + void qtAllocate (); // Methods. - inline const Name& getName () const; - inline vector& getDrawingStyles (); - size_t findIndex ( const Name& key ) const; - DrawingStyle* find ( const Name& key ); - DrawingStyle* addDrawingStyle ( const Name& key - , const string& pattern - , int red - , int green - , int blue - , int borderWidth - , float threshold - ); + inline const Name& getName () const; + inline const vector& getDrawingStyles () const; + size_t findIndex ( const Name& key ) const; + DrawingStyle* find ( const Name& key ) const; + DrawingStyle* addDrawingStyle ( const Name& key + , const string& pattern + , int red + , int green + , int blue + , int borderWidth + , float threshold + ); protected: // Internal - Attributes. @@ -140,71 +140,71 @@ namespace Hurricane { public: // Static Members. - static const Name Viewer; - static const Name Fallback; - static const Name Background; - static const Name Foreground; - static const Name Rubber; - static const Name Phantom; - static const Name Boundaries; - static const Name Marker; - static const Name SelectionDraw; - static const Name SelectionFill; - static const Name Grid; - static const Name Spot; - static const Name Ghost; - static const Name TextCell; - static const Name TextInstance; - static const Name Undef; - static const Name UnmatchedGroup; - - // Constructor & Destructor. - DisplayStyle ( const Name& name ); - ~DisplayStyle (); - - // 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; - QPen getPen ( const Name& key, int darkening ) const; - QBrush getBrush ( const Name& key, int darkening ) const; - float getThreshold ( const Name& key ) const; - inline vector& getDrawingGroups (); - DrawingStyle* find ( const Name& key ) const; - - // Modifiers. - void qtAllocate (); - 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 - , int red - , int green - , int blue - , int borderWidth - , float threshold - ); + static const Name Viewer; + static const Name Fallback; + static const Name Background; + static const Name Foreground; + static const Name Rubber; + static const Name Phantom; + static const Name Boundaries; + static const Name Marker; + static const Name SelectionDraw; + static const Name SelectionFill; + static const Name Grid; + static const Name Spot; + static const Name Ghost; + static const Name TextCell; + static const Name TextInstance; + static const Name Undef; + static const Name UnmatchedGroup; + + // Constructor & Destructor. + DisplayStyle ( const Name& name ); + ~DisplayStyle (); + + // 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; + QPen getPen ( const Name& key, int darkening ) const; + QBrush getBrush ( const Name& key, int darkening ) const; + float getThreshold ( const Name& key ) const; + inline const vector& getDrawingGroups () const; + DrawingStyle* find ( const Name& key ) const; + + // Modifiers. + void qtAllocate (); + 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 + , int red + , int green + , int blue + , int borderWidth + , float threshold + ); protected: // Internals - Attributes. - const Name _name; - string _description; - vector _groups; - int _darkening; - - // Internals - Methods. - void findOrCreate ( const Name& groupKey - , size_t& gi ); - void find ( const Name& groupKey - , const Name& key - , size_t& gi - , size_t& si ); + const Name _name; + string _description; + vector _groups; + int _darkening; + + // Internals - Methods. + void findOrCreate ( const Name& groupKey + , size_t& gi ); + void find ( const Name& groupKey + , const Name& key + , size_t& gi + , size_t& si ) const; }; @@ -212,19 +212,19 @@ namespace Hurricane { // Functions. - inline const Name& DrawingStyle::getName () const { return _name; } - inline const string& DrawingStyle::getPattern () const { return _pattern; } - inline float DrawingStyle::getThreshold () const { return _threshold; } + inline const Name& DrawingStyle::getName () const { return _name; } + inline const string& DrawingStyle::getPattern () const { return _pattern; } + inline float DrawingStyle::getThreshold () const { return _threshold; } + + inline const Name& DrawingGroup::getName () const { return _name; } + inline const vector& DrawingGroup::getDrawingStyles () const { return _drawingStyles; } - inline const Name& DrawingGroup::getName () const { return _name; } - inline vector& DrawingGroup::getDrawingStyles () { return _drawingStyles; } - - 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; } + inline const Name& DisplayStyle::getName () const { return _name; } + inline const vector& DisplayStyle::getDrawingGroups () const { 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/GroupPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h deleted file mode 100644 index c51a1735..00000000 --- a/hurricane/src/hviewer/hurricane/viewer/GroupPaletteEntry.h +++ /dev/null @@ -1,109 +0,0 @@ - -// -*- 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 : "./GroupPaletteEntry.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#ifndef __GROUP_HPALETTE_ENTRY__ -#define __GROUP_HPALETTE_ENTRY__ - - -class QPushButton; - -#include "hurricane/Name.h" -#include "hurricane/viewer/HPaletteEntry.h" - - -namespace Hurricane { - - - class GroupPaletteEntry : public HPaletteEntry { - Q_OBJECT; - - // Constructor. - public: - static GroupPaletteEntry* create ( HPalette* palette, const Name& name ); - - // Methods. - public: - virtual bool isGroup () const; - virtual bool isBasicLayer () const; - virtual bool isExtension () const; - virtual const Name& getName () const; - virtual BasicLayer* getBasicLayer (); - virtual bool isChecked () const; - virtual void setChecked ( bool state ); - - // Slots. - public slots: - virtual void toggle (); - - // Internal - Attributes. - protected: - const Name _name; - QPushButton* _button; - size_t _index; - bool _expanded; - - // Internal - Constructor. - GroupPaletteEntry ( HPalette* palette, const Name& name ); - GroupPaletteEntry ( const GroupPaletteEntry& ); - GroupPaletteEntry& operator= ( const GroupPaletteEntry& ); - virtual void _postCreate (); - - // Internal - Methods. - void hideShow (); - string getLabel (); - }; - - -} // End of Hurricane namespace. - - -#endif // __GROUP_HPALETTE_ENTRY__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HDisplayFilter.h b/hurricane/src/hviewer/hurricane/viewer/HDisplayFilter.h index bf185ff4..9012032d 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HDisplayFilter.h +++ b/hurricane/src/hviewer/hurricane/viewer/HDisplayFilter.h @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,15 +16,15 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./HDisplayFilter.h" | +// | C++ Header : "./DisplayFilterWidget.h" | // | *************************************************************** | // | U p d a t e s | // | | // x-----------------------------------------------------------------x -#ifndef __HURRICANE_HDISPLAY_FILTER_H__ -#define __HURRICANE_HDISPLAY_FILTER_H__ +#ifndef __HURRICANE_DISPLAY_FILTER_WIDGET__ +#define __HURRICANE_DISPLAY_FILTER_WIDGET__ #include @@ -65,22 +38,22 @@ namespace Hurricane { class CellWidget; - class HDisplayFilter : public QWidget { + class DisplayFilterWidget : 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 ); - void setDoMasterCells ( int state ); - void setDoComponents ( int state ); - void setDoTerminalCells ( int state ); + DisplayFilterWidget ( QWidget* parent=NULL ); + void setCellWidget ( CellWidget* ); + + signals: + void filterChanged (); + + public slots: + void startLevelChanged ( int level ); + void stopLevelChanged ( int level ); + void setDoMasterCells ( int state ); + void setDoComponents ( int state ); + void setDoTerminalCells ( int state ); protected: CellWidget* _cellWidget; diff --git a/hurricane/src/hviewer/hurricane/viewer/HExtensionPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/HExtensionPaletteEntry.h deleted file mode 100644 index 26831efe..00000000 --- a/hurricane/src/hviewer/hurricane/viewer/HExtensionPaletteEntry.h +++ /dev/null @@ -1,77 +0,0 @@ - -// -*- C++ -*- -// -// This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved -// -// =================================================================== -// -// $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 : "./HExtensionPaletteEntry.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#ifndef __HURRICANE_EXTENSION_PALETTE_ENTRY__ -#define __HURRICANE_EXTENSION_PALETTE_ENTRY__ - - -class QCheckBox; - -#include "hurricane/Name.h" -#include "hurricane/viewer/HPaletteEntry.h" - - -namespace Hurricane { - - - class HExtensionPaletteEntry : public HPaletteEntry { - Q_OBJECT; - - // Constructor. - public: - static HExtensionPaletteEntry* create ( HPalette* , const Name& ); - - // Methods. - public: - virtual bool isGroup () const; - virtual bool isBasicLayer () const; - virtual bool isExtension () const; - virtual const Name& getName () const; - virtual BasicLayer* getBasicLayer (); - virtual bool isChecked () const; - virtual void setChecked ( bool ); - - // Slots. - public slots: - virtual void toggle (); - - // Internal - Attributes. - protected: - QCheckBox* _checkBox; - Name _name; - - // Internal - Constructor. - HExtensionPaletteEntry ( HPalette* , const Name& ); - HExtensionPaletteEntry ( const HExtensionPaletteEntry& ); - HExtensionPaletteEntry& operator= ( const HExtensionPaletteEntry& ); - virtual void _postCreate (); - - }; - - -} // End of Hurricane namespace. - - -#endif // __LAYER_PALETTE_ENTRY__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HGraphics.h b/hurricane/src/hviewer/hurricane/viewer/HGraphics.h index a4499a84..65356d37 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HGraphics.h +++ b/hurricane/src/hviewer/hurricane/viewer/HGraphics.h @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,15 +16,15 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./HGraphics.h" | +// | C++ Header : "./GraphicsWidget.h" | // | *************************************************************** | // | U p d a t e s | // | | // x-----------------------------------------------------------------x -#ifndef __HURRICANE_HGRAPHICS_H__ -#define __HURRICANE_HGRAPHICS_H__ +#ifndef __HURRICANE_GRAPHICS_WIDGET__ +#define __HURRICANE_GRAPHICS_WIDGET__ #include @@ -60,15 +33,15 @@ namespace Hurricane { - class HGraphics : public QWidget { + class GraphicsWidget : public QWidget { Q_OBJECT; public: - HGraphics ( QWidget* parent=NULL ); + GraphicsWidget ( QWidget* parent=NULL ); signals: - void styleChanged (); + void styleChanged (); public slots: - void styleChanged ( int id ); + void styleChanged ( int id ); }; diff --git a/hurricane/src/hviewer/hurricane/viewer/HInspectorWidget.h b/hurricane/src/hviewer/hurricane/viewer/HInspectorWidget.h index 77d2ff24..3681126f 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HInspectorWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/HInspectorWidget.h @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,15 +16,15 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./HInspectorWidget.h" | +// | C++ Header : "./InspectorWidget.h" | // | *************************************************************** | // | U p d a t e s | // | | // x-----------------------------------------------------------------x -#ifndef __HINSPECTOR_WIDGET_H__ -#define __HINSPECTOR_WIDGET_H__ +#ifndef __HURRICANE_INSPECTOR_WIDGET__ +#define __HURRICANE_INSPECTOR_WIDGET__ #include @@ -73,10 +46,10 @@ namespace Hurricane { class RecordModel; - class HInspectorWidget : public QWidget { + class InspectorWidget : public QWidget { public: - typedef vector SlotsVector; + typedef vector SlotsVector; private: class History { @@ -104,8 +77,8 @@ namespace Hurricane { Q_OBJECT; public: - HInspectorWidget ( QWidget* parent=NULL ); - ~HInspectorWidget (); + InspectorWidget ( QWidget* parent=NULL ); + ~InspectorWidget (); void setRootRecord ( Record* record ); private slots: void forceRowHeight (); @@ -134,4 +107,4 @@ namespace Hurricane { } // End of Hurricane namespace. -#endif // __HINSPECTOR_WIDGET_H__ +#endif // __HURRICANE_INSPECTOR_WIDGET__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HMousePosition.h b/hurricane/src/hviewer/hurricane/viewer/HMousePosition.h index b1278105..08989910 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HMousePosition.h +++ b/hurricane/src/hviewer/hurricane/viewer/HMousePosition.h @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,22 +16,22 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./HMousePosition.h" | +// | C++ Header : "./MousePositionWidget.h" | // | *************************************************************** | // | U p d a t e s | // | | // x-----------------------------------------------------------------x -# ifndef __HMOUSE_POSITION_H__ -# define __HMOUSE_POSITION_H__ +#ifndef __HURRICANE_MOUSE_POSITION__ +#define __HURRICANE_MOUSE_POSITION__ -# include +#include class QLabel; -# include "hurricane/Commons.h" -# include "hurricane/Point.h" +#include "hurricane/Commons.h" +#include "hurricane/Point.h" namespace Hurricane { @@ -67,23 +40,20 @@ namespace Hurricane { class DynamicLabel; - class HMousePosition : public QWidget { + class MousePositionWidget : public QWidget { Q_OBJECT; public: - // Constructor. - HMousePosition ( QWidget* parent=NULL ); - public slots: - void setPosition ( const Point& position ); - + MousePositionWidget ( QWidget* parent=NULL ); + public slots: + void setPosition ( const Point& ); + + protected: + DynamicLabel* _xPosition; + DynamicLabel* _yPosition; protected: - // Internal - Attributes. - DynamicLabel* _xPosition; - DynamicLabel* _yPosition; - - // Internal - Constructor. - HMousePosition ( const DynamicLabel& ); - HMousePosition& operator= ( const DynamicLabel& ); + MousePositionWidget ( const DynamicLabel& ); + MousePositionWidget& operator= ( const DynamicLabel& ); }; diff --git a/hurricane/src/hviewer/hurricane/viewer/HNetlist.h b/hurricane/src/hviewer/hurricane/viewer/HNetlist.h index a02f36a0..788b8733 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HNetlist.h +++ b/hurricane/src/hviewer/hurricane/viewer/HNetlist.h @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,15 +16,15 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./HNetlist.h" | +// | C++ Header : "./NetlistWidget.h" | // | *************************************************************** | // | U p d a t e s | // | | // x-----------------------------------------------------------------x -#ifndef __HNETLIST_WIDGET_H__ -#define __HNETLIST_WIDGET_H__ +#ifndef __HURRICANE_NETLIST_WIDGET_H__ +#define __HURRICANE_NETLIST_WIDGET_H__ #include @@ -74,41 +47,44 @@ class QHeaderView; namespace Hurricane { + class Net; class Cell; - class CellWidget; - class HNetlist : public QWidget { + class NetlistWidget : public QWidget { Q_OBJECT; public: - HNetlist ( QWidget* parent=NULL ); + NetlistWidget ( QWidget* parent=NULL ); + inline Cell* getCell (); template - void setCell ( Cell* cell ); - template - void setCellWidget ( CellWidget* cw ); - void runInspector ( const QModelIndex& index ); + void setCell ( Cell* ); + void goTo ( int ); + signals: + void netSelected ( const Net* ); public slots: void forceRowHeight (); private slots: void textFilterChanged (); - void selectNet ( const QModelIndex& index ); + void selectNet ( const QModelIndex& ); + void selectCurrent ( const QModelIndex& , const QModelIndex& ); protected: - void keyPressEvent ( QKeyEvent * event ); + void keyPressEvent ( QKeyEvent* ); private: - HNetlistModel* _baseModel; + Cell* _cell; + NetlistModel* _baseModel; QSortFilterProxyModel* _sortModel; QTableView* _view; QLineEdit* _filterPatternLineEdit; int _rowHeight; - CellWidget* _cellWidget; }; template - void HNetlist::setCell ( Cell* cell ) + void NetlistWidget::setCell ( Cell* cell ) { + _cell = cell; _baseModel->setCell ( cell ); string windowTitle = "Netlist" + getString(cell); @@ -122,17 +98,10 @@ namespace Hurricane { } - template - void HNetlist::setCellWidget ( CellWidget* cw ) - { - if ( _baseModel->getCell() != cw->getCell() ) - setCell( cw->getCell() ); - - _cellWidget = cw; - } + inline Cell* NetlistWidget::getCell () { return _cell; } } // End of Hurricane namespace. -#endif // __HNETLIST_WIDGET_H__ +#endif // __HURRICANE_NETLIST_WIDGET_H__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HNetlistModel.h b/hurricane/src/hviewer/hurricane/viewer/HNetlistModel.h index 4e10cf46..18383976 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HNetlistModel.h +++ b/hurricane/src/hviewer/hurricane/viewer/HNetlistModel.h @@ -1,36 +1,8 @@ - // -*- 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/LIP6 2008-2008, 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$ @@ -43,15 +15,15 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./HNetlistModel.h" | +// | C++ Header : "./NetlistModel.h" | // | *************************************************************** | // | U p d a t e s | // | | // x-----------------------------------------------------------------x -#ifndef __NETLIST_MODEL_H__ -#define __NETLIST_MODEL_H__ +#ifndef __HURRICANE_NETLIST_MODEL__ +#define __HURRICANE_NETLIST_MODEL__ #include @@ -65,7 +37,6 @@ #include "hurricane/Cell.h" #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/NetInformations.h" -#include "hurricane/viewer/HNetlistModel.h" namespace Hurricane { @@ -75,20 +46,20 @@ namespace Hurricane { class Cell; - class HNetlistModel : public QAbstractTableModel { + class NetlistModel : public QAbstractTableModel { Q_OBJECT; public: - HNetlistModel ( QObject* parent=NULL ); - ~HNetlistModel (); + NetlistModel ( QObject* parent=NULL ); + ~NetlistModel (); template - void setCell ( Cell* cell ); - int rowCount ( const QModelIndex& parent=QModelIndex() ) const; - int columnCount ( const QModelIndex& parent=QModelIndex() ) const; - QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const; - QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const; - inline Cell* getCell (); - const Net* getNet ( int row ); + void setCell ( Cell* cell ); + int rowCount ( const QModelIndex& parent=QModelIndex() ) const; + int columnCount ( const QModelIndex& parent=QModelIndex() ) const; + QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const; + QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const; + inline Cell* getCell (); + const Net* getNet ( int row ); private: Cell* _cell; @@ -98,13 +69,13 @@ namespace Hurricane { // Inline Functions. - inline Cell* HNetlistModel::getCell () { return _cell; } + inline Cell* NetlistModel::getCell () { return _cell; } // Template Functions. template - void HNetlistModel::setCell ( Cell* cell ) + void NetlistModel::setCell ( Cell* cell ) { if ( _cell != cell ) { if ( _cell ) @@ -113,9 +84,10 @@ namespace Hurricane { _cell = cell; _netlist = new NetInformationsVector(); - for_each_net ( net, _cell->getNets() ) { - _netlist->addNet ( net ); - end_for; + if ( _cell ) { + forEach ( Net*, net, _cell->getNets() ) { + _netlist->addNet ( *net ); + } } emit layoutChanged (); diff --git a/hurricane/src/hviewer/hurricane/viewer/HPalette.h b/hurricane/src/hviewer/hurricane/viewer/HPalette.h deleted file mode 100644 index 86f6ea5f..00000000 --- a/hurricane/src/hviewer/hurricane/viewer/HPalette.h +++ /dev/null @@ -1,121 +0,0 @@ - -// -*- 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 : "./HPalette.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#ifndef __HURRICANE_PALETTE__ -#define __HURRICANE_PALETTE__ - -#include -#include -#include -#include - -#include "hurricane/Commons.h" - - - class QCheckBox; - class QPushButton; - - -namespace Hurricane { - - - using namespace std; - - - class Name; - class BasicLayer; - class Cell; - class CellWidget; - class HPaletteEntry; - - - class HPalette : public QScrollArea { - Q_OBJECT; - - public: - // Constructor. - HPalette ( QWidget* parent=NULL ); - // Methods. - bool isDrawable ( size_t index ); - inline CellWidget* getCellWidget (); - inline vector& getEntries (); - void redrawCellWidget (); - HPaletteEntry* find ( const Name& name ); - signals: - // Signals. - void paletteChanged (); - public slots: - // Slots. - void updateExtensions ( Cell* cell ); - void showAll (); - void hideAll (); - - protected: - // Internal - Attributes. - vector _entries; - QPushButton* _showAll; - QPushButton* _hideAll; - // Internal - Constructors. - HPalette ( const HPalette& ); - HPalette& operator= ( const HPalette& ); - - }; - - - // Inline Functions. - inline vector& HPalette::getEntries () { return _entries; } - - -} // End of Hurricane namespace. - - -#endif // __HURRICANE_PALETTE__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h deleted file mode 100644 index f846d1f0..00000000 --- a/hurricane/src/hviewer/hurricane/viewer/HPaletteEntry.h +++ /dev/null @@ -1,127 +0,0 @@ - -// -*- 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 : "./HPaletteEntry.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#ifndef __HURRICANE_PALETTE_ENTRY__ -#define __HURRICANE_PALETTE_ENTRY__ - -#include -#include -#include - -class QPaintEvent; -class QCheckBox; - -#include "hurricane/Commons.h" - - -namespace Hurricane { - - - class Name; - class BasicLayer; - class HPalette; - class HPaletteEntry; - - - class HPaletteSample : public QWidget { - Q_OBJECT; - - // Constructor. - public: - HPaletteSample ( HPaletteEntry* entry ); - - // Internals - Attributes. - protected: - QPixmap _sample; - HPaletteEntry* _entry; - - // Internals - Methods. - void redraw (); - void paintEvent ( QPaintEvent* ); - - }; - - - class HPaletteEntry : public QWidget { - Q_OBJECT; - - // Methods. - public: - virtual const Name& getName () const = 0; - virtual bool isGroup () const = 0; - virtual bool isBasicLayer () const = 0; - virtual bool isExtension () const = 0; - virtual BasicLayer* getBasicLayer () = 0; - virtual bool isChecked () const = 0; - virtual void setChecked ( bool state ) = 0; - - // Slots. - public slots: - virtual void toggle () = 0; - - // Internal - Attributes. - protected: - HPalette* _palette; - - // Internal - Constructor. - HPaletteEntry ( HPalette* palette ); - HPaletteEntry ( const HPaletteEntry& ); - HPaletteEntry& operator= ( const HPaletteEntry& ); - virtual void _postCreate () = 0; - - }; - - -} // End of Hurricane namespace. - - -# endif // __HURRICANE_PALETTE_ENTRY__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HSelection.h b/hurricane/src/hviewer/hurricane/viewer/HSelection.h index 68582fa4..9586d0dc 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HSelection.h +++ b/hurricane/src/hviewer/hurricane/viewer/HSelection.h @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,15 +16,15 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./HSelection.h" | +// | C++ Header : "./SelectionWidget.h" | // | *************************************************************** | // | U p d a t e s | // | | // x-----------------------------------------------------------------x -#ifndef __HURRICANE_SELECTION_WIDGET_H__ -#define __HURRICANE_SELECTION_WIDGET_H__ +#ifndef __HURRICANE_SELECTION_WIDGET__ +#define __HURRICANE_SELECTION_WIDGET__ #include @@ -60,6 +33,7 @@ #include "hurricane/Commons.h" #include "hurricane/Occurrence.h" +//#include "hurricane/viewer/SelectionModel.h" #include "hurricane/viewer/HSelectionModel.h" @@ -79,35 +53,40 @@ namespace Hurricane { class QCloseEvent; - class HSelection : public QWidget { + class SelectionWidget : public QWidget { Q_OBJECT; public: - HSelection ( QWidget* parent=NULL ); - void runInspector ( const QModelIndex& index ); - bool isCumulative () const; - signals: - void showSelected ( bool ); - void occurrenceToggled ( Occurrence, bool ); - void cumulativeToggled ( bool ); - void selectionCleared (); - public slots: - void setSelection ( const set& selection, Cell* cell=NULL ); - void toggleSelection ( Occurrence occurrence ); - void toggleSelection ( const QModelIndex& index ); - void forceRowHeight (); - private slots: - void textFilterChanged (); - protected: - virtual void keyPressEvent ( QKeyEvent * event ); - virtual void hideEvent ( QHideEvent* event ); + SelectionWidget ( QWidget* parent=NULL ); + void inspect ( const QModelIndex& index ); + bool isCumulative () const; + signals: + void showSelection ( bool ); + void occurrenceToggled ( Occurrence, bool ); + void cumulativeToggled ( bool ); + void showSelectionToggled ( bool ); + void selectionCleared (); + void inspect ( Record* ); + public slots: + void setShowSelection ( bool ); + void selectCurrent ( const QModelIndex& current, const QModelIndex& ); + void setSelection ( const set& selection, Cell* cell=NULL ); + void toggleSelection ( Occurrence occurrence ); + void toggleSelection ( const QModelIndex& index ); + void forceRowHeight (); + private slots: + void textFilterChanged (); + protected: + virtual void keyPressEvent ( QKeyEvent * event ); + virtual void hideEvent ( QHideEvent* event ); private: - HSelectionModel* _baseModel; + SelectionModel* _baseModel; QSortFilterProxyModel* _sortModel; QTableView* _view; QLineEdit* _filterPatternLineEdit; QCheckBox* _cumulative; + QCheckBox* _showSelection; int _rowHeight; }; @@ -115,4 +94,4 @@ namespace Hurricane { } // End of Hurricane namespace. -#endif // __HURRICANE_SELECTION_WIDGET_H__ +#endif // __HURRICANE_SELECTION_WIDGET__ diff --git a/hurricane/src/hviewer/hurricane/viewer/HSelectionModel.h b/hurricane/src/hviewer/hurricane/viewer/HSelectionModel.h index ebf80ab9..55edc8d3 100644 --- a/hurricane/src/hviewer/hurricane/viewer/HSelectionModel.h +++ b/hurricane/src/hviewer/hurricane/viewer/HSelectionModel.h @@ -1,36 +1,9 @@ // -*- 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/LIP6 2008-2008, 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$ @@ -43,7 +16,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./HSelectionModel.h" | +// | C++ Header : "./SelectionModel.h" | // | *************************************************************** | // | U p d a t e s | // | | @@ -103,12 +76,12 @@ namespace Hurricane { } - class HSelectionModel : public QAbstractTableModel { + class SelectionModel : public QAbstractTableModel { Q_OBJECT; public: - HSelectionModel ( QObject* parent=NULL ); - ~HSelectionModel (); + SelectionModel ( QObject* parent=NULL ); + ~SelectionModel (); void setSelection ( const set& selection ); void toggleSelection ( Occurrence occurrence ); Occurrence toggleSelection ( const QModelIndex& index ); diff --git a/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h deleted file mode 100644 index 7d3d4829..00000000 --- a/hurricane/src/hviewer/hurricane/viewer/LayerPaletteEntry.h +++ /dev/null @@ -1,103 +0,0 @@ - -// -*- 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 : "./LayerPaletteEntry.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -#ifndef __LAYER_PALETTE_ENTRY__ -#define __LAYER_PALETTE_ENTRY__ - - -class QCheckBox; - -#include "hurricane/viewer/HPaletteEntry.h" - - -namespace Hurricane { - - - class LayerPaletteEntry : public HPaletteEntry { - Q_OBJECT; - - // Constructor. - public: - static LayerPaletteEntry* create ( HPalette* palette, BasicLayer* basicLayer ); - - // Methods. - public: - virtual bool isGroup () const; - virtual bool isBasicLayer () const; - virtual bool isExtension () const; - virtual const Name& getName () const; - virtual BasicLayer* getBasicLayer (); - virtual bool isChecked () const; - virtual void setChecked ( bool state ); - - // Slots. - public slots: - virtual void toggle (); - - // Internal - Attributes. - protected: - BasicLayer* _basicLayer; - QCheckBox* _checkBox; - - // Internal - Constructor. - LayerPaletteEntry ( HPalette* palette, BasicLayer* basicLayer ); - LayerPaletteEntry ( const LayerPaletteEntry& ); - LayerPaletteEntry& operator= ( const LayerPaletteEntry& ); - virtual void _postCreate (); - - }; - - -} // End of Hurricane namespace. - - -#endif // __LAYER_PALETTE_ENTRY__ diff --git a/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h b/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h deleted file mode 100644 index dc3eb0d1..00000000 --- a/hurricane/src/hviewer/hurricane/viewer/ViewerPaletteEntry.h +++ /dev/null @@ -1,104 +0,0 @@ - -// -*- 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 : "./ViewerPaletteEntry.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - -# ifndef __VIEWER_PALETTE_ENTRY_H__ -# define __VIEWER_PALETTE_ENTRY_H__ - - -class QCheckBox; - -# include "hurricane/Name.h" -# include "hurricane/viewer/HPaletteEntry.h" - - -namespace Hurricane { - - - class ViewerPaletteEntry : public HPaletteEntry { - Q_OBJECT; - - // Constructor. - public: - static ViewerPaletteEntry* create ( HPalette* palette, const Name& name ); - - // Methods. - public: - virtual bool isGroup () const; - virtual bool isBasicLayer () const; - virtual bool isExtension () const; - virtual const Name& getName () const; - virtual BasicLayer* getBasicLayer (); - virtual bool isChecked () const; - virtual void setChecked ( bool state ); - - // Slots. - public slots: - virtual void toggle (); - - // Internal - Attributes. - protected: - const Name _name; - QCheckBox* _checkBox; - - // Internal - Constructor. - ViewerPaletteEntry ( HPalette* palette, const Name& name ); - ViewerPaletteEntry ( const ViewerPaletteEntry& ); - ViewerPaletteEntry& operator= ( const ViewerPaletteEntry& ); - virtual void _postCreate (); - - }; - - -} // End of Hurricane namespace. - - -# endif