]> SALOME platform Git repositories - modules/superv.git/blobdiff - src/SUPERVGUI/SUPERVGUI_ControlNode.cxx
Salome HOME
MPV: Merge V1_2d
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_ControlNode.cxx
index 11f5cbf7ebcef498428273afa23c103c1e05af52..a97a43e9ddb5b416a56c75deb8aee828a41f940a 100644 (file)
@@ -1,12 +1,14 @@
-using namespace std;
-//  File      : SUPERVGUI_ControlNode.cxx
-//  Created   : 14 / 01 / 2003
-//  Author    : Vitaly SMETANNIKOV
-//  Project   : SALOME 
-//  Module    : SUPERVGUI
-//  Copyright : Open CASCADE 
-
+//  SUPERV SUPERVGUI : GUI for Supervisor component
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : SUPERVGUI_ControlNode.cxx
+//  Author : Vitaly SMETANNIKOV
+//  Module : SUPERV
 
+using namespace std;
 #include "SUPERVGUI_ControlNode.h"
 #include <qapplication.h>
 #include "SUPERVGUI_Main.h"
@@ -36,6 +38,7 @@ SUPERVGUI_StartControlNode::SUPERVGUI_StartControlNode(QWidget* theParent, SUPER
 
   myPortsBox->reparent(this, pos());
   aGridLayout->addMultiCellWidget(myPortsBox, 1, 1, 0, 1);
+  //  myGatesBox->setPaletteBackgroundColor(backgroundColor().dark(105));
 
   myStatus->reparent(this, pos());
   myTime->reparent(this, pos());
@@ -85,7 +88,6 @@ void SUPERVGUI_StartControlNode::rename() {
 void SUPERVGUI_StartControlNode::remove() {
   myEndNode->deleteLinks();
   deleteLinks();
-  myEndNode->getEngine()->destroy();
   myNode->destroy();
   myMain->getGraph()->deleteNode(myEndNode);
   myMain->getGraph()->deleteNode(this);
@@ -96,6 +98,10 @@ void SUPERVGUI_StartControlNode::setEndNode(SUPERVGUI_EndControlNode* theEndNode
   myEndNode = theEndNode; 
 }
 
+SUPERVGUI_EndControlNode* SUPERVGUI_StartControlNode::getEndNode() {
+  return myEndNode;
+}
+
 
 void SUPERVGUI_StartControlNode::setShape() {
   int aH = height();
@@ -141,6 +147,7 @@ void SUPERVGUI_StartControlNode::addInputPort() {
 
 void SUPERVGUI_StartControlNode::deletePort(SUPERVGUI_Port* thePort) {
   if (getNodeType() == SUPERV::LoopNode) {
+    
     SUPERV_Port aPortEngine = thePort->getPort();
     QString aName(aPortEngine->Name());
     QString aNameIn = aName + "Input";
@@ -164,10 +171,12 @@ void SUPERVGUI_StartControlNode::deletePort(SUPERVGUI_Port* thePort) {
 
     myPIcount--;
     myPOcount--;
+    
     myEndNode->getPIcount()--;
     myEndNode->getPOcount()--; 
-   
+    
     aPortEngine->destroy();
+
     updatePorts();
     updateShape();
     myEndNode->updatePorts();
@@ -178,6 +187,12 @@ void SUPERVGUI_StartControlNode::deletePort(SUPERVGUI_Port* thePort) {
 }
 
 
+QPoint SUPERVGUI_StartControlNode::getOutConnectPnt() {
+  return QPoint(pos().x() + width() -  LABEL_HEIGHT/2,
+               pos().y() + (height()/2));
+}
+
+
 //-----------------------------------------------------------
 //******************* End Node ******************************
 //-----------------------------------------------------------
@@ -200,27 +215,10 @@ SUPERVGUI_EndControlNode::SUPERVGUI_EndControlNode(QWidget* theParent, SUPERVGUI
   myTitle->setPaletteBackgroundColor(TITLECOLOR);
   aGridLayout->addMultiCellWidget(myTitle, 0, 0, 0, 2);
 
-  myPortsBox = new QFrame(this);
-  myPortLayout = new QGridLayout(myPortsBox, 0, 2, 0, 1);
+  myPortsBox->reparent(this, pos());  
   
-  myPIcount = 0;
-  myPOcount = 0;
-  SUPERV_Ports       ports = myNode->Ports();
-  int                n     = ports->length();
-
-  for (int i=0; i<n; i++) {
-    if (ports[i]->IsInput()) {
-      myPortLayout->addWidget(new SUPERVGUI_PortIn(myPortsBox, myMain, ports[i]), 
-                             myPIcount, 0);
-      myPIcount++;
-    } else {
-      myPortLayout->addWidget(new SUPERVGUI_PortOut(myPortsBox, myMain, ports[i]), 
-                             myPOcount, 1, Qt::AlignRight);
-      myPOcount++;
-    }
-  }
   aGridLayout->addMultiCellWidget(myPortsBox, 1, 1, 1, 2);
-
+  
   myStatus->reparent(this, pos());
   myTime->reparent(this, pos());
   aGridLayout->addMultiCellWidget(myStatus, 2, 2, 0, 1);
@@ -288,6 +286,12 @@ void SUPERVGUI_EndControlNode::updateShape() {
 }
 
 
+QPoint SUPERVGUI_EndControlNode::getInConnectPnt() {
+  return QPoint(pos().x() + LABEL_HEIGHT/2, 
+               pos().y() + (height()/2));
+}
+
+
 //-----------------------------------------------------------
 //******************* GoTo Node *****************************
 //-----------------------------------------------------------