* ./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.
This commit is contained in:
parent
a23a682c64
commit
8845533c25
|
@ -30,21 +30,26 @@ MACRO(SET_LIBRARIES_PATH configname library)
|
||||||
ENDIF(NOT ${library}_INCLUDE_PATH)
|
ENDIF(NOT ${library}_INCLUDE_PATH)
|
||||||
ENDMACRO ( SET_LIBRARIES_PATH )
|
ENDMACRO ( SET_LIBRARIES_PATH )
|
||||||
|
|
||||||
MACRO(HURRICANE_CHECK_LIBRARIES package)
|
MACRO(HURRICANE_CHECK_LIBRARIES)
|
||||||
IF(${package}_FOUND OR ${package}_STATIC_FOUND)
|
IF(ARGC LESS 2)
|
||||||
IF(NOT ${package}_FIND_QUIETLY)
|
SET(REQUIRED ${argv0}_FIND_REQUIRED)
|
||||||
IF(${package}_FOUND)
|
ELSE(ARGC LESS 2)
|
||||||
MESSAGE(STATUS "Found ${package} : ${${package}_LIBRARIES}")
|
SET(REQUIRED ${argv1})
|
||||||
ENDIF(${package}_FOUND)
|
ENDIF(ARGC LESS 2)
|
||||||
IF(${package}_STATIC_FOUND)
|
IF(${argv0}_FOUND OR ${argv0}_STATIC_FOUND)
|
||||||
MESSAGE(STATUS "Found ${package} (static): ${${package}_STATIC_LIBRARIES}")
|
IF(NOT ${argv0}_FIND_QUIETLY)
|
||||||
ENDIF(${package}_STATIC_FOUND)
|
IF(${argv0}_FOUND)
|
||||||
ENDIF(NOT ${package}_FIND_QUIETLY)
|
MESSAGE(STATUS "Found ${argv0} : ${${argv0}_LIBRARIES}")
|
||||||
ELSE(${package}_FOUND OR ${package}_STATIC_FOUND)
|
ENDIF(${argv0}_FOUND)
|
||||||
IF(${package}_FIND_REQUIRED)
|
IF(${argv0}_STATIC_FOUND)
|
||||||
MESSAGE(FATAL_ERROR "${package} was not found. ${${package}_DIR_MESSAGE}")
|
MESSAGE(STATUS "Found ${argv0} (static): ${${argv0}_STATIC_LIBRARIES}")
|
||||||
ENDIF(${package}_FIND_REQUIRED)
|
ENDIF(${argv0}_STATIC_FOUND)
|
||||||
ENDIF(${package}_FOUND OR ${package}_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)
|
ENDMACRO(HURRICANE_CHECK_LIBRARIES)
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,15 +92,15 @@ IF(UNIX)
|
||||||
DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}"
|
DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}"
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PATH(HURRICANE_GRAPHICAL_INCLUDE_PATH
|
FIND_PATH(HURRICANE_VIEWER_INCLUDE_PATH
|
||||||
NAMES hurricane/viewer/CellViewer.h hurricane/viewer/HInspectorWidget.h
|
NAMES hurricane/viewer/CellWidget.h
|
||||||
PATHS ${HURRICANE_DIR_SEARCH}
|
PATHS ${HURRICANE_DIR_SEARCH}
|
||||||
PATH_SUFFIXES include
|
PATH_SUFFIXES include
|
||||||
# Help the user find it if we cannot.
|
# Help the user find it if we cannot.
|
||||||
DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}"
|
DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}"
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(HURRICANE_GRAPHICAL_LIBRARY_PATH
|
FIND_LIBRARY(HURRICANE_VIEWER_LIBRARY_PATH
|
||||||
NAMES hviewer
|
NAMES hviewer
|
||||||
PATHS ${HURRICANE_DIR_SEARCH}
|
PATHS ${HURRICANE_DIR_SEARCH}
|
||||||
PATH_SUFFIXES lib
|
PATH_SUFFIXES lib
|
||||||
|
@ -103,7 +108,7 @@ IF(UNIX)
|
||||||
DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}"
|
DOC "${HURRICANE_LIBRARY_PATH_DESCRIPTION}"
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(HURRICANE_GRAPHICAL_STATIC_LIBRARY_PATH
|
FIND_LIBRARY(HURRICANE_VIEWER_STATIC_LIBRARY_PATH
|
||||||
NAMES hviewer-static
|
NAMES hviewer-static
|
||||||
PATHS ${HURRICANE_DIR_SEARCH}
|
PATHS ${HURRICANE_DIR_SEARCH}
|
||||||
PATH_SUFFIXES lib
|
PATH_SUFFIXES lib
|
||||||
|
@ -131,6 +136,8 @@ IF(UNIX)
|
||||||
SET_LIBRARIES_PATH(HURRICANE_GRAPHICAL HURRICANE_VIEWER)
|
SET_LIBRARIES_PATH(HURRICANE_GRAPHICAL HURRICANE_VIEWER)
|
||||||
SET_LIBRARIES_PATH(HURRICANE_PYTHON HURRICANE_PYTHON)
|
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)
|
ENDIF(UNIX)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
set ( mocincludes hurricane/viewer/PaletteItem.h
|
set ( mocincludes hurricane/viewer/PaletteItem.h
|
||||||
hurricane/viewer/PaletteNamedItem.h
|
hurricane/viewer/PaletteNamedItem.h
|
||||||
hurricane/viewer/PaletteLayerItem.h
|
hurricane/viewer/PaletteLayerItem.h
|
||||||
|
hurricane/viewer/PaletteExtensionGoItem.h
|
||||||
hurricane/viewer/PaletteWidget.h
|
hurricane/viewer/PaletteWidget.h
|
||||||
hurricane/viewer/GraphicsWidget.h
|
hurricane/viewer/GraphicsWidget.h
|
||||||
hurricane/viewer/DynamicLabel.h
|
hurricane/viewer/DynamicLabel.h
|
||||||
|
@ -59,6 +60,7 @@
|
||||||
PaletteItem.cpp
|
PaletteItem.cpp
|
||||||
PaletteNamedItem.cpp
|
PaletteNamedItem.cpp
|
||||||
PaletteLayerItem.cpp
|
PaletteLayerItem.cpp
|
||||||
|
PaletteExtensionGoItem.cpp
|
||||||
PaletteWidget.cpp
|
PaletteWidget.cpp
|
||||||
DynamicLabel.cpp
|
DynamicLabel.cpp
|
||||||
MousePositionWidget.cpp
|
MousePositionWidget.cpp
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "hurricane/Contact.h"
|
#include "hurricane/Contact.h"
|
||||||
#include "hurricane/Pad.h"
|
#include "hurricane/Pad.h"
|
||||||
#include "hurricane/RoutingPad.h"
|
#include "hurricane/RoutingPad.h"
|
||||||
|
#include "hurricane/ExtensionGo.h"
|
||||||
|
|
||||||
#include "hurricane/viewer/Graphics.h"
|
#include "hurricane/viewer/Graphics.h"
|
||||||
#include "hurricane/viewer/PaletteItem.h"
|
#include "hurricane/viewer/PaletteItem.h"
|
||||||
|
@ -55,6 +56,75 @@
|
||||||
namespace Hurricane {
|
namespace Hurricane {
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Collections.
|
||||||
|
|
||||||
|
|
||||||
|
typedef Hurricane::Filter<Occurrence> OccurrenceHF;
|
||||||
|
typedef Hurricane::Locator<Occurrence> OccurrenceHL;
|
||||||
|
typedef Hurricane::Collection<Occurrence> 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<ExtensionGo*>(entity);
|
||||||
|
if ( eGo )
|
||||||
|
return _cellWidget->isSelectable ( eGo->getName() );
|
||||||
|
|
||||||
|
Component* component = dynamic_cast<Component*>(entity);
|
||||||
|
if ( component ) {
|
||||||
|
return _cellWidget->isSelectable ( component->getLayer() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string Occurrences_IsSelectable::_getString () const
|
||||||
|
{
|
||||||
|
return "<Occurrences_IsSelectable>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Class : "Hurricane::CellWidget::Spot".
|
// Class : "Hurricane::CellWidget::Spot".
|
||||||
|
|
||||||
|
@ -778,7 +848,7 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
PaletteItem* item = (_palette) ? _palette->find(layerName) : NULL;
|
PaletteItem* item = (_palette) ? _palette->find(layerName) : NULL;
|
||||||
|
|
||||||
return (!item || item->isChecked())
|
return (!item || item->isItemVisible())
|
||||||
&& ( Graphics::getThreshold(layerName)/DbU::lambda(1.0) < _scale );
|
&& ( Graphics::getThreshold(layerName)/DbU::lambda(1.0) < _scale );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,7 +857,27 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
PaletteItem* item = (_palette) ? _palette->find(extensionName) : NULL;
|
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 )
|
void CellWidget::select ( const Net* net, bool delayRedraw )
|
||||||
{
|
{
|
||||||
++_delaySelectionChanged;
|
++_delaySelectionChanged;
|
||||||
|
@ -1434,7 +1530,7 @@ namespace Hurricane {
|
||||||
|
|
||||||
void CellWidget::_selectOccurrencesUnder ( Box selectArea )
|
void CellWidget::_selectOccurrencesUnder ( Box selectArea )
|
||||||
{
|
{
|
||||||
forEach ( Occurrence, ioccurrence, _cell->getOccurrencesUnder(selectArea) )
|
forEach ( Occurrence, ioccurrence, getOccurrencesUnder(selectArea) )
|
||||||
select ( *ioccurrence );
|
select ( *ioccurrence );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ namespace Hurricane {
|
||||||
|
|
||||||
PaletteExtensionGoItem::PaletteExtensionGoItem ( const Name& name )
|
PaletteExtensionGoItem::PaletteExtensionGoItem ( const Name& name )
|
||||||
: PaletteItem()
|
: PaletteItem()
|
||||||
|
, _visible(NULL)
|
||||||
|
, _selectable(NULL)
|
||||||
, _name(name)
|
, _name(name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -52,15 +54,23 @@ namespace Hurricane {
|
||||||
QHBoxLayout* layout = new QHBoxLayout ();
|
QHBoxLayout* layout = new QHBoxLayout ();
|
||||||
layout->setContentsMargins ( 0, 0, 0, 0 );
|
layout->setContentsMargins ( 0, 0, 0, 0 );
|
||||||
|
|
||||||
_checkBox = new QCheckBox ( this );
|
_visible = new QCheckBox ( this );
|
||||||
_checkBox->setChecked ( false );
|
_visible->setChecked ( false );
|
||||||
_checkBox->setText ( getString(getName()).c_str() );
|
_visible->setText ( getString(getName()).c_str() );
|
||||||
_checkBox->setFont ( Graphics::getFixedFont() );
|
_visible->setFont ( Graphics::getFixedFont() );
|
||||||
layout->addWidget ( _checkBox );
|
|
||||||
|
|
||||||
|
_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 );
|
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,4 +78,14 @@ namespace Hurricane {
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
bool PaletteItem::isItemSelectable () const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PaletteItem::setItemSelectable ( bool )
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
} // End of Hurricane namespace.
|
} // End of Hurricane namespace.
|
||||||
|
|
|
@ -35,30 +35,40 @@
|
||||||
namespace Hurricane {
|
namespace Hurricane {
|
||||||
|
|
||||||
|
|
||||||
PaletteLayerItem::PaletteLayerItem ( BasicLayer* basicLayer, bool checked )
|
PaletteLayerItem::PaletteLayerItem ( BasicLayer* basicLayer, bool visible )
|
||||||
: PaletteItem()
|
: PaletteItem()
|
||||||
, _basicLayer(basicLayer)
|
, _basicLayer(basicLayer)
|
||||||
|
, _visible (new QCheckBox())
|
||||||
|
, _selectable(new QCheckBox())
|
||||||
{
|
{
|
||||||
QHBoxLayout* layout = new QHBoxLayout ();
|
QHBoxLayout* layout = new QHBoxLayout ();
|
||||||
layout->setContentsMargins ( 0, 0, 0, 0 );
|
layout->setContentsMargins ( 0, 0, 0, 0 );
|
||||||
|
|
||||||
layout->addWidget ( new DrawingStyleSample(this) );
|
layout->addWidget ( new DrawingStyleSample(this) );
|
||||||
|
|
||||||
_checkBox = new QCheckBox ( this );
|
_visible->setChecked ( visible );
|
||||||
_checkBox->setChecked ( checked );
|
_visible->setText ( getString(getName()).c_str() );
|
||||||
_checkBox->setText ( getString(getName()).c_str() );
|
_visible->setFont ( Graphics::getFixedFont() );
|
||||||
_checkBox->setFont ( Graphics::getFixedFont() );
|
|
||||||
layout->addWidget ( _checkBox );
|
_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 );
|
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;
|
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,28 +33,28 @@
|
||||||
namespace Hurricane {
|
namespace Hurricane {
|
||||||
|
|
||||||
|
|
||||||
PaletteNamedItem::PaletteNamedItem ( const Name& name, bool checked )
|
PaletteNamedItem::PaletteNamedItem ( const Name& name, bool visible )
|
||||||
: PaletteItem()
|
: PaletteItem()
|
||||||
, _name(name)
|
, _visible (new QCheckBox(this))
|
||||||
|
, _name (name)
|
||||||
{
|
{
|
||||||
QHBoxLayout* layout = new QHBoxLayout ();
|
QHBoxLayout* layout = new QHBoxLayout ();
|
||||||
layout->setContentsMargins ( 0, 0, 0, 0 );
|
layout->setContentsMargins ( 0, 0, 0, 0 );
|
||||||
|
|
||||||
_checkBox = new QCheckBox ( this );
|
_visible->setChecked ( visible );
|
||||||
_checkBox->setChecked ( checked );
|
_visible->setText ( getString(getName()).c_str() );
|
||||||
_checkBox->setText ( getString(getName()).c_str() );
|
_visible->setFont ( Graphics::getFixedFont() );
|
||||||
_checkBox->setFont ( Graphics::getFixedFont() );
|
layout->addWidget ( _visible );
|
||||||
layout->addWidget ( _checkBox );
|
|
||||||
|
|
||||||
setLayout ( layout );
|
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;
|
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,9 @@
|
||||||
|
|
||||||
#include "hurricane/viewer/Graphics.h"
|
#include "hurricane/viewer/Graphics.h"
|
||||||
#include "hurricane/viewer/PaletteItem.h"
|
#include "hurricane/viewer/PaletteItem.h"
|
||||||
#include "hurricane/viewer/PaletteLayerItem.h"
|
|
||||||
#include "hurricane/viewer/PaletteNamedItem.h"
|
#include "hurricane/viewer/PaletteNamedItem.h"
|
||||||
|
#include "hurricane/viewer/PaletteLayerItem.h"
|
||||||
|
#include "hurricane/viewer/PaletteExtensionGoItem.h"
|
||||||
#include "hurricane/viewer/PaletteWidget.h"
|
#include "hurricane/viewer/PaletteWidget.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,7 +146,7 @@ namespace Hurricane {
|
||||||
PaletteNamedItem* PaletteWidget::_createNamedItem ( const Name& name, bool checked )
|
PaletteNamedItem* PaletteWidget::_createNamedItem ( const Name& name, bool checked )
|
||||||
{
|
{
|
||||||
PaletteNamedItem* item = PaletteNamedItem::create ( name, checked );
|
PaletteNamedItem* item = PaletteNamedItem::create ( name, checked );
|
||||||
connect ( item, SIGNAL(toggled()), this, SIGNAL(paletteChanged()) );
|
connect ( item, SIGNAL(visibleToggled()), this, SIGNAL(paletteChanged()) );
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +154,15 @@ namespace Hurricane {
|
||||||
PaletteLayerItem* PaletteWidget::_createLayerItem ( BasicLayer* layer, bool checked )
|
PaletteLayerItem* PaletteWidget::_createLayerItem ( BasicLayer* layer, bool checked )
|
||||||
{
|
{
|
||||||
PaletteLayerItem* item = PaletteLayerItem::create ( layer, 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;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +306,7 @@ namespace Hurricane {
|
||||||
gridBuffer.addSection ( _extensionGroup, Qt::AlignHCenter );
|
gridBuffer.addSection ( _extensionGroup, Qt::AlignHCenter );
|
||||||
|
|
||||||
forEach ( ExtensionSlice*, extension, cell->getExtensionSlices() ) {
|
forEach ( ExtensionSlice*, extension, cell->getExtensionSlices() ) {
|
||||||
PaletteNamedItem* item = _createNamedItem ( (*extension)->getName(), false );
|
PaletteExtensionGoItem* item = _createExtensionGoItem ( (*extension)->getName(), false );
|
||||||
gridBuffer.addWidget ( item );
|
gridBuffer.addWidget ( item );
|
||||||
_extensionGoItems [ item->getName() ] = item;
|
_extensionGoItems [ item->getName() ] = item;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +318,17 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
PaletteItem* item = find ( name );
|
PaletteItem* item = find ( name );
|
||||||
if ( item )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -319,11 +338,11 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
PaletteItems::iterator iitem = _layerItems.begin();
|
PaletteItems::iterator iitem = _layerItems.begin();
|
||||||
for ( ; iitem != _layerItems.end() ; iitem++ )
|
for ( ; iitem != _layerItems.end() ; iitem++ )
|
||||||
iitem->second->setChecked ( true );
|
iitem->second->setItemVisible ( true );
|
||||||
|
|
||||||
iitem = _extensionGoItems.begin();
|
iitem = _extensionGoItems.begin();
|
||||||
for ( ; iitem != _extensionGoItems.end() ; iitem++ )
|
for ( ; iitem != _extensionGoItems.end() ; iitem++ )
|
||||||
iitem->second->setChecked ( true );
|
iitem->second->setItemVisible ( true );
|
||||||
|
|
||||||
emit paletteChanged();
|
emit paletteChanged();
|
||||||
}
|
}
|
||||||
|
@ -333,11 +352,11 @@ namespace Hurricane {
|
||||||
{
|
{
|
||||||
PaletteItems::iterator iitem = _layerItems.begin();
|
PaletteItems::iterator iitem = _layerItems.begin();
|
||||||
for ( ; iitem != _layerItems.end() ; iitem++ )
|
for ( ; iitem != _layerItems.end() ; iitem++ )
|
||||||
iitem->second->setChecked ( false );
|
iitem->second->setItemVisible ( false );
|
||||||
|
|
||||||
iitem = _extensionGoItems.begin();
|
iitem = _extensionGoItems.begin();
|
||||||
for ( ; iitem != _extensionGoItems.end() ; iitem++ )
|
for ( ; iitem != _extensionGoItems.end() ; iitem++ )
|
||||||
iitem->second->setChecked ( false );
|
iitem->second->setItemVisible ( false );
|
||||||
|
|
||||||
emit paletteChanged();
|
emit paletteChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,10 +76,9 @@ namespace Hurricane {
|
||||||
setDrawingEnabled ( true );
|
setDrawingEnabled ( true );
|
||||||
} else if ( event->modifiers() == Qt::ControlModifier ) {
|
} else if ( event->modifiers() == Qt::ControlModifier ) {
|
||||||
QRect selectArea ( event->pos() - QPoint(2,2), QSize(4,4) );
|
QRect selectArea ( event->pos() - QPoint(2,2), QSize(4,4) );
|
||||||
forEach ( Occurrence, ioccurrence
|
forEach ( Occurrence, ioccurrence, widget->getOccurrencesUnder(selectArea) )
|
||||||
, widget->getCell()->getOccurrencesUnder(widget->screenToDbuBox(selectArea)) ) {
|
|
||||||
_selectionPopup->add ( *ioccurrence );
|
_selectionPopup->add ( *ioccurrence );
|
||||||
}
|
|
||||||
_selectionPopup->updateLayout ();
|
_selectionPopup->updateLayout ();
|
||||||
_selectionPopup->move ( event->globalPos() );
|
_selectionPopup->move ( event->globalPos() );
|
||||||
_selectionPopup->popup ();
|
_selectionPopup->popup ();
|
||||||
|
|
|
@ -105,6 +105,8 @@ namespace Hurricane {
|
||||||
inline bool showBoundaries () const;
|
inline bool showBoundaries () const;
|
||||||
inline bool showSelection () const;
|
inline bool showSelection () const;
|
||||||
inline bool cumulativeSelection () const;
|
inline bool cumulativeSelection () const;
|
||||||
|
inline Occurrences getOccurrencesUnder ( const QRect& ) const;
|
||||||
|
Occurrences getOccurrencesUnder ( const Box& ) const;
|
||||||
inline set<Selector*>& getSelectorSet ();
|
inline set<Selector*>& getSelectorSet ();
|
||||||
inline void setStartLevel ( int );
|
inline void setStartLevel ( int );
|
||||||
inline void setStopLevel ( int );
|
inline void setStopLevel ( int );
|
||||||
|
@ -115,6 +117,8 @@ namespace Hurricane {
|
||||||
inline float getScale () const;
|
inline float getScale () const;
|
||||||
bool isDrawableLayer ( const Name& );
|
bool isDrawableLayer ( const Name& );
|
||||||
bool isDrawableExtension ( 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 ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit );
|
||||||
void drawBox ( const Box& );
|
void drawBox ( const Box& );
|
||||||
void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit );
|
void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit );
|
||||||
|
@ -491,6 +495,10 @@ namespace Hurricane {
|
||||||
{ return _selectors; }
|
{ return _selectors; }
|
||||||
|
|
||||||
|
|
||||||
|
Occurrences CellWidget::getOccurrencesUnder ( const QRect& area ) const
|
||||||
|
{ return getOccurrencesUnder(screenToDbuBox(area)); }
|
||||||
|
|
||||||
|
|
||||||
inline QPoint& CellWidget::getOffsetVA ()
|
inline QPoint& CellWidget::getOffsetVA ()
|
||||||
{ return _offsetVA; }
|
{ return _offsetVA; }
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,14 @@ namespace Hurricane {
|
||||||
public:
|
public:
|
||||||
static PaletteExtensionGoItem* create ( const Name& );
|
static PaletteExtensionGoItem* create ( const Name& );
|
||||||
virtual const Name& getName () const;
|
virtual const Name& getName () const;
|
||||||
virtual bool isChecked () const;
|
virtual bool isItemVisible () const;
|
||||||
virtual void setChecked ( bool );
|
virtual bool isItemSelectable () const;
|
||||||
|
virtual void setItemVisible ( bool state );
|
||||||
|
virtual void setItemSelectable ( bool state );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QCheckBox* _checkBox;
|
QCheckBox* _visible;
|
||||||
|
QCheckBox* _selectable;
|
||||||
Name _name;
|
Name _name;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -69,16 +69,19 @@ namespace Hurricane {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual const Name& getName () const = 0;
|
virtual const Name& getName () const = 0;
|
||||||
virtual bool isChecked () const = 0;
|
virtual bool isItemVisible () const = 0;
|
||||||
virtual void setChecked ( bool state ) = 0;
|
virtual bool isItemSelectable () const;
|
||||||
|
virtual void setItemVisible ( bool ) = 0;
|
||||||
|
virtual void setItemSelectable ( bool );
|
||||||
signals:
|
signals:
|
||||||
virtual void toggled ();
|
void visibleToggled ();
|
||||||
|
void selectableToggled ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PaletteItem ();
|
PaletteItem ();
|
||||||
PaletteItem ( const PaletteItem& );
|
PaletteItem ( const PaletteItem& );
|
||||||
PaletteItem& operator= ( const PaletteItem& );
|
PaletteItem& operator= ( const PaletteItem& );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,19 +42,22 @@ namespace Hurricane {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static PaletteLayerItem* create ( BasicLayer*, bool checked=true );
|
static PaletteLayerItem* create ( BasicLayer*, bool visible=true );
|
||||||
virtual const Name& getName () const;
|
virtual const Name& getName () const;
|
||||||
virtual bool isChecked () const;
|
virtual bool isItemVisible () const;
|
||||||
virtual void setChecked ( bool state );
|
virtual bool isItemSelectable () const;
|
||||||
|
virtual void setItemVisible ( bool state );
|
||||||
protected:
|
virtual void setItemSelectable ( bool state );
|
||||||
BasicLayer* _basicLayer;
|
|
||||||
QCheckBox* _checkBox;
|
protected:
|
||||||
|
BasicLayer* _basicLayer;
|
||||||
protected:
|
QCheckBox* _visible;
|
||||||
PaletteLayerItem ( BasicLayer*, bool checked );
|
QCheckBox* _selectable;
|
||||||
PaletteLayerItem ( const PaletteLayerItem& );
|
|
||||||
PaletteLayerItem& operator= ( const PaletteLayerItem& );
|
protected:
|
||||||
|
PaletteLayerItem ( BasicLayer*, bool visible );
|
||||||
|
PaletteLayerItem ( const PaletteLayerItem& );
|
||||||
|
PaletteLayerItem& operator= ( const PaletteLayerItem& );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,17 +41,17 @@ namespace Hurricane {
|
||||||
|
|
||||||
// Constructor.
|
// Constructor.
|
||||||
public:
|
public:
|
||||||
static PaletteNamedItem* create ( const Name&, bool checked=true );
|
static PaletteNamedItem* create ( const Name&, bool visible=true );
|
||||||
virtual const Name& getName () const;
|
virtual const Name& getName () const;
|
||||||
virtual bool isChecked () const;
|
virtual bool isItemVisible () const;
|
||||||
virtual void setChecked ( bool );
|
virtual void setItemVisible ( bool );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QCheckBox* _checkBox;
|
QCheckBox* _visible;
|
||||||
Name _name;
|
Name _name;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PaletteNamedItem ( const Name&, bool checked );
|
PaletteNamedItem ( const Name&, bool visible );
|
||||||
PaletteNamedItem ( const PaletteNamedItem& );
|
PaletteNamedItem ( const PaletteNamedItem& );
|
||||||
PaletteNamedItem& operator= ( const PaletteNamedItem& );
|
PaletteNamedItem& operator= ( const PaletteNamedItem& );
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace Hurricane {
|
||||||
class PaletteItem;
|
class PaletteItem;
|
||||||
class PaletteNamedItem;
|
class PaletteNamedItem;
|
||||||
class PaletteLayerItem;
|
class PaletteLayerItem;
|
||||||
|
class PaletteExtensionGoItem;
|
||||||
|
|
||||||
|
|
||||||
class PaletteWidget : public QScrollArea {
|
class PaletteWidget : public QScrollArea {
|
||||||
|
@ -60,6 +61,7 @@ namespace Hurricane {
|
||||||
PaletteWidget ( QWidget* parent=NULL );
|
PaletteWidget ( QWidget* parent=NULL );
|
||||||
PaletteItem* find ( const Name& name ) const;
|
PaletteItem* find ( const Name& name ) const;
|
||||||
bool isDrawable ( const Name& name ) const;
|
bool isDrawable ( const Name& name ) const;
|
||||||
|
bool isSelectable ( const Name& name ) const;
|
||||||
signals:
|
signals:
|
||||||
void paletteChanged ();
|
void paletteChanged ();
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -78,12 +80,13 @@ namespace Hurricane {
|
||||||
QWidget* _extensionGroup;
|
QWidget* _extensionGroup;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PaletteWidget ( const PaletteWidget& );
|
PaletteWidget ( const PaletteWidget& );
|
||||||
PaletteWidget& operator= ( const PaletteWidget& );
|
PaletteWidget& operator= ( const PaletteWidget& );
|
||||||
protected:
|
protected:
|
||||||
QWidget* _createGroupItem ( const Name& );
|
QWidget* _createGroupItem ( const Name& );
|
||||||
PaletteNamedItem* _createNamedItem ( const Name&, bool checked=true );
|
PaletteNamedItem* _createNamedItem ( const Name&, bool checked=true );
|
||||||
PaletteLayerItem* _createLayerItem ( BasicLayer*, bool checked=true );
|
PaletteLayerItem* _createLayerItem ( BasicLayer*, bool checked=true );
|
||||||
|
PaletteExtensionGoItem* _createExtensionGoItem ( const Name&, bool checked=true );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue