]> SALOME platform Git repositories - modules/superv.git/blobdiff - src/SUPERVGUI/SUPERVGUI_GraphNode.cxx
Salome HOME
NRI : Merge from 1.2c.
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_GraphNode.cxx
index c3c6c6c27266ccf5834b236ca1173d0dd256aeee..3a1676f005dc2fdaa9423cd54bd306edd095fea7 100644 (file)
@@ -26,8 +26,18 @@ SUPERVGUI_GraphNode::SUPERVGUI_GraphNode(QWidget* theParent, SUPERVGUI_Main* the
   connect(myTitle, SIGNAL(MouseMove (QMouseEvent*)), this, SLOT(mouseTitleMove(QMouseEvent*)));
   connect(myTitle, SIGNAL(MouseRelease(QMouseEvent*)), this, SLOT(mouseTitleRelease(QMouseEvent*)));
 
-  myPortsBox = new QFrame(0);
-  myPortLayout = new QGridLayout(myPortsBox, 0, 2, 0, 1);
+  myPortsBox = new QVBox(0);  
+  myPortsBox->setSpacing(3);
+  myValuesBox = new QWidget(myPortsBox);
+  myPortLayout = new QGridLayout(myValuesBox, 0, 2, 0, 1);
+
+  myGatesBox = new QFrame(myPortsBox);
+  myGatesBox->setFrameStyle( QFrame::Panel | QFrame::Raised );
+  myGatesBox->setLineWidth(2);
+  //  myGatesBox->setPaletteBackgroundColor(backgroundColor().dark(105));
+  myGatesBox->setPaletteBackgroundColor(green.light(170));
+  myGatesLayout = new QGridLayout(myGatesBox, 0, 2);
+  myGatesLayout->setMargin(3);
   
   myTimer = new QTimer(this);
   connect(myTimer, SIGNAL(timeout()), this, SLOT(movingNode(/*QMouseEvent* e*/)));
@@ -47,13 +57,23 @@ SUPERVGUI_GraphNode::SUPERVGUI_GraphNode(QWidget* theParent, SUPERVGUI_Main* the
 
   for (int i=0; i<n; i++) {
     if (ports[i]->IsInput()) {
-      myPortLayout->addWidget(new SUPERVGUI_PortIn(myPortsBox, myMain, ports[i]), 
-                            myPIcount, 0);
-      myPIcount++;
+      if (ports[i]->IsGate())
+       myGatesLayout->addWidget(new SUPERVGUI_PortIn(myGatesBox, myMain, ports[i]), 
+                                0, 0);
+      else {
+       myPortLayout->addWidget(new SUPERVGUI_PortIn(myValuesBox, myMain, ports[i]), 
+                               myPIcount, 0);
+       myPIcount++;
+      }
     } else {
-      myPortLayout->addWidget(new SUPERVGUI_PortOut(myPortsBox, myMain, ports[i]), 
-                            myPOcount, 1, Qt::AlignRight);
-      myPOcount++;
+      if (ports[i]->IsGate())
+       myGatesLayout->addWidget(new SUPERVGUI_PortOut(myGatesBox, myMain, ports[i]), 
+                                0, 1, Qt::AlignRight);
+      else {
+       myPortLayout->addWidget(new SUPERVGUI_PortOut(myValuesBox, myMain, ports[i]), 
+                               myPOcount, 1, Qt::AlignRight);
+       myPOcount++;
+      }
     }
   }
 }
@@ -254,7 +274,6 @@ void SUPERVGUI_GraphNode::sync() {
   //check: is creation of link is complete
   if (myMain->getGraph()->isAnyLinkCreating()) {
     //not creation complete
-    //cout<<"   --- $$$  1"<<endl;
     myPopup->setItemEnabled(myDeleteItem, false);
   }
   else {
@@ -336,7 +355,7 @@ void SUPERVGUI_GraphNode::addInputPort() {
   if (aPort == NULL) return;
 
   if (getNodeType() == SUPERV::EndSwitchNode) {
-    SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myPortsBox, myMain, aPort);    
+    SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myValuesBox, myMain, aPort);    
     myPortLayout->addWidget(aPortPrs, myPIcount, 0);
 
     if (myPortsBox->isVisible()) {
@@ -344,7 +363,7 @@ void SUPERVGUI_GraphNode::addInputPort() {
     }
   }
   else {
-    SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myPortsBox, myMain, aPort);
+    SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myValuesBox, myMain, aPort);
     myPortLayout->addWidget(aPortPrs, myPIcount, 0);
 
     if (myPortsBox->isVisible()) {
@@ -362,7 +381,7 @@ void SUPERVGUI_GraphNode::addOutputPort() {
   SUPERV_Port aPort = createOutPort();
   if (aPort == NULL) return;
 
-  SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myPortsBox, myMain, aPort);
+  SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myValuesBox, myMain, aPort);
   myPortLayout->addWidget(aPortPrs, myPOcount, 1, Qt::AlignRight);
   myPOcount++;
   if (myPortsBox->isVisible()) {
@@ -385,16 +404,28 @@ void SUPERVGUI_GraphNode::updatePorts() {
     aPortPrs = (SUPERVGUI_Port*) child(aName, "SUPERVGUI_Port");
     if (aPortPrs == NULL) {
       if (aPorts[i]->IsInput()) {
-       SUPERVGUI_PortIn* aPortIn = new SUPERVGUI_PortIn(myPortsBox, myMain, aPorts[i]);
-       myPortLayout->addWidget(aPortIn, myPIcount, 0);
+       SUPERVGUI_PortIn* aPortIn;
+       if (aPorts[i]->IsGate()) {
+         aPortIn = new SUPERVGUI_PortIn(myGatesBox, myMain, aPorts[i]);
+         myGatesLayout->addWidget(aPortIn, myPIcount, 0);
+       } else {
+         aPortIn = new SUPERVGUI_PortIn(myValuesBox, myMain, aPorts[i]);
+         myPortLayout->addWidget(aPortIn, myPIcount, 0);
+         myPIcount++;
+       }
        if (aIsVisible) aPortIn->show();
-       myPIcount++;
        isAdded = true;
       } else {
-       SUPERVGUI_PortOut* aPortOut = new SUPERVGUI_PortOut(myPortsBox, myMain, aPorts[i]);
-       myPortLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+       SUPERVGUI_PortOut* aPortOut;
+       if (aPorts[i]->IsGate()) {
+         aPortOut = new SUPERVGUI_PortOut(myGatesBox, myMain, aPorts[i]);
+         myGatesLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+       } else {
+         aPortOut = new SUPERVGUI_PortOut(myValuesBox, myMain, aPorts[i]);
+         myPortLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+         myPOcount++;
+       }
        if (aIsVisible) aPortOut->show();
-       myPOcount++;
        isAdded = true;
       }
     }