Salome HOME
Bug fix: don't set "Loading" state for MacroNodes in InitialState() function (called...
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_CanvasNode.cxx
index d3d85eab11cd1230a41e2685d54da13a51b46f81..f2118629ad410f8d1813c0309bab76bc3952b033 100644 (file)
@@ -11,7 +11,6 @@ using namespace std;
 #include "SUPERVGUI_CanvasNodePrs.h"
 #include "SUPERVGUI_CanvasPort.h"
 #include "SUPERVGUI_Main.h"
-#include "SUPERVGUI_Python.h"
 #include "SUPERVGUI.h"
 #include "SUPERVGUI_BrowseNodeDlg.h"
 #include "SUPERVGUI_ManagePortsDlg.h"
@@ -23,7 +22,7 @@ using namespace std;
 #include <qtooltip.h>
 */
 
-SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
+SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode, bool theIsCell):
     QObject(theParent),
     myMain(theMain),
     myNode(theNode),
@@ -75,6 +74,9 @@ SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode(QObject* theParent, SUPERVGUI_Main* t
   }
 
   isIgnore = false;
+
+  QCanvasItemList anIL2 = ((QCanvas*)parent())->allItems();
+  cout<<" ===> 1 conatructor CanvasNode : CanvasArray has "<<anIL2.count()<<" children!"<<endl;
 }
 
 SUPERVGUI_CanvasNode::~SUPERVGUI_CanvasNode()
@@ -150,7 +152,7 @@ QPopupMenu* SUPERVGUI_CanvasNode::getPopupMenu(QWidget* theParent)
     if (myMain->isEditable() && getNodeType() != SUPERV::EndLoopNode
                              && getNodeType() != SUPERV::EndSwitchNode) {
       popup->insertItem(tr("MSG_RENAME"), this, SLOT(rename()));
-      popup->insertItem(tr("MSG_DELETE"), this, SLOT(remove()));
+      myDeleteItem = popup->insertItem(tr("MSG_DELETE"), this, SLOT(remove()));
       popup->insertSeparator();
     }
     popup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
@@ -275,8 +277,9 @@ void SUPERVGUI_CanvasNode::sync()
 {
   //MESSAGE("===> SUPERVGUI_CanvasNode::sync() " << myNode->Name() << ", state " << myNode->State());
 
+  const bool isExecuting = myMain->getDataflow()->IsExecuting();
   //if myNode is a MacroNode then set it state to state of its subgraph
-  if (myNode->IsMacro() && myMain->getDataflow()->IsExecuting()) {
+  if ( myNode->IsMacro() && isExecuting ) {
     // get SubGraph from MacroNode
     SUPERV_Graph aMacro = SUPERV::Graph::_narrow(myNode);
     if (!SUPERV_isNull(aMacro)) {
@@ -293,8 +296,16 @@ void SUPERVGUI_CanvasNode::sync()
       }
     }
   }
-  else 
-    getPrs()->setState(myNode->State());
+  else {
+    SUPERV::GraphState aState = myNode->State();
+
+    // asv : 18.11.04 : fix for 6170 : after execution is finished, nodes' status must be reset.
+    // asv : 13.12.04 : commented out setting EditingState.  See 2.21.
+    //if ( !isExecuting && myMain->IsGUIEventLoopFinished() && (aState == SUPERV::DoneState || 
+    //  aState == SUPERV::KillState || aState == SUPERV::StopState ) )
+    //  aState = SUPERV::EditingState;
+    getPrs()->setState(aState);
+  }
   
   // update child ports
   const QObjectList* list = children();
@@ -402,6 +413,7 @@ void SUPERVGUI_CanvasNode::changeInformation() {
   delete aDlg;
 }
 
+/* asv : 13.12.04 : The functions below are not called from anywhere, so commenting them out...
 void SUPERVGUI_CanvasNode::configure() 
 {
   Trace("SUPERVGUI_CanvasNode::configure");
@@ -414,6 +426,7 @@ void SUPERVGUI_CanvasNode::showPython()
   SUPERVGUI_Python cp(myMain->getStudy()->get_PyInterp(), !myMain->isEditable());
   cp.exec();
 }
+*/
 
 bool SUPERVGUI_CanvasNode::isWarning() 
 {