From 8845533c25e9cee77a7ca7e1fb505b4b263b8dcf Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 12 Dec 2008 13:28:19 +0000 Subject: [PATCH] * ./hurricane/src/hviewer : - Bug: Bad detection of libraries in HURRICANE_CHECK_LIBRARY macro. - New feature : add a "selectable" characteric on drawable objects. Allows to selectively select objects through dragging. Note that it's implemented in term of BasicLayer & ExtensionGo. If an object (Component) has a Layer composed of more than one BasicLayer it will become selectable as soon as one of it's BasicLayer is selectable. --- hurricane/cmake_modules/FindHURRICANE.cmake | 47 ++++---- hurricane/src/hviewer/CMakeLists.txt | 2 + hurricane/src/hviewer/CellWidget.cpp | 102 +++++++++++++++++- .../src/hviewer/PaletteExtensionGoItem.cpp | 42 ++++++-- hurricane/src/hviewer/PaletteItem.cpp | 10 ++ hurricane/src/hviewer/PaletteLayerItem.cpp | 50 ++++++--- hurricane/src/hviewer/PaletteNamedItem.cpp | 28 ++--- hurricane/src/hviewer/PaletteWidget.cpp | 37 +++++-- hurricane/src/hviewer/SelectCommand.cpp | 5 +- .../src/hviewer/hurricane/viewer/CellWidget.h | 8 ++ .../hurricane/viewer/PaletteExtensionGoItem.h | 9 +- .../hviewer/hurricane/viewer/PaletteItem.h | 17 +-- .../hurricane/viewer/PaletteLayerItem.h | 29 ++--- .../hurricane/viewer/PaletteNamedItem.h | 10 +- .../hviewer/hurricane/viewer/PaletteWidget.h | 15 +-- 15 files changed, 304 insertions(+), 107 deletions(-) diff --git a/hurricane/cmake_modules/FindHURRICANE.cmake b/hurricane/cmake_modules/FindHURRICANE.cmake index 97c25454..a3bcfeac 100644 --- a/hurricane/cmake_modules/FindHURRICANE.cmake +++ b/hurricane/cmake_modules/FindHURRICANE.cmake @@ -30,21 +30,26 @@ MACRO(SET_LIBRARIES_PATH configname library) 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) +MACRO(HURRICANE_CHECK_LIBRARIES) + IF(ARGC LESS 2) + SET(REQUIRED ${argv0}_FIND_REQUIRED) + ELSE(ARGC LESS 2) + SET(REQUIRED ${argv1}) + ENDIF(ARGC LESS 2) + IF(${argv0}_FOUND OR ${argv0}_STATIC_FOUND) + IF(NOT ${argv0}_FIND_QUIETLY) + IF(${argv0}_FOUND) + MESSAGE(STATUS "Found ${argv0} : ${${argv0}_LIBRARIES}") + ENDIF(${argv0}_FOUND) + IF(${argv0}_STATIC_FOUND) + MESSAGE(STATUS "Found ${argv0} (static): ${${argv0}_STATIC_LIBRARIES}") + ENDIF(${argv0}_STATIC_FOUND) + ENDIF(NOT ${argv0}_FIND_QUIETLY) + ELSE(${argv0}_FOUND OR ${argv0}_STATIC_FOUND) + IF(REQUIRED) + MESSAGE(FATAL_ERROR "${argv0} was not found. ${${argv0}_DIR_MESSAGE}") + ENDIF(REQUIRED) + ENDIF(${argv0}_FOUND OR ${argv0}_STATIC_FOUND) ENDMACRO(HURRICANE_CHECK_LIBRARIES) @@ -87,15 +92,15 @@ IF(UNIX) DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}" ) - FIND_PATH(HURRICANE_GRAPHICAL_INCLUDE_PATH - NAMES hurricane/viewer/CellViewer.h hurricane/viewer/HInspectorWidget.h + FIND_PATH(HURRICANE_VIEWER_INCLUDE_PATH + NAMES hurricane/viewer/CellWidget.h PATHS ${HURRICANE_DIR_SEARCH} PATH_SUFFIXES include # Help the user find it if we cannot. DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}" ) - FIND_LIBRARY(HURRICANE_GRAPHICAL_LIBRARY_PATH + FIND_LIBRARY(HURRICANE_VIEWER_LIBRARY_PATH NAMES hviewer PATHS ${HURRICANE_DIR_SEARCH} PATH_SUFFIXES lib @@ -103,7 +108,7 @@ IF(UNIX) DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}" ) - FIND_LIBRARY(HURRICANE_GRAPHICAL_STATIC_LIBRARY_PATH + FIND_LIBRARY(HURRICANE_VIEWER_STATIC_LIBRARY_PATH NAMES hviewer-static PATHS ${HURRICANE_DIR_SEARCH} PATH_SUFFIXES lib @@ -131,6 +136,8 @@ IF(UNIX) SET_LIBRARIES_PATH(HURRICANE_GRAPHICAL HURRICANE_VIEWER) SET_LIBRARIES_PATH(HURRICANE_PYTHON HURRICANE_PYTHON) - HURRICANE_CHECK_LIBRARIES(HURRICANE) + HURRICANE_CHECK_LIBRARIES(HURRICANE ) + HURRICANE_CHECK_LIBRARIES(HURRICANE_GRAPHICAL ${HURRICANE_FIND_REQUIRED}) + HURRICANE_CHECK_LIBRARIES(HURRICANE_PYTHON ${HURRICANE_FIND_REQUIRED}) ENDIF(UNIX) diff --git a/hurricane/src/hviewer/CMakeLists.txt b/hurricane/src/hviewer/CMakeLists.txt index a35ca6ed..aea60780 100644 --- a/hurricane/src/hviewer/CMakeLists.txt +++ b/hurricane/src/hviewer/CMakeLists.txt @@ -7,6 +7,7 @@ set ( mocincludes hurricane/viewer/PaletteItem.h hurricane/viewer/PaletteNamedItem.h hurricane/viewer/PaletteLayerItem.h + hurricane/viewer/PaletteExtensionGoItem.h hurricane/viewer/PaletteWidget.h hurricane/viewer/GraphicsWidget.h hurricane/viewer/DynamicLabel.h @@ -59,6 +60,7 @@ PaletteItem.cpp PaletteNamedItem.cpp PaletteLayerItem.cpp + PaletteExtensionGoItem.cpp PaletteWidget.cpp DynamicLabel.cpp MousePositionWidget.cpp diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index b629a6d1..0c178741 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -41,6 +41,7 @@ #include "hurricane/Contact.h" #include "hurricane/Pad.h" #include "hurricane/RoutingPad.h" +#include "hurricane/ExtensionGo.h" #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/PaletteItem.h" @@ -55,6 +56,75 @@ namespace Hurricane { +// ------------------------------------------------------------------- +// Collections. + + + typedef Hurricane::Filter OccurrenceHF; + typedef Hurricane::Locator OccurrenceHL; + typedef Hurricane::Collection OccurrenceHC; + + + +// ------------------------------------------------------------------- +// Class : "Occurrences_IsSelectable". + + + class Occurrences_IsSelectable : public OccurrenceHF { + public: + inline Occurrences_IsSelectable ( const CellWidget* ); + inline Occurrences_IsSelectable ( const Occurrences_IsSelectable& ); + virtual OccurrenceHF* getClone () const; + virtual bool accept ( Occurrence ) const; + virtual string _getString () const; + private: + const CellWidget* _cellWidget; + }; + + + inline Occurrences_IsSelectable::Occurrences_IsSelectable ( const CellWidget* widget ) + : OccurrenceHF() + , _cellWidget(widget) + { } + + + inline Occurrences_IsSelectable::Occurrences_IsSelectable ( const Occurrences_IsSelectable& rhs ) + : OccurrenceHF() + , _cellWidget(rhs._cellWidget) + { } + + + OccurrenceHF* Occurrences_IsSelectable::getClone () const + { + return new Occurrences_IsSelectable(_cellWidget); + } + + + bool Occurrences_IsSelectable::accept ( Occurrence occurrence ) const + { + Entity* entity = occurrence.getEntity(); + if ( !entity ) return false; + + ExtensionGo* eGo = dynamic_cast(entity); + if ( eGo ) + return _cellWidget->isSelectable ( eGo->getName() ); + + Component* component = dynamic_cast(entity); + if ( component ) { + return _cellWidget->isSelectable ( component->getLayer() ); + } + + return true; + } + + + string Occurrences_IsSelectable::_getString () const + { + return ""; + } + + + // ------------------------------------------------------------------- // Class : "Hurricane::CellWidget::Spot". @@ -778,7 +848,7 @@ namespace Hurricane { { PaletteItem* item = (_palette) ? _palette->find(layerName) : NULL; - return (!item || item->isChecked()) + return (!item || item->isItemVisible()) && ( Graphics::getThreshold(layerName)/DbU::lambda(1.0) < _scale ); } @@ -787,7 +857,27 @@ namespace Hurricane { { PaletteItem* item = (_palette) ? _palette->find(extensionName) : NULL; - return (!item || item->isChecked()); + return (!item || item->isItemVisible()); + } + + + bool CellWidget::isSelectable ( const Name& name ) const + { + PaletteItem* item = (_palette) ? _palette->find(name) : NULL; + + return (!item || item->isItemSelectable()); + } + + + bool CellWidget::isSelectable ( const Layer* layer ) const + { + PaletteItem* item = NULL; + forEach ( BasicLayer*, ilayer, layer->getBasicLayers() ) { + item = (_palette) ? _palette->find(ilayer->getName()) : NULL; + if ( item && item->isItemSelectable() ) + return true; + } + return false; } @@ -1272,6 +1362,12 @@ namespace Hurricane { } + Occurrences CellWidget::getOccurrencesUnder ( const Box& area ) const + { + return getCell()->getOccurrencesUnder(area).getSubSet(Occurrences_IsSelectable(this)); + } + + void CellWidget::select ( const Net* net, bool delayRedraw ) { ++_delaySelectionChanged; @@ -1434,7 +1530,7 @@ namespace Hurricane { void CellWidget::_selectOccurrencesUnder ( Box selectArea ) { - forEach ( Occurrence, ioccurrence, _cell->getOccurrencesUnder(selectArea) ) + forEach ( Occurrence, ioccurrence, getOccurrencesUnder(selectArea) ) select ( *ioccurrence ); } diff --git a/hurricane/src/hviewer/PaletteExtensionGoItem.cpp b/hurricane/src/hviewer/PaletteExtensionGoItem.cpp index fd4331c3..61568e17 100644 --- a/hurricane/src/hviewer/PaletteExtensionGoItem.cpp +++ b/hurricane/src/hviewer/PaletteExtensionGoItem.cpp @@ -35,6 +35,8 @@ namespace Hurricane { PaletteExtensionGoItem::PaletteExtensionGoItem ( const Name& name ) : PaletteItem() + , _visible(NULL) + , _selectable(NULL) , _name(name) { } @@ -52,15 +54,23 @@ namespace Hurricane { 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 ); + _visible = new QCheckBox ( this ); + _visible->setChecked ( false ); + _visible->setText ( getString(getName()).c_str() ); + _visible->setFont ( Graphics::getFixedFont() ); + _selectable = new QCheckBox ( this ); + _selectable->setFixedWidth ( 23 ); + _selectable->setChecked ( true ); + _selectable->setStyleSheet ( "QCheckBox { background-color: red;" + " padding: 5px }" ); + + layout->addWidget ( _selectable ); + layout->addWidget ( _visible ); setLayout ( layout ); - connect ( _checkBox, SIGNAL(clicked()), this, SIGNAL(toggled()) ); + connect ( _visible , SIGNAL(clicked()), this, SIGNAL(visibleToggled ()) ); + connect ( _selectable, SIGNAL(clicked()), this, SIGNAL(selectableToggled()) ); } @@ -70,15 +80,27 @@ namespace Hurricane { } - bool PaletteExtensionGoItem::isChecked () const + bool PaletteExtensionGoItem::isItemVisible () const { - return _checkBox->isChecked (); + return _visible->isChecked (); } - void PaletteExtensionGoItem::setChecked ( bool state ) + void PaletteExtensionGoItem::setItemVisible ( bool state ) { - _checkBox->setChecked ( state ); + _visible->setChecked ( state ); + } + + + bool PaletteExtensionGoItem::isItemSelectable () const + { + return _selectable->isChecked (); + } + + + void PaletteExtensionGoItem::setItemSelectable ( bool state ) + { + _visible->setChecked ( state ); } diff --git a/hurricane/src/hviewer/PaletteItem.cpp b/hurricane/src/hviewer/PaletteItem.cpp index 2d4d3996..aa467969 100644 --- a/hurricane/src/hviewer/PaletteItem.cpp +++ b/hurricane/src/hviewer/PaletteItem.cpp @@ -78,4 +78,14 @@ namespace Hurricane { { } + bool PaletteItem::isItemSelectable () const + { + return true; + } + + + void PaletteItem::setItemSelectable ( bool ) + { } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/PaletteLayerItem.cpp b/hurricane/src/hviewer/PaletteLayerItem.cpp index 16e6a82f..e791aa9d 100644 --- a/hurricane/src/hviewer/PaletteLayerItem.cpp +++ b/hurricane/src/hviewer/PaletteLayerItem.cpp @@ -35,30 +35,40 @@ namespace Hurricane { - PaletteLayerItem::PaletteLayerItem ( BasicLayer* basicLayer, bool checked ) + PaletteLayerItem::PaletteLayerItem ( BasicLayer* basicLayer, bool visible ) : PaletteItem() , _basicLayer(basicLayer) + , _visible (new QCheckBox()) + , _selectable(new QCheckBox()) { QHBoxLayout* layout = new QHBoxLayout (); layout->setContentsMargins ( 0, 0, 0, 0 ); - layout->addWidget ( new DrawingStyleSample(this) ); - _checkBox = new QCheckBox ( this ); - _checkBox->setChecked ( checked ); - _checkBox->setText ( getString(getName()).c_str() ); - _checkBox->setFont ( Graphics::getFixedFont() ); - layout->addWidget ( _checkBox ); + _visible->setChecked ( visible ); + _visible->setText ( getString(getName()).c_str() ); + _visible->setFont ( Graphics::getFixedFont() ); + + _selectable->setFixedWidth ( 23 ); + _selectable->setChecked ( true ); + _selectable->setStyleSheet ( "QCheckBox { background-color: red;" + " padding: 5px }" ); + + layout->addWidget ( _selectable ); + //layout->addSpacing ( -15 ); + layout->addWidget ( _visible ); + layout->addStretch (); setLayout ( layout ); - connect ( _checkBox, SIGNAL(clicked()), this, SIGNAL(toggled()) ); + connect ( _visible , SIGNAL(clicked()), this, SIGNAL(visibleToggled ()) ); + connect ( _selectable, SIGNAL(clicked()), this, SIGNAL(selectableToggled()) ); } - PaletteLayerItem* PaletteLayerItem::create ( BasicLayer* basicLayer, bool checked ) + PaletteLayerItem* PaletteLayerItem::create ( BasicLayer* basicLayer, bool visible ) { - PaletteLayerItem* item = new PaletteLayerItem ( basicLayer, checked ); + PaletteLayerItem* item = new PaletteLayerItem ( basicLayer, visible ); return item; } @@ -69,15 +79,27 @@ namespace Hurricane { } - bool PaletteLayerItem::isChecked () const + bool PaletteLayerItem::isItemVisible () const { - return _checkBox->isChecked (); + return _visible->isChecked (); } - void PaletteLayerItem::setChecked ( bool state ) + void PaletteLayerItem::setItemVisible ( bool state ) { - _checkBox->setChecked ( state ); + _visible->setChecked ( state ); + } + + + bool PaletteLayerItem::isItemSelectable () const + { + return _selectable->isChecked (); + } + + + void PaletteLayerItem::setItemSelectable ( bool state ) + { + _selectable->setChecked ( state ); } diff --git a/hurricane/src/hviewer/PaletteNamedItem.cpp b/hurricane/src/hviewer/PaletteNamedItem.cpp index 232255ec..dff90443 100644 --- a/hurricane/src/hviewer/PaletteNamedItem.cpp +++ b/hurricane/src/hviewer/PaletteNamedItem.cpp @@ -33,28 +33,28 @@ namespace Hurricane { - PaletteNamedItem::PaletteNamedItem ( const Name& name, bool checked ) + PaletteNamedItem::PaletteNamedItem ( const Name& name, bool visible ) : PaletteItem() - , _name(name) + , _visible (new QCheckBox(this)) + , _name (name) { QHBoxLayout* layout = new QHBoxLayout (); layout->setContentsMargins ( 0, 0, 0, 0 ); - _checkBox = new QCheckBox ( this ); - _checkBox->setChecked ( checked ); - _checkBox->setText ( getString(getName()).c_str() ); - _checkBox->setFont ( Graphics::getFixedFont() ); - layout->addWidget ( _checkBox ); + _visible->setChecked ( visible ); + _visible->setText ( getString(getName()).c_str() ); + _visible->setFont ( Graphics::getFixedFont() ); + layout->addWidget ( _visible ); setLayout ( layout ); - connect ( _checkBox, SIGNAL(clicked()), this, SIGNAL(toggled()) ); + connect ( _visible, SIGNAL(clicked()), this, SIGNAL(visibleToggled()) ); } - PaletteNamedItem* PaletteNamedItem::create ( const Name& name, bool checked ) + PaletteNamedItem* PaletteNamedItem::create ( const Name& name, bool visible ) { - PaletteNamedItem* item = new PaletteNamedItem ( name, checked ); + PaletteNamedItem* item = new PaletteNamedItem ( name, visible ); return item; } @@ -65,15 +65,15 @@ namespace Hurricane { } - bool PaletteNamedItem::isChecked () const + bool PaletteNamedItem::isItemVisible () const { - return _checkBox->isChecked (); + return _visible->isChecked (); } - void PaletteNamedItem::setChecked ( bool state ) + void PaletteNamedItem::setItemVisible ( bool state ) { - _checkBox->setChecked ( state ); + _visible->setChecked ( state ); } diff --git a/hurricane/src/hviewer/PaletteWidget.cpp b/hurricane/src/hviewer/PaletteWidget.cpp index 84359e56..561d685d 100644 --- a/hurricane/src/hviewer/PaletteWidget.cpp +++ b/hurricane/src/hviewer/PaletteWidget.cpp @@ -39,8 +39,9 @@ #include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/PaletteItem.h" -#include "hurricane/viewer/PaletteLayerItem.h" #include "hurricane/viewer/PaletteNamedItem.h" +#include "hurricane/viewer/PaletteLayerItem.h" +#include "hurricane/viewer/PaletteExtensionGoItem.h" #include "hurricane/viewer/PaletteWidget.h" @@ -145,7 +146,7 @@ namespace Hurricane { PaletteNamedItem* PaletteWidget::_createNamedItem ( const Name& name, bool checked ) { PaletteNamedItem* item = PaletteNamedItem::create ( name, checked ); - connect ( item, SIGNAL(toggled()), this, SIGNAL(paletteChanged()) ); + connect ( item, SIGNAL(visibleToggled()), this, SIGNAL(paletteChanged()) ); return item; } @@ -153,7 +154,15 @@ namespace Hurricane { PaletteLayerItem* PaletteWidget::_createLayerItem ( BasicLayer* layer, bool checked ) { PaletteLayerItem* item = PaletteLayerItem::create ( layer, checked ); - connect ( item, SIGNAL(toggled()), this, SIGNAL(paletteChanged()) ); + connect ( item, SIGNAL(visibleToggled()), this, SIGNAL(paletteChanged()) ); + return item; + } + + + PaletteExtensionGoItem* PaletteWidget::_createExtensionGoItem ( const Name& name, bool checked ) + { + PaletteExtensionGoItem* item = PaletteExtensionGoItem::create ( name ); + connect ( item, SIGNAL(visibleToggled()), this, SIGNAL(paletteChanged()) ); return item; } @@ -297,7 +306,7 @@ namespace Hurricane { gridBuffer.addSection ( _extensionGroup, Qt::AlignHCenter ); forEach ( ExtensionSlice*, extension, cell->getExtensionSlices() ) { - PaletteNamedItem* item = _createNamedItem ( (*extension)->getName(), false ); + PaletteExtensionGoItem* item = _createExtensionGoItem ( (*extension)->getName(), false ); gridBuffer.addWidget ( item ); _extensionGoItems [ item->getName() ] = item; } @@ -309,7 +318,17 @@ namespace Hurricane { { PaletteItem* item = find ( name ); if ( item ) - return item->isChecked (); + return item->isItemVisible (); + + return false; + } + + + bool PaletteWidget::isSelectable ( const Name& name ) const + { + PaletteItem* item = find ( name ); + if ( item ) + return item->isItemSelectable (); return false; } @@ -319,11 +338,11 @@ namespace Hurricane { { PaletteItems::iterator iitem = _layerItems.begin(); for ( ; iitem != _layerItems.end() ; iitem++ ) - iitem->second->setChecked ( true ); + iitem->second->setItemVisible ( true ); iitem = _extensionGoItems.begin(); for ( ; iitem != _extensionGoItems.end() ; iitem++ ) - iitem->second->setChecked ( true ); + iitem->second->setItemVisible ( true ); emit paletteChanged(); } @@ -333,11 +352,11 @@ namespace Hurricane { { PaletteItems::iterator iitem = _layerItems.begin(); for ( ; iitem != _layerItems.end() ; iitem++ ) - iitem->second->setChecked ( false ); + iitem->second->setItemVisible ( false ); iitem = _extensionGoItems.begin(); for ( ; iitem != _extensionGoItems.end() ; iitem++ ) - iitem->second->setChecked ( false ); + iitem->second->setItemVisible ( false ); emit paletteChanged(); } diff --git a/hurricane/src/hviewer/SelectCommand.cpp b/hurricane/src/hviewer/SelectCommand.cpp index 73ccb8f7..f0d6cbd9 100644 --- a/hurricane/src/hviewer/SelectCommand.cpp +++ b/hurricane/src/hviewer/SelectCommand.cpp @@ -76,10 +76,9 @@ namespace Hurricane { setDrawingEnabled ( true ); } else if ( event->modifiers() == Qt::ControlModifier ) { QRect selectArea ( event->pos() - QPoint(2,2), QSize(4,4) ); - forEach ( Occurrence, ioccurrence - , widget->getCell()->getOccurrencesUnder(widget->screenToDbuBox(selectArea)) ) { + forEach ( Occurrence, ioccurrence, widget->getOccurrencesUnder(selectArea) ) _selectionPopup->add ( *ioccurrence ); - } + _selectionPopup->updateLayout (); _selectionPopup->move ( event->globalPos() ); _selectionPopup->popup (); diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index 03a0ecc9..9a2e7e49 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -105,6 +105,8 @@ namespace Hurricane { inline bool showBoundaries () const; inline bool showSelection () const; inline bool cumulativeSelection () const; + inline Occurrences getOccurrencesUnder ( const QRect& ) const; + Occurrences getOccurrencesUnder ( const Box& ) const; inline set& getSelectorSet (); inline void setStartLevel ( int ); inline void setStopLevel ( int ); @@ -115,6 +117,8 @@ namespace Hurricane { inline float getScale () const; bool isDrawableLayer ( const Name& ); bool isDrawableExtension ( const Name& ); + bool isSelectable ( const Name& ) const; + bool isSelectable ( const Layer* ) const; void drawBox ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit ); void drawBox ( const Box& ); void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit ); @@ -491,6 +495,10 @@ namespace Hurricane { { return _selectors; } + Occurrences CellWidget::getOccurrencesUnder ( const QRect& area ) const + { return getOccurrencesUnder(screenToDbuBox(area)); } + + inline QPoint& CellWidget::getOffsetVA () { return _offsetVA; } diff --git a/hurricane/src/hviewer/hurricane/viewer/PaletteExtensionGoItem.h b/hurricane/src/hviewer/hurricane/viewer/PaletteExtensionGoItem.h index 204907b3..44bb8123 100644 --- a/hurricane/src/hviewer/hurricane/viewer/PaletteExtensionGoItem.h +++ b/hurricane/src/hviewer/hurricane/viewer/PaletteExtensionGoItem.h @@ -43,11 +43,14 @@ namespace Hurricane { public: static PaletteExtensionGoItem* create ( const Name& ); virtual const Name& getName () const; - virtual bool isChecked () const; - virtual void setChecked ( bool ); + virtual bool isItemVisible () const; + virtual bool isItemSelectable () const; + virtual void setItemVisible ( bool state ); + virtual void setItemSelectable ( bool state ); protected: - QCheckBox* _checkBox; + QCheckBox* _visible; + QCheckBox* _selectable; Name _name; protected: diff --git a/hurricane/src/hviewer/hurricane/viewer/PaletteItem.h b/hurricane/src/hviewer/hurricane/viewer/PaletteItem.h index 3cea93a7..e57b0920 100644 --- a/hurricane/src/hviewer/hurricane/viewer/PaletteItem.h +++ b/hurricane/src/hviewer/hurricane/viewer/PaletteItem.h @@ -69,16 +69,19 @@ namespace Hurricane { Q_OBJECT; public: - virtual const Name& getName () const = 0; - virtual bool isChecked () const = 0; - virtual void setChecked ( bool state ) = 0; + virtual const Name& getName () const = 0; + virtual bool isItemVisible () const = 0; + virtual bool isItemSelectable () const; + virtual void setItemVisible ( bool ) = 0; + virtual void setItemSelectable ( bool ); signals: - virtual void toggled (); + void visibleToggled (); + void selectableToggled (); protected: - PaletteItem (); - PaletteItem ( const PaletteItem& ); - PaletteItem& operator= ( const PaletteItem& ); + PaletteItem (); + PaletteItem ( const PaletteItem& ); + PaletteItem& operator= ( const PaletteItem& ); }; diff --git a/hurricane/src/hviewer/hurricane/viewer/PaletteLayerItem.h b/hurricane/src/hviewer/hurricane/viewer/PaletteLayerItem.h index 7ae5c5bd..540c0ecb 100644 --- a/hurricane/src/hviewer/hurricane/viewer/PaletteLayerItem.h +++ b/hurricane/src/hviewer/hurricane/viewer/PaletteLayerItem.h @@ -42,19 +42,22 @@ namespace Hurricane { Q_OBJECT; public: - static PaletteLayerItem* create ( BasicLayer*, bool checked=true ); - virtual const Name& getName () const; - virtual bool isChecked () const; - virtual void setChecked ( bool state ); - - protected: - BasicLayer* _basicLayer; - QCheckBox* _checkBox; - - protected: - PaletteLayerItem ( BasicLayer*, bool checked ); - PaletteLayerItem ( const PaletteLayerItem& ); - PaletteLayerItem& operator= ( const PaletteLayerItem& ); + static PaletteLayerItem* create ( BasicLayer*, bool visible=true ); + virtual const Name& getName () const; + virtual bool isItemVisible () const; + virtual bool isItemSelectable () const; + virtual void setItemVisible ( bool state ); + virtual void setItemSelectable ( bool state ); + + protected: + BasicLayer* _basicLayer; + QCheckBox* _visible; + QCheckBox* _selectable; + + protected: + PaletteLayerItem ( BasicLayer*, bool visible ); + PaletteLayerItem ( const PaletteLayerItem& ); + PaletteLayerItem& operator= ( const PaletteLayerItem& ); }; diff --git a/hurricane/src/hviewer/hurricane/viewer/PaletteNamedItem.h b/hurricane/src/hviewer/hurricane/viewer/PaletteNamedItem.h index b09fffb4..cf46cf91 100644 --- a/hurricane/src/hviewer/hurricane/viewer/PaletteNamedItem.h +++ b/hurricane/src/hviewer/hurricane/viewer/PaletteNamedItem.h @@ -41,17 +41,17 @@ namespace Hurricane { // Constructor. public: - static PaletteNamedItem* create ( const Name&, bool checked=true ); + static PaletteNamedItem* create ( const Name&, bool visible=true ); virtual const Name& getName () const; - virtual bool isChecked () const; - virtual void setChecked ( bool ); + virtual bool isItemVisible () const; + virtual void setItemVisible ( bool ); protected: - QCheckBox* _checkBox; + QCheckBox* _visible; Name _name; protected: - PaletteNamedItem ( const Name&, bool checked ); + PaletteNamedItem ( const Name&, bool visible ); PaletteNamedItem ( const PaletteNamedItem& ); PaletteNamedItem& operator= ( const PaletteNamedItem& ); }; diff --git a/hurricane/src/hviewer/hurricane/viewer/PaletteWidget.h b/hurricane/src/hviewer/hurricane/viewer/PaletteWidget.h index a3dc426a..0938571c 100644 --- a/hurricane/src/hviewer/hurricane/viewer/PaletteWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/PaletteWidget.h @@ -49,6 +49,7 @@ namespace Hurricane { class PaletteItem; class PaletteNamedItem; class PaletteLayerItem; + class PaletteExtensionGoItem; class PaletteWidget : public QScrollArea { @@ -60,6 +61,7 @@ namespace Hurricane { PaletteWidget ( QWidget* parent=NULL ); PaletteItem* find ( const Name& name ) const; bool isDrawable ( const Name& name ) const; + bool isSelectable ( const Name& name ) const; signals: void paletteChanged (); public slots: @@ -78,12 +80,13 @@ namespace Hurricane { QWidget* _extensionGroup; protected: - PaletteWidget ( const PaletteWidget& ); - PaletteWidget& operator= ( const PaletteWidget& ); - protected: - QWidget* _createGroupItem ( const Name& ); - PaletteNamedItem* _createNamedItem ( const Name&, bool checked=true ); - PaletteLayerItem* _createLayerItem ( BasicLayer*, bool checked=true ); + PaletteWidget ( const PaletteWidget& ); + PaletteWidget& operator= ( const PaletteWidget& ); + protected: + QWidget* _createGroupItem ( const Name& ); + PaletteNamedItem* _createNamedItem ( const Name&, bool checked=true ); + PaletteLayerItem* _createLayerItem ( BasicLayer*, bool checked=true ); + PaletteExtensionGoItem* _createExtensionGoItem ( const Name&, bool checked=true ); };