X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/561d4f45e60504cc9e041370dd908b002fe776a5..1df76ccc8673a2760af17b88ebfba4bfd7f5c11d:/AbstractBoxItem.cpp diff --git a/AbstractBoxItem.cpp b/AbstractBoxItem.cpp index c4cdae9..a05247f 100644 --- a/AbstractBoxItem.cpp +++ b/AbstractBoxItem.cpp @@ -8,6 +8,7 @@ #include "AbstractBlock.h" #include "GroupScene.h" +#include "GroupItem.h" #include "AbstractInterface.h" #include "ConnectedInterface.h" @@ -35,6 +36,7 @@ AbstractBoxItem:: AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispat selected = false; currentInterface = NULL; rstClkVisible = false; + wishboneVisible = false; setAcceptHoverEvents(true); @@ -63,7 +65,8 @@ AbstractBoxItem::AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, Q selected = false; currentInterface = NULL; rstClkVisible = false; - + wishboneVisible = false; + setAcceptHoverEvents(true); // NOTE : initInterfaces() is only called in subclasses @@ -83,6 +86,35 @@ bool AbstractBoxItem::isBoxItem() { bool AbstractBoxItem::isGroupItem() { return false; } +void AbstractBoxItem::setRstClkVisible(bool b) { + rstClkVisible = b; + foreach(InterfaceItem* ifaceItem, interfaces) { + if ((ifaceItem->refInter->getPurpose() == AbstractInterface::Clock) || + (ifaceItem->refInter->getPurpose() == AbstractInterface::Reset) ) { + ifaceItem->visible = b; + } + } + resetInterfacesPosition(); + updateGeometry(InterfaceMove); + update(); + getScene()->updateConnectionItemsShape(); + (getScene()->getGroupItem())->updateShape(); + +} + +void AbstractBoxItem::setWishboneVisible(bool b) { + wishboneVisible = b; + foreach(InterfaceItem* ifaceItem, interfaces) { + if (ifaceItem->refInter->getPurpose() == AbstractInterface::Wishbone) { + ifaceItem->visible = b; + } + } + resetInterfacesPosition(); + updateGeometry(InterfaceMove); + update(); + getScene()->updateConnectionItemsShape(); + (getScene()->getGroupItem())->updateShape(); +} void AbstractBoxItem::setRefBlock(AbstractBlock* _refBlock) { refBlock = _refBlock; @@ -96,18 +128,17 @@ void AbstractBoxItem::initInterfaces() { int orientation = Parameters::West; foreach(AbstractInterface *inter, refBlock->getInterfaces()){ - if(inter->getPurpose() != AbstractInterface::Wishbone){ - InterfaceItem *item; - if(inter->getDirection() == AbstractInterface::Input){ - orientation = Parameters::West; - } else if(inter->getDirection() == AbstractInterface::Output){ - orientation = Parameters::East; - } else if(inter->getDirection() == AbstractInterface::InOut){ - orientation = Parameters::North; - } - item = new InterfaceItem(0.0 , orientation, (ConnectedInterface *)inter, this, params); - interfaces.append(item); + + InterfaceItem *item; + if(inter->getDirection() == AbstractInterface::Input){ + orientation = Parameters::West; + } else if(inter->getDirection() == AbstractInterface::Output){ + orientation = Parameters::East; + } else if(inter->getDirection() == AbstractInterface::InOut){ + orientation = Parameters::North; } + item = new InterfaceItem(0.0 , orientation, (ConnectedInterface *)inter, this, params); + interfaces.append(item); } } @@ -155,7 +186,7 @@ void AbstractBoxItem::resetInterfacesPosition() { foreach(InterfaceItem* inter, interfaces) { // only data interfaces and if needed time and reset - if(inter->refInter->getPurpose() == AbstractInterface::Data || inter->getOwner()->isRstClkVisible()){ + if(inter->visible) { if(inter->getOrientation() == Parameters::North){ nbNorth++; } else if(inter->getOrientation() == Parameters::South){ @@ -170,7 +201,7 @@ void AbstractBoxItem::resetInterfacesPosition() { foreach(InterfaceItem* inter, interfaces) { - if(inter->refInter->getPurpose() == AbstractInterface::Data || inter->getOwner()->isRstClkVisible()){ + if(inter->visible){ if(inter->getOrientation() == Parameters::North){ positionRatio = cntNorth/(double)(nbNorth+1);