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

Private GIT Repository
changed sources to stimulis
[blast.git] / InterfaceItem.cpp
index 443cee06e4f022bd4ce944e716acfe8284ffe1a3..02b04ac6aa3db045d593bab291c265bc715b301e 100644 (file)
@@ -11,7 +11,7 @@ InterfaceItem::InterfaceItem(double _position,
                              int _orientation,
                              ConnectedInterface *_refInter,
                              AbstractBoxItem* _owner,
                              int _orientation,
                              ConnectedInterface *_refInter,
                              AbstractBoxItem* _owner,
-                             Parameters* _params) {
+                             Parameters* _params, bool forceVisible) {
   positionRatio = _position;
   orientation = _orientation;
   refInter = _refInter;
   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
   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 {
     visible = true;
   }
   else {
@@ -98,7 +98,7 @@ void InterfaceItem::paint(QPainter *painter) {
       if(owner->isBoxItem()) {
         painter->setPen(QPen(Qt::black,1));
       }
       if(owner->isBoxItem()) {
         painter->setPen(QPen(Qt::black,1));
       }
-      else if(owner->isSourceItem()) {
+      else if(owner->isStimuliItem()) {
         painter->setPen(QPen(Qt::darkCyan,1));
       }
     }
         painter->setPen(QPen(Qt::darkCyan,1));
       }
     }
@@ -118,19 +118,22 @@ void InterfaceItem::paint(QPainter *painter) {
     }
 
     // draw arrows
     }
 
     // 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) {
     }
     else if(refInter->getDirection() == AbstractInterface::Output) {
-      painter->drawPath(params->outArrow);
+      painter->drawPath(params->dataArrowOut);
     } else if(refInter->getDirection() == AbstractInterface::InOut) {
     } 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
     }
 
     // paint modifier box if needed
-
-    if (refInter->getInputModifier() != NULL) {
+    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->save();
       painter->translate(params->arrowWidth+params->arrowLineLength,0);
       painter->drawRect(0,-5,10,10);
@@ -162,7 +165,7 @@ void InterfaceItem::paint(QPainter *painter) {
       if(owner->isGroupItem()){
         painter->drawText(-(w+params->arrowWidth+params->arrowLineLength),-h/2,w,h,Qt::AlignLeft | Qt::TextWordWrap, refInter->getName());
       }
       if(owner->isGroupItem()){
         painter->drawText(-(w+params->arrowWidth+params->arrowLineLength),-h/2,w,h,Qt::AlignLeft | Qt::TextWordWrap, refInter->getName());
       }
-      else if((owner->isBoxItem()) || (owner->isSourceItem())){
+      else if((owner->isBoxItem()) || (owner->isStimuliItem())){
         painter->drawText(0,-h/2,w,h,Qt::AlignRight | Qt::TextWordWrap, refInter->getName());
       }
     }
         painter->drawText(0,-h/2,w,h,Qt::AlignRight | Qt::TextWordWrap, refInter->getName());
       }
     }
@@ -171,7 +174,7 @@ void InterfaceItem::paint(QPainter *painter) {
       if(owner->isGroupItem()) {
         painter->drawText(params->arrowWidth+params->arrowLineLength,-h/2,w,h,Qt::AlignRight | Qt::TextWordWrap, refInter->getName());
       }
       if(owner->isGroupItem()) {
         painter->drawText(params->arrowWidth+params->arrowLineLength,-h/2,w,h,Qt::AlignRight | Qt::TextWordWrap, refInter->getName());
       }
-      else if((owner->isBoxItem()) || (owner->isSourceItem())){     
+      else if((owner->isBoxItem()) || (owner->isStimuliItem())){     
         painter->drawText(-w,-h/2,w,h,Qt::AlignLeft | Qt::TextWordWrap, refInter->getName());
       }
     }
         painter->drawText(-w,-h/2,w,h,Qt::AlignLeft | Qt::TextWordWrap, refInter->getName());
       }
     }