]> AND Private Git Repository - blast.git/blobdiff - BoxItem.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
finished testbench generation
[blast.git] / BoxItem.cpp
index ae15002120d4596156879144c449e905b5dcc3f4..f3bc8eb554ec930df8b72d9a4ec5a58361fb352b 100644 (file)
@@ -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; i<interfaceNodes.length(); i++) {
@@ -1017,6 +1026,7 @@ void BoxItem::loadFunctional(QDomElement funcElement) throw(Exception) {
     interfaceItem->setOrientation(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()));