X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/e40a5399ec7887c2606f18575c809b0d05b09278..HEAD:/BoxItem.cpp diff --git a/BoxItem.cpp b/BoxItem.cpp index ae15002..f3bc8eb 100644 --- a/BoxItem.cpp +++ b/BoxItem.cpp @@ -207,6 +207,9 @@ BoxItem::~BoxItem() { } void BoxItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + + if (!visible) return; + QPen pen(Qt::black, 3); if(selected) pen.setColor(Qt::red); @@ -906,6 +909,12 @@ void BoxItem::loadFunctional(QDomElement funcElement) throw(Exception) { if(!ok) throw(Exception(PROJECTFILE_CORRUPTED)); int dimY = dimensionStr.at(1).toInt(&ok); if(!ok) throw(Exception(PROJECTFILE_CORRUPTED)); + + QString visStr = funcElement.attribute("visible","none"); + bool showItem = true; + if (visStr == "false") { + showItem = false; + } ReferenceBlock *referenceMd5 = NULL; ReferenceBlock *referenceXml = NULL; @@ -927,7 +936,7 @@ void BoxItem::loadFunctional(QDomElement funcElement) throw(Exception) { } GroupBlock* parentGroupBlock = AB_TO_GRP(((GroupItem *)parentItem())->getRefBlock()); - FunctionalBlock* functionalBlock = params->getGraph()->createFunctionalBlock(parentGroupBlock, reference); + FunctionalBlock* functionalBlock = params->getGraph()->createFunctionalBlock(parentGroupBlock, reference, false); /* NB: addFunctionalBlock creates all interfaces from the reference, which is annoying when reading bif_iface tags. Thus interface are all removed. */ @@ -958,7 +967,7 @@ void BoxItem::loadFunctional(QDomElement funcElement) throw(Exception) { } // recreate all (non-control) interfaces because of some may have a multiplicity>1 with several examplars - functionalBlock->removeAllInterfaces(); + //functionalBlock->removeAllInterfaces(); QDomNodeList interfaceNodes = funcElement.elementsByTagName("bif_iface"); // setting interfaces (user name, and for multiplicity>1 may be create some new ones) for(int i=0; isetOrientation(orientation); interfaceItem->setPositionRatio(position); } + setVisible(showItem); updateGeometry(Resize); } @@ -1032,6 +1042,9 @@ void BoxItem::save(QXmlStreamWriter &writer) { writer.writeAttribute("position",attrPos); QString attrDim = QString::number(getWidth()).append(",").append(QString::number(getHeight())); writer.writeAttribute("dimension",attrDim); + if (!isVisible()) { + writer.writeAttribute("visible","false"); + } writer.writeStartElement("bif_parameters"); foreach(BlockParameter *param,refBlock->getParameters()){ @@ -1054,7 +1067,7 @@ void BoxItem::save(QXmlStreamWriter &writer) { writer.writeAttribute("id",QString::number(inter->getId())); writer.writeAttribute("name",inter->getName()); - writer.writeAttribute("ref_name",inter->refInter->getName()); + writer.writeAttribute("ref_name",inter->getReferenceName()); writer.writeAttribute("orientation",inter->getStrOrientation()); writer.writeAttribute("position",QString::number(inter->getPositionRatio()));