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

Private GIT Repository
finished conn mode of library
[blast.git] / InterfaceItem.cpp
index ff5f5c6142d204d6b18b4b5d7df9d839c981beef..1ef3aae76b5c3de65eeb940cb3dc78c958da847e 100644 (file)
@@ -11,7 +11,7 @@ InterfaceItem::InterfaceItem(double _position,
                              int _orientation,
                              ConnectedInterface *_refInter,
                              AbstractBoxItem* _owner,
-                             Parameters* _params) {
+                             Parameters* _params, bool forceVisible) {
   positionRatio = _position;
   orientation = _orientation;
   refInter = _refInter;
@@ -24,7 +24,7 @@ InterfaceItem::InterfaceItem(double _position,
   nameWidth = fmName.width(refInter->getName());
   nameHeight = fmName.height();
   // by default, only data interface are visible
-  if (refInter->getPurpose() == AbstractInterface::Data) {
+  if ((forceVisible) || (refInter->getPurpose() == AbstractInterface::Data)) {
     visible = true;
   }
   else {
@@ -118,16 +118,29 @@ void InterfaceItem::paint(QPainter *painter) {
     }
 
     // draw arrows
-    if(refInter->getDirection() == AbstractInterface::Input) {
-      painter->drawPath(params->inArrow);
+    if ( (refInter->getPurpose() == AbstractInterface::Clock) || (refInter->getPurpose() == AbstractInterface::Reset)) {
+      painter->drawPath(params->clkrstArrow);
+    }
+    else if(refInter->getDirection() == AbstractInterface::Input) {
+      painter->drawPath(params->dataArrowIn);
     }
     else if(refInter->getDirection() == AbstractInterface::Output) {
-      painter->drawPath(params->outArrow);
+      painter->drawPath(params->dataArrowOut);
     } else if(refInter->getDirection() == AbstractInterface::InOut) {
-      painter->drawPath(params->inArrow);
-      painter->drawPath(params->outArrow);
+      painter->drawPath(params->dataArrowIn);
+      painter->drawPath(params->dataArrowOut);
+    }
+
+    // paint modifier box if needed
+    ConnectedInterface* connIface = AI_TO_CON(refInter->getAssociatedIface());
+    if ((connIface != NULL) && (connIface->getInputModifier() != NULL)) {
+      painter->save();
+      painter->translate(params->arrowWidth+params->arrowLineLength,0);
+      painter->drawRect(0,-5,10,10);
+      painter->restore();
     }
 
+
     // draw names
     if(selected) {
       painter->setPen(QPen(Qt::red,2));
@@ -164,7 +177,9 @@ void InterfaceItem::paint(QPainter *painter) {
       else if((owner->isBoxItem()) || (owner->isSourceItem())){     
         painter->drawText(-w,-h/2,w,h,Qt::AlignLeft | Qt::TextWordWrap, refInter->getName());
       }
-    }    
+    }
+
+
 
     painter->restore();
   }
@@ -257,7 +272,7 @@ void InterfaceItem::addConnectionItem(ConnectionItem* item) {
 }
 
 void InterfaceItem::removeConnectionItem(ConnectionItem* item) {
-  connections.removeOne(item);
+  connections.removeAll(item);
 }
 
 QDataStream &operator <<(QDataStream &out, InterfaceItem *i) {