]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Join modifications from V3_2_0_maintainance (V3_2_6pre4 - T32x_16Aug2007_16h00m) mergefrom_V3_2_0_maintainance_31Aug2007
authorjfa <jfa@opencascade.com>
Fri, 17 Aug 2007 11:15:10 +0000 (11:15 +0000)
committerjfa <jfa@opencascade.com>
Fri, 17 Aug 2007 11:15:10 +0000 (11:15 +0000)
src/SUPERVGUI/SUPERVGUI.cxx
src/SUPERVGUI/SUPERVGUI_Canvas.cxx
src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx
src/SUPERVGUI/SUPERVGUI_CanvasControlNode.cxx
src/SUPERVGUI/SUPERVGUI_CanvasControlNode.h
src/SUPERVGUI/SUPERVGUI_CanvasNode.cxx
src/SUPERVGUI/SUPERVGUI_CanvasNode.h
src/SUPERVGUI/SUPERVGUI_CanvasPort.cxx
src/SUPERVGUI/SUPERVGUI_Main.cxx
src/SUPERVGUI/SUPERVGUI_ManagePortsDlg.cxx
src/Supervision/Graph_Impl.cxx

index f80b931a468a5bd136a0c030870aa74686d6a18d..137e3041f0a6deebaf57d430931a317827fbb23c 100644 (file)
@@ -455,70 +455,76 @@ void SUPERVGUI::setMain( SUIT_ViewWindow* w) {
 }
 
 void SUPERVGUI::displayDataflow() {
-    Trace("SUPERVGUI::displayDataflow");
-    OB_Browser* aBrowser = (( SalomeApp_Application* )application())->objectBrowser();
-    SUPERV_Graph aDataFlow;
-    QString aIORName;
-
-    OB_ListItem* item = (OB_ListItem*)(aBrowser->listView()->currentItem());
-    _PTR(SObject) aObj
-      ( (( SalomeApp_Study* )(application()->activeStudy()))->studyDS()->FindObjectID(item->text(2).latin1()) );
-    _PTR(GenericAttribute) anAttr;
-    if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
-      _PTR(AttributeIOR) anIOR ( anAttr );
-      aIORName = QString(anIOR->Value().c_str());
-      if (isContains(study, aIORName)) {
-        if (QMessageBox::warning(application()->desktop(), tr("WARNING"),
-                                 tr("MSG_GRAPH_DISPLAYED").arg(""),
-                                 QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
-          return;
-      }
-      //aDataFlow = engine->getStreamGraph(anIOR->Value().c_str());
-      aDataFlow = engine->getGraph(anIOR->Value().c_str());
-      if (SUPERV_isNull(aDataFlow)) {
-        QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
+  Trace("SUPERVGUI::displayDataflow");
+
+  OB_Browser* aBrowser = getApp()->objectBrowser();
+  OB_ListItem* item = (OB_ListItem*)(aBrowser->listView()->currentItem());
+
+  SalomeApp_Study* anAppStudy = (SalomeApp_Study*)(getApp()->activeStudy());
+  _PTR(SObject) aObj (anAppStudy->studyDS()->FindObjectID(item->text(2).latin1()));
+
+  SUPERV_Graph aDataFlow;
+  QString aIORName;
+
+  _PTR(GenericAttribute) anAttr;
+  if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
+    _PTR(AttributeIOR) anIOR ( anAttr );
+    aIORName = QString(anIOR->Value().c_str());
+    if (isContains(study, aIORName)) {
+      if (QMessageBox::warning(application()->desktop(), tr("WARNING"),
+                               tr("MSG_GRAPH_DISPLAYED").arg(""),
+                               QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
         return;
-      }
-      /* ASV: 20.10.04: fix for 6896
-      if (aDataFlow->IsStreamGraph()) {
-        SUPERV_StreamGraph aDataFlowStream = aDataFlow->ToStreamGraph();
-        if (SUPERV_isNull(aDataFlowStream)) {
-          QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
-          return;
-        }
-        aDataFlow = aDataFlowStream;
-      }
-      */
     }
 
-    SUPERVGraph_ViewFrame* aViewFrame;
-    if ( !myInitialViewFrame ) {
-      // first case : create a ViewFrame object
-      aViewFrame = dynamic_cast<SUPERVGraph_ViewFrame*>( createGraph() );
-    }
-    else {
-      // second case : get empty initial view frame as new ViewFrame object
-      aViewFrame = myInitialViewFrame;
-      // mkr : IPAL12991 -->
-      SUPERVGraph_View* view = myInitialViewFrame->getViewWidget();
-      if (view)
-       unregisterGraph(dynamic_cast<SUPERVGUI_Main*>(view));
-      // mkr : IPAL12991 <--
-      // mkr : PAL8237 : remove first "gag" Main from children
-      // srn: commented as it cases on application exit "X Windows error"
-      //aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() );
+    //SUPERV_Graph aDataFlow = engine->getStreamGraph(anIOR->Value().c_str());
+    aDataFlow = engine->getGraph(anIOR->Value().c_str());
+    if (SUPERV_isNull(aDataFlow)) {
+      QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
+      return;
     }
 
-    if( aViewFrame ) {
-      main = new SUPERVGUI_Main( aViewFrame, application()->desktop(), aDataFlow );
-      registerGraph( aIORName, main );
-      aViewFrame->show();
+    /* ASV: 20.10.04: fix for 6896
+    if (aDataFlow->IsStreamGraph()) {
+      SUPERV_StreamGraph aDataFlowStream = aDataFlow->ToStreamGraph();
+      if (SUPERV_isNull(aDataFlowStream)) {
+        QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
+        return;
+      }
+      aDataFlow = aDataFlowStream;
     }
+    */
+  }
 
-    if ( myInitialViewFrame ) {
-      myInitialViewFrame = 0;
-      myIVFBackgroundColor = QColor();
-    }
+  SUPERVGraph_ViewFrame* aViewFrame;
+  if ( !myInitialViewFrame ) {
+    // first case : create a ViewFrame object
+    aViewFrame = dynamic_cast<SUPERVGraph_ViewFrame*>( createGraph() );
+  }
+  else {
+    // second case : get empty initial view frame as new ViewFrame object
+    aViewFrame = myInitialViewFrame;
+    // mkr : IPAL12991 -->
+    SUPERVGraph_View* view = myInitialViewFrame->getViewWidget();
+    if (view)
+      unregisterGraph(dynamic_cast<SUPERVGUI_Main*>(view));
+    // mkr : IPAL12991 <--
+    // mkr : PAL8237 : remove first "gag" Main from children
+    // srn: commented as it cases on application exit "X Windows error"
+    //aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() );
+    delete view;
+  }
+
+  if ( aViewFrame ) {
+    main = new SUPERVGUI_Main( aViewFrame, application()->desktop(), aDataFlow );
+    registerGraph( aIORName, main );
+    aViewFrame->show();
+  }
+
+  if ( myInitialViewFrame ) {
+    myInitialViewFrame = 0;
+    myIVFBackgroundColor = QColor();
+  }
 }
 
 
@@ -567,8 +573,12 @@ void SUPERVGUI::renameDataflow() {
                 if ( !SUPERV_isNull(aStreamDataFlow) )
                   aStreamDataFlow->SetName( nm.latin1() );
               }
-              else
+              else {
                 aDataFlow->SetName( nm.latin1() );
+              }
+
+              // update "Save" icon and menu state, if dataflow is published
+              SUPERVGUI_Main::setModifiedFlag();  
             }
           }
          // mkr : PAL7037 <--
index b3070b1b8bc698baaf33a007e0257b6903da2748..ddb63f95836d6498f538ec2a40a4d9c4fe678a79 100644 (file)
        ihmList->removeRef(ihmNode); \
        ihmNode->merge(); \
         ihmNode = getNode(aCNodeEnd); \
-       ihmList->removeRef(ihmNode); \
-       ihmNode->merge(); \
+        if (ihmNode) { \
+         ihmList->removeRef(ihmNode); \
+         ihmNode->merge(); \
+        } \
       } \
     }
 
@@ -206,7 +208,7 @@ void SUPERVGUI_Canvas::sync() {
  */
 void SUPERVGUI_Canvas::merge() {
   if (SUPERV_isNull(myMain->getDataflow())) return;
-      
+
   SUPERVGUI_CanvasNode* ihmNode;
   QObjectList* ihmList = queryList("SUPERVGUI_CanvasNode");
   SUPERV_Nodes nodes = myMain->getDataflow()->Nodes();
@@ -228,6 +230,43 @@ void SUPERVGUI_Canvas::merge() {
 
   UPDATECONTROLNODES(LNodes);    
   UPDATECONTROLNODES(SNodes);
+  /*
+  n = nodes->LNodes.length();
+  for (int i=0; i<n; i++) {
+    SUPERV_CNode aCNode = SUPERV::CNode::_narrow(nodes->LNodes[i]);
+    SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->LNodes[i]->Coupled());
+    ihmNode = getNode(aCNode);
+    SUPERVGUI_CanvasNode* ihmNodeEnd = getNode(aCNodeEnd);
+    if (ihmNode == NULL) {
+      myMain->addControlNode(aCNode, aCNodeEnd, false);
+    } else {
+      if (ihmNodeEnd) {
+        ihmNode->move(aCNode->X(), aCNode->Y());
+        ihmList->removeRef(ihmNode);
+        ihmNode->merge();
+        ihmNode = getNode(aCNodeEnd);
+        ihmList->removeRef(ihmNode);
+        ihmNode->merge();
+      }
+    }
+  }
+  n = nodes->SNodes.length();
+  for (int i=0; i<n; i++) {
+    SUPERV_CNode aCNode = SUPERV::CNode::_narrow(nodes->SNodes[i]);
+    SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->SNodes[i]->Coupled());
+    ihmNode = getNode(aCNode);
+    if (ihmNode == NULL) {
+      myMain->addControlNode(aCNode, aCNodeEnd, false);
+    } else {
+      ihmNode->move(aCNode->X(), aCNode->Y());
+      ihmList->removeRef(ihmNode);
+      ihmNode->merge();
+      ihmNode = getNode(aCNodeEnd);
+      ihmList->removeRef(ihmNode);
+      ihmNode->merge();
+    }
+  }
+  //*/
 
   QObjectListIt it(*ihmList);
   while ((ihmNode=(SUPERVGUI_CanvasNode*)it.current()) != 0) {
index 0e7dbb7967c8d5971071b864fb95a0b4cc7133c4..bbd3ffc70421f15ad1b3d31e67bd8013eb3d8930 100644 (file)
@@ -45,7 +45,7 @@
       else x += (CELL_WIDTH  + CELL_SPACE); \
       cell = getCellNode(aCNode); \
       if (cell == NULL) { \
-        SUPERVGUI_CanvasCellNode* aNode = new SUPERVGUI_CanvasCellNode(myMgr, this, myMain, aCNode); \
+        SUPERVGUI_CanvasCellNode* aNode = SUPERVGUI_CanvasCellNode::Create(myMgr, this, myMain, aCNode); \
         aNode->move(x, y); \
         aNode->show(); \
         aNode->sync(); \
       SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->NodesName[co]->Coupled()); \
       cell = getCellNode(aCNode); \
       if (cell == NULL) { \
-        SUPERVGUI_CanvasCellNode* aNode = new SUPERVGUI_CanvasCellNode( myMgr, this, myMain, aCNode); \
+        SUPERVGUI_CanvasCellNode* aNode = SUPERVGUI_CanvasCellNode::Create(myMgr, this, myMain, aCNode); \
         aNode->move(x, y); \
         aNode->show(); \
         aNode->sync(); \
         y += (CELL_HEIGHT + CELL_SPACE); \
-        SUPERVGUI_CanvasCellNode* aNodeEnd = new SUPERVGUI_CanvasCellEndNode( myMgr, this, myMain, aCNodeEnd, aNode); \
+        SUPERVGUI_CanvasCellNode* aNodeEnd = SUPERVGUI_CanvasCellEndNode::Create(myMgr, this, myMain, aCNodeEnd, aNode); \
         aNodeEnd->move(x, y); \
         aNodeEnd->show(); \
         aNodeEnd->sync(); \
@@ -283,7 +283,7 @@ SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasArray::getCellNode(SUPERV::CNode_ptr t
 
 SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasArray::addNode(SUPERV_CNode node) {
   Trace("SUPERVGUI_CanvasArray::addNode");
-  SUPERVGUI_CanvasCellNode* n = new SUPERVGUI_CanvasCellNode( myMgr, this, myMain, node);
+  SUPERVGUI_CanvasCellNode* n = SUPERVGUI_CanvasCellNode::Create(myMgr, this, myMain, node);
   n->move(nodeX, nodeY);
   n->show();
   update();
index 71bd607f5d65f2735c1e68ee1ef989f9e41a898c..4bfd92425dc7645ed594e33e1ef03f09816289c0 100644 (file)
 //=====================================================================
 // Compute node
 //=====================================================================
-SUPERVGUI_CanvasComputeNode::SUPERVGUI_CanvasComputeNode( SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
-  SUPERVGUI_CanvasNode( mgr, theParent, theMain, theNode)
+SUPERVGUI_CanvasComputeNode::SUPERVGUI_CanvasComputeNode (SUIT_ResourceMgr* mgr, QObject* theParent,
+                                                          SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
+  SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode)
 {
   Trace("SUPERVGUI_CanvasComputeNode::SUPERVGUI_CanvasComputeNode");
 }
 
+SUPERVGUI_CanvasComputeNode* SUPERVGUI_CanvasComputeNode::Create
+                             (SUIT_ResourceMgr* mgr, QObject* theParent,
+                              SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
+{
+  SUPERVGUI_CanvasComputeNode* aRet = new SUPERVGUI_CanvasComputeNode (mgr, theParent, theMain, theNode);
+  emit aRet->objectCreatedDeleted();
+  return aRet;
+}
+
 QPopupMenu* SUPERVGUI_CanvasComputeNode::getPopupMenu(QWidget* theParent) 
 {
   QPopupMenu* popup = SUPERVGUI_CanvasNode::getPopupMenu(theParent);
@@ -68,16 +78,25 @@ QPopupMenu* SUPERVGUI_CanvasComputeNode::getPopupMenu(QWidget* theParent)
 //=====================================================================
 // Start control node
 //=====================================================================
-SUPERVGUI_CanvasStartNode::SUPERVGUI_CanvasStartNode(SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
+SUPERVGUI_CanvasStartNode::SUPERVGUI_CanvasStartNode (SUIT_ResourceMgr* mgr, QObject* theParent,
+                                                      SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
   SUPERVGUI_CanvasNode( mgr, theParent, theMain, theNode), 
   myCoupled(0)
 {
   Trace("SUPERVGUI_CanvasStartNode::SUPERVGUI_CanvasStartNode");
 }
 
+SUPERVGUI_CanvasStartNode* SUPERVGUI_CanvasStartNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent,
+                                                              SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
+{
+  SUPERVGUI_CanvasStartNode* aRet = new SUPERVGUI_CanvasStartNode (mgr, theParent, theMain, theNode);
+  emit aRet->objectCreatedDeleted();
+  return aRet;
+}
+
 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasStartNode::createPrs() const
 {
-  return new SUPERVGUI_CanvasStartNodePrsresMgr(), getMain()->getCanvas(), 
+  return new SUPERVGUI_CanvasStartNodePrs (resMgr(), getMain()->getCanvas(), 
                                           (SUPERVGUI_CanvasStartNode*)this);
 }
 
@@ -136,6 +155,8 @@ void SUPERVGUI_CanvasStartNode::remove()
   if (myCoupled) 
     delete myCoupled;
 
+  emit objectCreatedDeleted(); // jfa : NPAL15529
+
   delete this;
 
   aCanvas->update();
@@ -177,8 +198,9 @@ void SUPERVGUI_CanvasStartNode::pastePort()
 //=====================================================================
 // End control node
 //=====================================================================
-SUPERVGUI_CanvasEndNode::SUPERVGUI_CanvasEndNode(SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain,
-                                                SUPERV_CNode theNode, SUPERVGUI_CanvasStartNode* theStart):
+SUPERVGUI_CanvasEndNode::SUPERVGUI_CanvasEndNode (SUIT_ResourceMgr* mgr, QObject* theParent,
+                                                  SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
+                                                  SUPERVGUI_CanvasStartNode* theStart):
   SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode), 
   myCoupled(theStart)
 {
@@ -186,6 +208,15 @@ SUPERVGUI_CanvasEndNode::SUPERVGUI_CanvasEndNode(SUIT_ResourceMgr* mgr, QObject*
   myCoupled->setCoupled(this);
 }
 
+SUPERVGUI_CanvasEndNode* SUPERVGUI_CanvasEndNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent,
+                                                          SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
+                                                          SUPERVGUI_CanvasStartNode* theStart)
+{
+  SUPERVGUI_CanvasEndNode* aRet = new SUPERVGUI_CanvasEndNode (mgr, theParent, theMain, theNode, theStart);
+  emit aRet->objectCreatedDeleted();
+  return aRet;
+}
+
 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasEndNode::createPrs() const
 {
   return new SUPERVGUI_CanvasEndNodePrs( resMgr(), getMain()->getCanvas(), 
@@ -214,12 +245,21 @@ QPopupMenu* SUPERVGUI_CanvasEndNode::getPopupMenu(QWidget* theParent)
 //=====================================================================
 // Goto control node
 //=====================================================================
-SUPERVGUI_CanvasGotoNode::SUPERVGUI_CanvasGotoNode(SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
+SUPERVGUI_CanvasGotoNode::SUPERVGUI_CanvasGotoNode (SUIT_ResourceMgr* mgr, QObject* theParent,
+                                                    SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
   SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode)
 {
   Trace("SUPERVGUI_CanvasGotoNode::SUPERVGUI_CanvasGotoNode");
 }
 
+SUPERVGUI_CanvasGotoNode* SUPERVGUI_CanvasGotoNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent,
+                                                            SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
+{
+  SUPERVGUI_CanvasGotoNode* aRet = new SUPERVGUI_CanvasGotoNode (mgr, theParent, theMain, theNode);
+  emit aRet->objectCreatedDeleted();
+  return aRet;
+}
+
 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasGotoNode::createPrs() const
 {
   return new SUPERVGUI_CanvasGotoNodePrs( resMgr(), getMain()->getCanvas(), 
@@ -291,12 +331,21 @@ void SUPERVGUI_CanvasGotoNode::linkToNode() {
 //=====================================================================
 // Macro node
 //=====================================================================
-SUPERVGUI_CanvasMacroNode::SUPERVGUI_CanvasMacroNode(SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
+SUPERVGUI_CanvasMacroNode::SUPERVGUI_CanvasMacroNode (SUIT_ResourceMgr* mgr, QObject* theParent,
+                                                      SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
   SUPERVGUI_CanvasComputeNode(mgr, theParent, theMain, theNode)
 {
   Trace("SUPERVGUI_CanvasMacroNode::SUPERVGUI_CanvasMacroNode");
 }
 
+SUPERVGUI_CanvasMacroNode* SUPERVGUI_CanvasMacroNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent,
+                                                              SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
+{
+  SUPERVGUI_CanvasMacroNode* aRet = new SUPERVGUI_CanvasMacroNode (mgr, theParent, theMain, theNode);
+  emit aRet->objectCreatedDeleted();
+  return aRet;
+}
+
 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasMacroNode::createPrs() const
 {
   return new SUPERVGUI_CanvasMacroNodePrs( resMgr(), getMain()->getCanvas(), 
@@ -381,9 +430,8 @@ void SUPERVGUI_CanvasMacroNode::remove()
 //=====================================================================
 // Cell node: node for table view
 //=====================================================================
-SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode(SUIT_ResourceMgr* mgr, QObject* theParent, 
-                                                  SUPERVGUI_Main* theMain, 
-                                                  SUPERV_CNode theNode):
+SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode (SUIT_ResourceMgr* mgr, QObject* theParent, 
+                                                    SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
   SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode, true)
 {
   Trace("SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode");
@@ -400,6 +448,14 @@ SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode(SUIT_ResourceMgr* mgr, QObjec
     myIsControl = true;
 }
 
+SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasCellNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, 
+                                                            SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
+{
+  SUPERVGUI_CanvasCellNode* aRet = new SUPERVGUI_CanvasCellNode (mgr, theParent, theMain, theNode);
+  emit aRet->objectCreatedDeleted();
+  return aRet;
+}
+
 SUPERVGUI_CanvasCellNode::~SUPERVGUI_CanvasCellNode()
 {
 }
@@ -465,9 +521,8 @@ SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasCellNode::createPrs() const
   return aPrs;
 }
 
-SUPERVGUI_CanvasCellEndNode::SUPERVGUI_CanvasCellEndNode( SUIT_ResourceMgr* mgr, QObject* theParent, 
-                                                         SUPERVGUI_Main* theMain, 
-                                                         SUPERV_CNode theNode, 
+SUPERVGUI_CanvasCellEndNode::SUPERVGUI_CanvasCellEndNode (SUIT_ResourceMgr* mgr, QObject* theParent, 
+                                                         SUPERVGUI_Main* theMain, SUPERV_CNode theNode, 
                                                          SUPERVGUI_CanvasCellNode* theStart):
   SUPERVGUI_CanvasCellNode(mgr, theParent, theMain, theNode)
 {
@@ -476,12 +531,25 @@ SUPERVGUI_CanvasCellEndNode::SUPERVGUI_CanvasCellEndNode( SUIT_ResourceMgr* mgr,
   //set end cell for start cell as pair
   myPairCell->setPairCell(dynamic_cast<SUPERVGUI_CanvasCellNode*>(this));
 }
+
+SUPERVGUI_CanvasCellEndNode* SUPERVGUI_CanvasCellEndNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, 
+                                                                  SUPERVGUI_Main* theMain,
+                                                                  SUPERV_CNode theNode, 
+                                                                  SUPERVGUI_CanvasCellNode* theStart)
+{
+  SUPERVGUI_CanvasCellEndNode* aRet =
+    new SUPERVGUI_CanvasCellEndNode (mgr, theParent, theMain, theNode, theStart);
+  emit aRet->objectCreatedDeleted();
+  return aRet;
+}
+
 /*
 bool SUPERVGUI_CanvasCellEndNode::setNodeName(QString theName)
 {
   return SUPERVGUI_CanvasNode::setNodeName(theName);
 }
 */
+
 //-----------------------------------------------------------
 //*************** Select Inline node dialog******************
 // Taken from SUPERVGUI_ControlNode.cxx without change
index 8f6767f1cb0bff359bcd8393c3ea2cfe4d09fb19..ddb250ea79430b09ab59c27854886d34acd6f91b 100644 (file)
@@ -35,17 +35,23 @@ class SUPERVGUI_CanvasComputeNode : public SUPERVGUI_CanvasNode {
   Q_OBJECT
 
   public:
-    SUPERVGUI_CanvasComputeNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
+    static SUPERVGUI_CanvasComputeNode* Create (SUIT_ResourceMgr*, QObject* theParent,
+                                               SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
     virtual ~SUPERVGUI_CanvasComputeNode() {}
 
     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
+
+  protected:
+    SUPERVGUI_CanvasComputeNode (SUIT_ResourceMgr*, QObject* theParent,
+                                SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
 };
 
 class SUPERVGUI_CanvasMacroNode : public SUPERVGUI_CanvasComputeNode {
   Q_OBJECT
 
   public:
-    SUPERVGUI_CanvasMacroNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
+    static SUPERVGUI_CanvasMacroNode* Create (SUIT_ResourceMgr*, QObject* theParent,
+                                             SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
     virtual ~SUPERVGUI_CanvasMacroNode() {}
 
     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
@@ -56,22 +62,27 @@ class SUPERVGUI_CanvasMacroNode : public SUPERVGUI_CanvasComputeNode {
     void exportDataflow();
 
   protected:
+    SUPERVGUI_CanvasMacroNode (SUIT_ResourceMgr*, QObject* theParent,
+                              SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
+
     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
 };
 
 
 class SUPERVGUI_CanvasEndNode;
-class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode {
+class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode
+{
   Q_OBJECT
 
   public:
-    SUPERVGUI_CanvasStartNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
+    static SUPERVGUI_CanvasStartNode* Create (SUIT_ResourceMgr*, QObject* theParent,
+                                             SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
     virtual ~SUPERVGUI_CanvasStartNode() {}
 
     virtual bool setNodeName(QString aName);
 
     SUPERVGUI_CanvasEndNode* getCoupled() const { return myCoupled; }
-    
+
     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
 
   public slots:
@@ -83,6 +94,9 @@ class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode {
     virtual void pastePort();
 
   protected:
+    SUPERVGUI_CanvasStartNode (SUIT_ResourceMgr*, QObject* theParent,
+                              SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
+
     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
 
   protected slots:
@@ -93,7 +107,6 @@ class SUPERVGUI_CanvasStartNode : public SUPERVGUI_CanvasNode {
     void setCoupled(SUPERVGUI_CanvasEndNode* theEnd) { myCoupled = theEnd; }
 
     SUPERVGUI_CanvasEndNode* myCoupled;
-
 };
 
 
@@ -101,8 +114,9 @@ class SUPERVGUI_CanvasEndNode : public SUPERVGUI_CanvasNode {
   Q_OBJECT
 
   public:
-    SUPERVGUI_CanvasEndNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
-                            SUPERVGUI_CanvasStartNode* theStart);
+    static SUPERVGUI_CanvasEndNode* Create (SUIT_ResourceMgr*, QObject* theParent,
+                                           SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
+                                           SUPERVGUI_CanvasStartNode* theStart);
     virtual ~SUPERVGUI_CanvasEndNode() {}
 
     SUPERVGUI_CanvasStartNode* getCoupled() const { return myCoupled; }
@@ -114,11 +128,14 @@ class SUPERVGUI_CanvasEndNode : public SUPERVGUI_CanvasNode {
     virtual void addInputPort();*/
 
   protected:
+    SUPERVGUI_CanvasEndNode (SUIT_ResourceMgr*, QObject* theParent,
+                            SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
+                            SUPERVGUI_CanvasStartNode* theStart);
+
     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
 
   private:
     SUPERVGUI_CanvasStartNode* myCoupled;
-
 };
 
 
@@ -126,7 +143,8 @@ class SUPERVGUI_CanvasGotoNode : public SUPERVGUI_CanvasNode {
   Q_OBJECT
 
   public:
-    SUPERVGUI_CanvasGotoNode( SUIT_ResourceMgr*, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
+    static SUPERVGUI_CanvasGotoNode* Create (SUIT_ResourceMgr*, QObject* theParent,
+                                            SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
     virtual ~SUPERVGUI_CanvasGotoNode() {}
 
     virtual QPopupMenu* getPopupMenu(QWidget* theParent);
@@ -135,6 +153,9 @@ class SUPERVGUI_CanvasGotoNode : public SUPERVGUI_CanvasNode {
     void linkToNode();
 
   protected:
+    SUPERVGUI_CanvasGotoNode (SUIT_ResourceMgr*, QObject* theParent,
+                             SUPERVGUI_Main* theMain, SUPERV_CNode theNode);
+
     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
 };
 
@@ -142,9 +163,9 @@ class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode {
   Q_OBJECT
 
   public:
-    SUPERVGUI_CanvasCellNode( SUIT_ResourceMgr*, QObject* theParent, 
-                             SUPERVGUI_Main* theMain, 
-                             SUPERV_CNode theNode);
+    static SUPERVGUI_CanvasCellNode* Create (SUIT_ResourceMgr*, QObject* theParent, 
+                                            SUPERVGUI_Main* theMain, 
+                                            SUPERV_CNode theNode);
     virtual ~SUPERVGUI_CanvasCellNode();
 
     // asv : 26.01.05 : everything moved to CanvasNode::getPopupMenu()
@@ -153,12 +174,16 @@ class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode {
     void setPairCell(SUPERVGUI_CanvasCellNode* thePairCell);
     SUPERVGUI_CanvasCellNode* getPairCell();
 
-     virtual void sync();
+    virtual void sync();
 
-     // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
-     //virtual bool setNodeName(QString aName);
+    // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
+    //virtual bool setNodeName(QString aName);
 
   protected:
+    SUPERVGUI_CanvasCellNode (SUIT_ResourceMgr*, QObject* theParent, 
+                             SUPERVGUI_Main* theMain, 
+                             SUPERV_CNode theNode);
+
     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
 
  protected:
@@ -167,26 +192,31 @@ class SUPERVGUI_CanvasCellNode : public SUPERVGUI_CanvasNode {
  private:
     bool        myIsControl;
     bool        myIsStart;
-
 };
 
-class SUPERVGUI_CanvasCellEndNode: public SUPERVGUI_CanvasCellNode {
+class SUPERVGUI_CanvasCellEndNode : public SUPERVGUI_CanvasCellNode {
  
   public:
-    SUPERVGUI_CanvasCellEndNode( SUIT_ResourceMgr*, QObject* theParent, 
+    static SUPERVGUI_CanvasCellEndNode* Create (SUIT_ResourceMgr*, QObject* theParent, 
+                                               SUPERVGUI_Main* theMain, 
+                                               SUPERV_CNode theNode, 
+                                               SUPERVGUI_CanvasCellNode* theStart);
+    virtual ~SUPERVGUI_CanvasCellEndNode() {}
+
+    // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
+    //virtual bool setNodeName(QString theName);
+
+  protected:
+    SUPERVGUI_CanvasCellEndNode (SUIT_ResourceMgr*, QObject* theParent, 
                                 SUPERVGUI_Main* theMain, 
                                 SUPERV_CNode theNode, 
                                 SUPERVGUI_CanvasCellNode* theStart);
-    virtual ~SUPERVGUI_CanvasCellEndNode() {}
-
-     // asv : 26.01.05 : decided to remove all "edition" operations on nodes in Table view
-     //virtual bool setNodeName(QString theName);
 };
 
-/** 
+/**
  * Taken from SUPERVGUI_ControlNode.h without change
  */
-class SUPERVGUI_SelectInlineDlg public QDialog {
+class SUPERVGUI_SelectInlineDlg : public QDialog {
   Q_OBJECT
 
  public:
index 54774c8530e5a3fb3ee3d6157b8b2a5d72b8d3fc..a13b244c24ec6b3e6cee94ade658dc03aff7467a 100644 (file)
@@ -41,7 +41,8 @@
 #include <qinputdialog.h>
 
 
-SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode( SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode, bool theIsCell):
+SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode( SUIT_ResourceMgr* mgr, QObject* theParent,
+                                            SUPERVGUI_Main* theMain, SUPERV_CNode theNode, bool theIsCell):
     QObject(theParent),
     myMain(theMain),
     myNode(theNode),
@@ -96,7 +97,6 @@ SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode( SUIT_ResourceMgr* mgr, QObject* theP
 
   // mkr : PAL8237
   connect(this, SIGNAL(objectCreatedDeleted()), myMain, SLOT(onObjectCreatedDeleted()));
-  emit objectCreatedDeleted();
 }
 
 SUPERVGUI_CanvasNode::~SUPERVGUI_CanvasNode()
@@ -132,7 +132,6 @@ SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasNode::createPrs() const
   //glNode->update();
   //getGLContext()->insertObject( glNode, true /*false*/ );
   //
-  
   return new SUPERVGUI_CanvasNodePrs( myMgr, myMain->getCanvas(), (SUPERVGUI_CanvasNode*)this);
 }
 
index 6124d3dbbe9783a194e3b0885c8981ff5ba3e449..3560a8de341350e48a830ad1039039467187f782 100644 (file)
@@ -41,7 +41,6 @@ class SUPERVGUI_CanvasNode : public QObject {
   Q_OBJECT
 
   public:
-    SUPERVGUI_CanvasNode( SUIT_ResourceMgr*, QObject*, SUPERVGUI_Main*, SUPERV_CNode theNode, bool theIsCell=false);
     virtual ~SUPERVGUI_CanvasNode();
 
     // done to ignore port update when node is removed
@@ -124,6 +123,9 @@ class SUPERVGUI_CanvasNode : public QObject {
     void exportToLib();
   
   protected:
+    SUPERVGUI_CanvasNode (SUIT_ResourceMgr*, QObject*, SUPERVGUI_Main*,
+                         SUPERV_CNode theNode, bool theIsCell=false);
+
     // redefined by most of CanvasNode successors
     virtual SUPERVGUI_CanvasNodePrs* createPrs() const;
     SUIT_ResourceMgr* resMgr() const { return myMgr; }
index c8c6b5a131ee013a9aea1de19cb501dba9d3c3a1..e7db50f26a12c9e6bf2c0ac6bacf7d5601839c3a 100644 (file)
@@ -34,7 +34,8 @@
 
 #include "SalomeApp_Study.h"
 
-SUPERVGUI_CanvasPort::SUPERVGUI_CanvasPort(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort):
+SUPERVGUI_CanvasPort::SUPERVGUI_CanvasPort (QObject* theParent, SUPERVGUI_Main* theMain,
+                                            SUPERV::Port_ptr thePort):
     QObject(theParent),
     myMain(theMain),
     myPrs(0),
@@ -211,7 +212,8 @@ void SUPERVGUI_CanvasPort::copy()
 //***********************************************************
 // Input Port
 //***********************************************************
-SUPERVGUI_CanvasPortIn::SUPERVGUI_CanvasPortIn(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort):
+SUPERVGUI_CanvasPortIn::SUPERVGUI_CanvasPortIn (QObject* theParent, SUPERVGUI_Main* theMain,
+                                                SUPERV::Port_ptr thePort):
   SUPERVGUI_CanvasPort(theParent, theMain, thePort)
 {
   Trace("SUPERVGUI_CanvasPortIn::SUPERVGUI_CanvasPortIn");
@@ -226,7 +228,9 @@ SUPERVGUI_CanvasPortIn::~SUPERVGUI_CanvasPortIn()
 QPopupMenu* SUPERVGUI_CanvasPortIn::getPopupMenu(QWidget* theParent) 
 {
   QPopupMenu* popup = SUPERVGUI_CanvasPort::getPopupMenu(theParent);
-  bool editable = getEngine()->IsInput() && !getEngine()->IsLinked() && !getMain()->getDataflow()->IsExecuting();
+  bool editable = (getEngine()->IsInput() &&
+                   !getEngine()->IsLinked() &&
+                   !getMain()->getDataflow()->IsExecuting());
 
   if (!getEngine()->IsGate() && editable)
     popup->insertItem(tr("MSG_SETVALUE"), this, SLOT(setInput()));
@@ -271,7 +275,8 @@ bool SUPERVGUI_CanvasPortIn::eventFilter(QObject* o, QEvent* e)
 //***********************************************************
 // Output Port
 //***********************************************************
-SUPERVGUI_CanvasPortOut::SUPERVGUI_CanvasPortOut(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort):
+SUPERVGUI_CanvasPortOut::SUPERVGUI_CanvasPortOut (QObject* theParent, SUPERVGUI_Main* theMain,
+                                                  SUPERV::Port_ptr thePort):
   SUPERVGUI_CanvasPort(theParent, theMain, thePort)
 {
   Trace("SUPERVGUI_CanvasPortOut::SUPERVGUI_CanvasPortOut");
index 9daf3ae8062a2865c0ca4215a9cee71f0ec697ca..c0dd3ea434f4a7108a5fcac8b5992b326cd95bcd 100644 (file)
@@ -163,13 +163,13 @@ void SUPERVGUI_Main::init(SUIT_Desktop* theDesktop) {
   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( study->application() );
 
   objectBrowser = app->objectBrowser();
-    
+
   myArray = new SUPERVGUI_CanvasArray( this, resMgr() );
   myArrayView = new SUPERVGUI_ArrayView( myArray, this );
 
   myCanvas = new SUPERVGUI_Canvas( this, resMgr() );
   myCanvasView = new SUPERVGUI_CanvasView(myCanvas, this);
-  
+
   message = app->logWindow();
   notification = new NOTIFICATION_Consumer();
 
@@ -350,6 +350,11 @@ void SUPERVGUI_Main::sync() {
   //if ( aSupMod ) aSupMod->updateObjBrowser();
   //else MESSAGE("NULL Supervision module!");
 
+  // update "Save" icon and menu state, if dataflow is published
+  _PTR(Study) aStudy = ((SalomeApp_Study*)study)->studyDS();
+  _PTR(SObject)  aSO = aStudy->FindObjectIOR(dataflow->getIOR());
+  if (aSO) SUPERVGUI_Main::setModifiedFlag();  
+
   if (myCurrentView == CANVASTABLE) {
     myArray->sync();
     myArray->update();
@@ -597,7 +602,7 @@ void SUPERVGUI_Main::onShowToolbar()
 void SUPERVGUI_Main::onObjectCreatedDeleted()
 {
   if ( study ) {
-    if ( STD_Application* app = dynamic_cast<STD_Application*>( study->application() ) ) {
+    if ( LightApp_Application* app = dynamic_cast<LightApp_Application*>( study->application() ) ) {
       ViewManagerList aVMList;
       app->viewManagers( SUPERVGraph_Viewer::Type(), aVMList );
       SUIT_ViewManager* aVM;
@@ -608,16 +613,20 @@ void SUPERVGUI_Main::onObjectCreatedDeleted()
          QObjectList* aMainList = aVW->queryList("SUPERVGUI_Main");
          if ( aMainList->count() == 1 ) {
            SUPERVGUI_Main* aMain = dynamic_cast<SUPERVGUI_Main*>( aMainList->first() );
-           if ( aMain )
-             if ( !CORBA::is_nil( aMain->getDataflow() )
-                  &&
-                  !QString(aMain->getDataflow()->getIOR()).compare(getDataflow()->getIOR()) // equal dataflows
-                  && 
-                  aMain != this ) // not equal mains
+           if ( aMain ) {
+             if (aMain != this &&
+                  !CORBA::is_nil(aMain->getDataflow()) &&
+                  !QString(aMain->getDataflow()->getIOR()).compare(getDataflow()->getIOR())) // equal dataflows
                aMain->getCanvas()->merge();
+            }
          }
        }
       }
+
+      // update "Save" icon and menu state, if dataflow is published
+      //_PTR(Study) aStudy = ((SalomeApp_Study*)study)->studyDS();
+      //_PTR(SObject)  aSO = aStudy->FindObjectIOR(dataflow->getIOR());
+      //if (aSO) SUPERVGUI_Main::setModifiedFlag();  
     }
   }
 }
@@ -649,7 +658,7 @@ void SUPERVGUI_Main::onPutInStudy( QString* theNodePortName )
          }
        }
       }
-      SUPERVGUI_Main::setModifiedFlag();  
+      //SUPERVGUI_Main::setModifiedFlag();
     }
   }
 }
@@ -841,7 +850,7 @@ void SUPERVGUI_Main::addComputeNode(SUPERV_CNode theNode) {
   case CANVAS:
   case CONTROLFLOW: 
     {
-      SUPERVGUI_CanvasNode* aNode = new SUPERVGUI_CanvasComputeNode( resMgr(), myCanvas, this, theNode);
+      SUPERVGUI_CanvasNode* aNode = SUPERVGUI_CanvasComputeNode::Create(resMgr(), myCanvas, this, theNode);
       aNode->move(theNode->X(), theNode->Y());
       if (myCurrentView == CONTROLFLOW) aNode->hideAll();
       aNode->show();
@@ -863,7 +872,7 @@ void SUPERVGUI_Main::addGOTONode(SUPERV_CNode theNode) {
   case CANVAS:
   case CONTROLFLOW: 
     {
-      SUPERVGUI_CanvasNode* aNode = new SUPERVGUI_CanvasGotoNode( resMgr(), myCanvas, this, theNode);
+      SUPERVGUI_CanvasNode* aNode = SUPERVGUI_CanvasGotoNode::Create(resMgr(), myCanvas, this, theNode);
       aNode->move(theNode->X(), theNode->Y());
       if (myCurrentView == CONTROLFLOW) aNode->hideAll();
       aNode->show();
@@ -876,7 +885,8 @@ void SUPERVGUI_Main::addGOTONode(SUPERV_CNode theNode) {
 /**
  * Add Control node
  */
-void SUPERVGUI_Main::addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update) {
+void SUPERVGUI_Main::addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update)
+{
   switch (myCurrentView) {
   case CANVASTABLE:
     myArray->destroy();
@@ -885,11 +895,13 @@ void SUPERVGUI_Main::addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theE
   case CANVAS:
   case CONTROLFLOW: 
     {
-      SUPERVGUI_CanvasStartNode* aStartNode = new SUPERVGUI_CanvasStartNode( resMgr(), myCanvas, this, theStartNode);
+      SUPERVGUI_CanvasStartNode* aStartNode =
+        SUPERVGUI_CanvasStartNode::Create(resMgr(), myCanvas, this, theStartNode);
       aStartNode->move(theStartNode->X(), theStartNode->Y());
       if (myCurrentView == CONTROLFLOW) aStartNode->hideAll();
 
-      SUPERVGUI_CanvasEndNode* aEndNode = new SUPERVGUI_CanvasEndNode( resMgr(), myCanvas, this, theEndNode, aStartNode);
+      SUPERVGUI_CanvasEndNode* aEndNode =
+        SUPERVGUI_CanvasEndNode::Create(resMgr(), myCanvas, this, theEndNode, aStartNode);
       aEndNode->move(theEndNode->X(), theEndNode->Y());
       if (myCurrentView == CONTROLFLOW) aEndNode->hideAll();
 
@@ -914,7 +926,7 @@ void SUPERVGUI_Main::addMacroNode(SUPERV_CNode theNode) {
   case CANVAS:
   case CONTROLFLOW: 
     {
-      SUPERVGUI_CanvasNode* aNode = new SUPERVGUI_CanvasMacroNode( resMgr(), myCanvas, this, theNode);
+      SUPERVGUI_CanvasNode* aNode = SUPERVGUI_CanvasMacroNode::Create(resMgr(), myCanvas, this, theNode);
       aNode->move(theNode->X(), theNode->Y());
       if (myCurrentView == CONTROLFLOW) aNode->hideAll();
       aNode->show();
@@ -1123,6 +1135,8 @@ void SUPERVGUI_Main::addDataflowToStudy() {
 
     if ( !myThread->running() )
       aSupMod->updateObjBrowser();
+
+    aSupMod->getApp()->updateActions();  
   }
   else {
     MESSAGE( "ERROR: failed to find or create dataflow SObject" );
index 401925330d29a7a5605ff61f4c8e3a7bc95252bd..8437548c3f1b77701675ce290ad5fc5cd6c99472 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "SUPERVGUI_ManagePortsDlg.h"
 #include "SUPERVGUI_CanvasNode.h"
+#include "SUPERVGUI_CanvasNodePrs.h"
 #include "SUPERVGUI_CanvasPort.h"
 #include "SUPERVGUI_CanvasControlNode.h"
 #include "SUPERVGUI_CanvasLink.h"
@@ -316,9 +317,9 @@ SUPERVGUI_ManagePortsDlg::~SUPERVGUI_ManagePortsDlg() {
 }
 
 // mkr : PAL8060
-void SUPERVGUI_ManagePortsDlg::createLinkEngineSUPERV::Port_ptr thePort, 
-                                                QValueList< QPair< QString,QString > >& theOwnList, 
-                                                QValueList< QPair< QString,QString > >& theCorrespList ) {
+void SUPERVGUI_ManagePortsDlg::createLinkEngine (SUPERV::Port_ptr thePort, 
+                                                 QValueList< QPair< QString,QString > >& theOwnList, 
+                                                 QValueList< QPair< QString,QString > >& theCorrespList) {
   // pair <NodeName, PortName> for the given port
   QPair<QString, QString> anOwnPair(QString(thePort->Node()->Name()), QString(thePort->Name()));
   int aNum = theOwnList.contains(anOwnPair);
@@ -329,196 +330,130 @@ void SUPERVGUI_ManagePortsDlg::createLinkEngine( SUPERV::Port_ptr thePort,
     theOwnList.remove(theOwnList.at(anId));
     theCorrespList.remove(theCorrespList.at(anId));
     
-    SUPERV_Port aCorrespPort = myNode->getMain()->getDataflow()->Node(aCorrespPair.first)->Port(aCorrespPair.second);
+    SUPERV_Port aCorrespPort =
+      myNode->getMain()->getDataflow()->Node(aCorrespPair.first)->Port(aCorrespPair.second);
     SUPERV_Link aLinkEngine;
     if ( thePort->IsInput() )
       aLinkEngine = myNode->getMain()->getDataflow()->Link(aCorrespPort, thePort);
     else
       aLinkEngine = myNode->getMain()->getDataflow()->Link(thePort, aCorrespPort);
-    SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(myNode->getMain()->getCanvas(), myNode->getMain(), aLinkEngine);
+    SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(myNode->getMain()->getCanvas(),
+                                                           myNode->getMain(), aLinkEngine);
     aLink->show();
-    
+
     aNum--;
-  }  
+  }
 }
 
 /** 
  * Set the ports as entered by user (order, name/type, etc.) and close the dialog
  */
-void SUPERVGUI_ManagePortsDlg::accept() {
+void SUPERVGUI_ManagePortsDlg::accept()
+{
   myNode->getMain()->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag 
+
   // 1. set the ports to Engine's CNode
   SUPERV_INode aINode = myNode->getInlineNode();
   if ( !SUPERV_isNull( aINode ) ) {
     int i; 
     const bool isLoop = ( myNode->getNodeType() == SUPERV::LoopNode );
 
-    // 1.1 delete all ports (delete CanvasPorts, they delete SUPERV_Ports) 
+    // 1.1 form a list of ports to be removed
     QObjectList* oldPorts = myNode->queryList("SUPERVGUI_CanvasPort");
-    QObjectListIt it( *oldPorts ); // iterate over the old ports
-    QObject *obj;
 
     // asv : 11.01.05 : fix for a bug: for Loop node, removal of an Input Port
-    // automatically removes the corresponding Output Port.  So for Loops the
+    // automatically removes the corresponding Output Port. So for Loops the
     // oldPorts list should be filtered to include only Input Ports.
     // But I'll filter Gate-s as well..
-    bool isAnyLinked = false; // check if any port from old ports is linked
-    // map PortName <-> (PortType, PortInputValue) for non linked input ports, which have input
-    QMap< QString, QPair< QString,QString > > InNameInput;
     QObjectList portsToRemove;
-    while ( (obj = it.current()) != 0 ) {
-      ++it;
+    QObject *obj;
+    QObjectListIt it ( *oldPorts ); // iterate over the old ports
+    for (; (obj = it.current()) != 0; ++it) {
       SUPERV::Port_var aPort = ((SUPERVGUI_CanvasPort*)obj)->getEngine();
-      if ( !aPort->IsGate() && ( !isLoop || aPort->IsInput() ) ) {
-       portsToRemove.append( obj );
+      if ( !aPort->IsGate() ) {
+        if ( !isLoop || aPort->IsInput() ) {
+          portsToRemove.append( obj );
+        }
       }
-      // check if port has a link (output porst of Loop node are also checked)
-      if ( !aPort->IsGate() && aPort->IsLinked() && !isAnyLinked)
-       isAnyLinked = true;
-      // check if input port has an input value
-      if ( !aPort->IsGate() && aPort->IsInput() && aPort->HasInput() )
-       InNameInput.insert( QString(aPort->Name()), 
-                           QPair<QString, QString>(QString(aPort->Type()),QString(aPort->ToString())) );
     }
     delete oldPorts; // delete the list, not the objects
 
-    // mkr : PAL8060 -->
-    QString aNodeName = myNode->getEngine()->Name();
-    QValueList< QPair< QString,QString > > InPortsL, OutPortsL;
-    if ( isAnyLinked ) {
-      // if myNode has linked port(s), create two lists of In/Out ports (InPortsL, OutPortsL) to identify all links for myNode
-      QObjectList* list = myNode->getMain()->getCanvas()->queryList("SUPERVGUI_CanvasLink");
-      QObjectListIt listit( *list );
-      QObject *listobj;
-      while ( (listobj = listit.current()) != 0 ) {
-       ++listit;
-       SUPERV::Link_var aLink = ((SUPERVGUI_CanvasLink*)listobj)->getEngine();
-       if ( aNodeName.compare(aLink->InPort()->Node()->Name()) == 0
-            ||
-            aNodeName.compare(aLink->OutPort()->Node()->Name()) == 0 ) {
-         QPair<QString, QString> InPair (QString(aLink->InPort()->Node()->Name()),
-                                          QString(aLink->InPort()->Name()));
-         QPair<QString, QString> OutPair(QString(aLink->OutPort()->Node()->Name()),
-                                          QString(aLink->OutPort()->Name()));
-         InPortsL.append(InPair);
-         OutPortsL.append(OutPair);
-       }
-
-       if ( isLoop ) {
-         // put into In/Out lists all links for corresponding EndLoop node
-         QString aCoupledNodeName = ((SUPERVGUI_CanvasStartNode*)myNode)->getCoupled()->getEngine()->Name();
-         if ( aCoupledNodeName.compare(aLink->InPort()->Node()->Name()) == 0
-              ||
-              aCoupledNodeName.compare(aLink->OutPort()->Node()->Name()) == 0 ) {
-           QPair<QString, QString> InPair (QString(aLink->InPort()->Node()->Name()),
-                                            QString(aLink->InPort()->Name()));
-           QPair<QString, QString> OutPair(QString(aLink->OutPort()->Node()->Name()),
-                                            QString(aLink->OutPort()->Name()));
-           InPortsL.append(InPair);
-           OutPortsL.append(OutPair);
-         } 
-       }
-      }
-    }
-    // mkr : PAL8060 <--
-    
-    // portsToRemove list contains:
-    // for Loop node: all INPUT ports except Gates
-    // for other Inline: all INPUT and OUTPUT ports except Gates
-    it = QObjectListIt( portsToRemove );
-    while ( (obj = it.current()) != 0 ) {
-      ++it;
-      ((SUPERVGUI_CanvasPort*)obj)->remove();
-    }
-
     // 1.2 create new ports in INode and CanvasPort in myNode
+    //     or just reorder existing ports
     PortListItem* item;
-    SUPERV_Port aPort;
-    for ( i = 0; i < myInList->count(); i++ ) {
+    for (i = 0; i < myInList->count(); i++) {
       item = (PortListItem*)myInList->item( i );
-      aPort = aINode->InPort( item->PortName.latin1(), item->PortType.latin1() );
-      if ( InNameInput.contains( item->PortName ) 
-          && 
-          item->PortType.compare(InNameInput[item->PortName].first) == 0 ) {
-       // i.e. aPort is input and had a value (not linked!)
-       // if ports' name and type didn't change and ports had an input value => set this value again
-       SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
-       if ( aSupMod )
-         aPort->Input( aSupMod->getEngine()->StringValue( InNameInput[item->PortName].second ) );
-       myNode->createPort( aPort.in() );
+      // try existing ports
+      bool isExisting = false;
+      QObjectListIt itRem (portsToRemove);
+      QObject *objRem;
+      for (; (objRem = itRem.current()) != 0 && !isExisting; ++itRem) {
+        SUPERV::Port_var aPort = ((SUPERVGUI_CanvasPort*)objRem)->getEngine();
+        if (item->PortName.compare(aPort->Name()) == 0 &&
+            item->PortType.compare(aPort->Type()) == 0) {
+          // ports reordering
+          myNode->removeChild(objRem);
+          myNode->insertChild(objRem);
+          portsToRemove.remove(objRem);
+          isExisting = true;
+        }
       }
-      else {
-       myNode->createPort( aPort.in() );
-       // mkr : PAL8060
-       if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() )
-         // create links for those input ports, which had links earlier
-         createLinkEngine( aPort, InPortsL, OutPortsL );
+      if (!isExisting) {
+        // create a new port
+        SUPERV::Port_var aPort = aINode->InPort( item->PortName.latin1(), item->PortType.latin1() );
+        myNode->createPort( aPort.in() );
       }
     }
-    
-    if ( isLoop ) {
+
+    // 1.3 create/reorder Out-ports
+    if (isLoop) {
       // asv : 11.01.05 : for Loop nodes do the same as in SUPERVGUI_CanvasStartNode::addInputPort()
       SUPERVGUI_CanvasStartNode* aStartLoopNode = (SUPERVGUI_CanvasStartNode*)myNode;
       aStartLoopNode->merge();
       aStartLoopNode->getCoupled()->merge();
-     
-      // mkr : PAL8060 -->
-      if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) {
-
-       // 1) create old links for output ports of Loop node
-       QObjectList* aPortsOut = aStartLoopNode->queryList("SUPERVGUI_CanvasPortOut");
-       QObjectListIt aPorstOutit( *aPortsOut );
-       QObject *listobj;
-       while ( (listobj = aPorstOutit.current()) != 0 ) {
-         ++aPorstOutit;
-       
-         SUPERV::Port_var aPortOut = ((SUPERVGUI_CanvasPort*)listobj)->getEngine();
-         createLinkEngine( aPortOut, OutPortsL, InPortsL );
-       }
-
-       // 2) create old links for input ports of EndLoop node
-       QObjectList* aPortsIn = aStartLoopNode->getCoupled()->queryList("SUPERVGUI_CanvasPortIn");
-       QObjectListIt aPorstInit( *aPortsIn );
-       while ( (listobj = aPorstInit.current()) != 0 ) {
-         ++aPorstInit;
-       
-         SUPERV::Port_var aPortIn = ((SUPERVGUI_CanvasPort*)listobj)->getEngine();
-         createLinkEngine( aPortIn, InPortsL, OutPortsL );
-       }
-
-       // 3) create old links for output ports of EndLoop node
-       aPortsOut = aStartLoopNode->getCoupled()->queryList("SUPERVGUI_CanvasPortOut");
-       aPorstOutit = QObjectListIt( *aPortsOut );
-       while ( (listobj = aPorstOutit.current()) != 0 ) {
-         ++aPorstOutit;
-       
-         SUPERV::Port_var aPortOut = ((SUPERVGUI_CanvasPort*)listobj)->getEngine();
-         createLinkEngine( aPortOut, OutPortsL, InPortsL );
-       }
+    }
+    else {
+      // for non-loop nodes manage out-ports in the same way as in-ports
+      for (i = 0; i < myOutList->count(); i++) {
+        item = (PortListItem*)myOutList->item( i );
+        // try existing ports
+        bool isExisting = false;
+        QObjectListIt itRem (portsToRemove);
+        QObject *objRem;
+        for (; (objRem = itRem.current()) != 0 && !isExisting; ++itRem) {
+          SUPERV::Port_var aPort = ((SUPERVGUI_CanvasPort*)objRem)->getEngine();
+          if (item->PortName.compare(aPort->Name()) == 0 &&
+              item->PortType.compare(aPort->Type()) == 0) {
+            // ports reordering
+            myNode->removeChild(objRem);
+            myNode->insertChild(objRem);
+            portsToRemove.remove(objRem);
+            isExisting = true;
+          }
+        }
+        if (!isExisting) {
+          // create a new port
+          SUPERV::Port_var aPort = aINode->OutPort(item->PortName.latin1(), item->PortType.latin1());
+          myNode->createPort(aPort.in());
+        }
       }
-      // mkr : PAL8060 <--
     }
 
-    // creating Out-ports, except LoopNode-s
-    for ( i = 0; i < myOutList->count() && !isLoop; i++ ) {
-      item = (PortListItem*)myOutList->item( i );
-      aPort = aINode->OutPort( item->PortName.latin1(), item->PortType.latin1() );
-      myNode->createPort( aPort.in() );
-
-      // mkr : PAL8060
-      if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() )
-       // create links for those output ports, which had links earlier
-       createLinkEngine( aPort, OutPortsL, InPortsL );
-    }  
+    // 1.4 remove disappeared ports
+    QObjectListIt itRem ( portsToRemove );
+    QObject *objRem;
+    for (; (objRem = itRem.current()) != 0; ++itRem) {
+      ((SUPERVGUI_CanvasPort*)objRem)->remove();
+    }
 
     // 2. update the node's presentation
+    myNode->getPrs()->updatePorts();
     myNode->getMain()->getCanvas()->update();
   }
-  
+
   // 3. close the dialog
   myNode->getMain()->lockedGraph( false );
   QDialog::accept();
-  close();
 }
 
 /** 
@@ -555,12 +490,12 @@ void SUPERVGUI_ManagePortsDlg::init( const SUPERVGUI_CanvasNode* theNode ) {
     if ( aPorts[i]->IsGate() )
       continue;
     if ( aPorts[i]->IsInput()
-        &&
-        !myInList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332
+         &&
+         !myInList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332
       new PortListItem( myInList, aPorts[i]->Name(), aPorts[i]->Type() );
     if ( !aPorts[i]->IsInput()
-        &&
-        !myOutList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332 
+         &&
+         !myOutList->findItem( QString( "%1 (%2)" ).arg( aPorts[i]->Name() ).arg( aPorts[i]->Type() ) ) ) // mkr : PAL11332 
       new PortListItem( myOutList, aPorts[i]->Name(), aPorts[i]->Type() );
   }
 }
@@ -573,8 +508,8 @@ void SUPERVGUI_ManagePortsDlg::addPort( QListBox* theLB ) {
     bool found = false; // check if already exists -- and don't allow if yes
     for ( int i = 0; i < theLB->count(); i++ ) {
       if ( ((PortListItem*)theLB->item(i))->PortName == name ) {
-       found = true;
-       break;
+        found = true;
+        break;
       }
     }
     if ( found )
@@ -774,9 +709,12 @@ SUPERVGUI_PortParamsDlg::SUPERVGUI_PortParamsDlg(const QStringList& thePortsName
 void SUPERVGUI_PortParamsDlg::clickOnOk()
 {
   if (getName().isEmpty() || getType().isEmpty())
-    QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_CANT_CREATE_PORT" ) );
+    QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(),
+                         tr("ERROR"), tr("MSG_CANT_CREATE_PORT"));
   else if (myPortsNames.contains(getName()))
     QMessageBox::warning( this, tr("ERROR"), tr("MSG_PORT_EXIST") ); // mkr : IPAL10386
-  else  
+  else {
     accept();
+    close();
+  }
 }
index c0d7cf7eba9fb4f38584174ec399cd1528952b94..a6b976fca436624abd0946099f7932719988fffb 100644 (file)
@@ -516,12 +516,12 @@ SUPERV::LNode_ptr Graph_Impl::LNode( const char * InitName ,
       SALOME_ModuleCatalog::Service aVoidService = SALOME_ModuleCatalog::Service() ;
       char * anEndName ;
       if ( strlen( InitName ) ) {
-        anEndName = new char( 3 + strlen( InitName ) + 1 ) ;
+        anEndName = new char[ 3 + strlen( InitName ) + 1 ];
         strcpy( anEndName , "End" ) ;
         strcat( anEndName , InitName ) ;
       }
       else {
-        anEndName = new char( 3 + strlen( "Loop" ) + 1 ) ;
+        anEndName = new char[ 3 + strlen( "Loop" ) + 1 ];
         strcpy( anEndName , "EndLoop" ) ;
       }
       ELNode_Impl * myEndNode = new ELNode_Impl( _Orb , _Poa , _ContId ,