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

Private GIT Repository
added impl xsd + patterns in impls
[blast.git] / InterfaceItem.cpp
index 552e15989b990aa9257d362333c66ccfe4cefc9e..7c384d286709e06039ea3d6f909e9dc8f7828df7 100644 (file)
@@ -19,10 +19,9 @@ InterfaceItem::InterfaceItem(double _position,
   // CAUTION : the owner must add explicitely this item to its interface, calling addInterface()
   owner = _owner;
   params = _params;
   // CAUTION : the owner must add explicitely this item to its interface, calling addInterface()
   owner = _owner;
   params = _params;
-  selected = false;
-  name = refInter->getName();
+  selected = false;  
   QFontMetrics fmName(params->defaultIfaceFont);
   QFontMetrics fmName(params->defaultIfaceFont);
-  nameWidth = fmName.width(name);
+  nameWidth = fmName.width(refInter->getName());
   nameHeight = fmName.height();
   // by default, only data interface are visible
   if (refInter->getPurpose() == AbstractInterface::Data) {
   nameHeight = fmName.height();
   // by default, only data interface are visible
   if (refInter->getPurpose() == AbstractInterface::Data) {
@@ -42,6 +41,10 @@ InterfaceItem::InterfaceItem(){
   this->id = counter++;
 }
 
   this->id = counter++;
 }
 
+QString InterfaceItem::getName() {
+  return refInter->getName();
+}
+
 /* boundingRect() : give the bounding rect in the blockitem coord. system */
 QRectF InterfaceItem::boundingRect() const {
 
 /* boundingRect() : give the bounding rect in the blockitem coord. system */
 QRectF InterfaceItem::boundingRect() const {
 
@@ -82,11 +85,8 @@ void InterfaceItem::paint(QPainter *painter) {
 
     if(selected) {
       painter->setPen(QPen(Qt::red,2));
 
     if(selected) {
       painter->setPen(QPen(Qt::red,2));
-    }
-    else if(refInter->getLevel() == AbstractInterface::Basic) {
-      painter->setPen(QPen(Qt::darkCyan,1));
-    }
-    else if(refInter->getLevel() == AbstractInterface::Top) {
+    }    
+    else  {
       painter->setPen(QPen(Qt::black,1));
     }
 
       painter->setPen(QPen(Qt::black,1));
     }
 
@@ -364,11 +364,11 @@ void InterfaceItem::unconnectTo(InterfaceItem *iface)
     iface->refInter->connectFrom(NULL);
   }
   if(iface->refInter->getConnectedTo().contains(refInter)){
     iface->refInter->connectFrom(NULL);
   }
   if(iface->refInter->getConnectedTo().contains(refInter)){
-    cout << "abnormal case while removing iface conn from " << qPrintable(name) << " to " << qPrintable(iface->name) << endl;
+    cout << "abnormal case while removing iface conn from " << qPrintable(refInter->getName()) << " to " << qPrintable(iface->refInter->getName()) << endl;
     iface->refInter->removeConnectedTo(refInter);
   }
   if(refInter->getConnectedFrom() == iface->refInter) {
     iface->refInter->removeConnectedTo(refInter);
   }
   if(refInter->getConnectedFrom() == iface->refInter) {
-    cout << "abnormal case while removing iface conn from " << qPrintable(name) << " to " << qPrintable(iface->name) << endl;
+    cout << "abnormal case while removing iface conn from " << qPrintable(refInter->getName()) << " to " << qPrintable(iface->refInter->getName()) << endl;
     refInter->connectFrom(NULL);
   }
   if(refInter->getConnectedTo().contains(iface->refInter)){
     refInter->connectFrom(NULL);
   }
   if(refInter->getConnectedTo().contains(iface->refInter)){