Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI.cxx
index 2442a9678132e3718b2dcb28396e6b0a3b5b889e..b1cf1a54e098667ade0a36fe1fa7f43c4583b495 100644 (file)
@@ -488,7 +488,8 @@ void SUPERVGUI::displayDataflow() {
       // second case : get empty initial view frame as new ViewFrame object
       aViewFrame = myInitialViewFrame;
       // mkr : PAL8237 : remove first "gag" Main from children
-      aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() );
+      // srn: commented as it cases on application exit "X Windows error"
+      //aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() );
     }
 
     if( aViewFrame ) {
@@ -538,6 +539,22 @@ void SUPERVGUI::renameDataflow() {
 
           updateObjBrowser();
           //QApplication::restoreOverrideCursor();
+
+         // mkr : PAL7037 => rename engine of the graph (i.e. corresponding SUPERV_Graph) -->
+          if ( obj->FindAttribute(anAttr, "AttributeIOR") ) {
+            _PTR(AttributeIOR) anIOR ( anAttr );
+            SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value().c_str());
+            if ( !SUPERV_isNull(aDataFlow) ) {
+              if ( aDataFlow->IsStreamGraph() ) {
+               SUPERV_StreamGraph aStreamDataFlow = aDataFlow->ToStreamGraph();
+                if ( !SUPERV_isNull(aStreamDataFlow) )
+                  aStreamDataFlow->SetName( nm.latin1() );
+              }
+              else
+                aDataFlow->SetName( nm.latin1() );
+            }
+          }
+         // mkr : PAL7037 <--
         }
       }
     }
@@ -679,7 +696,8 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode, bool theInitialDF ) {
     // 2. get empty initial view frame as new ViewFrame object
     aViewFrame = myInitialViewFrame;
     // mkr : PAL8237 : remove first "gag" Main from children
-    aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() );
+    // srn: commented as it cases on application exit "X Windows error"
+    //aViewFrame->removeChild( aViewFrame->queryList("SUPERVGUI_Main")->first() );
   }
 
   if ( aViewFrame ) {
@@ -1023,3 +1041,20 @@ void SUPERVGUI::fillInterfaceNameMap() {
 QMap<QString, QString> SUPERVGUI::getInterfaceNameMap() const {
   return myInterfaceNameMap;
 }
+
+bool SUPERVGUI::updateDataFlowSOName( SUPERV::Graph_ptr theDataflow ) {
+  if ( !SUPERV_isNull(theDataflow) ) {
+    _PTR(Study) aStudy = (( SalomeApp_Study* )study)->studyDS();
+    _PTR(SObject) aSO ( aStudy->FindObjectIOR( theDataflow->getIOR() ) );
+
+    _PTR(GenericAttribute) anAttr;
+    if ( aSO ) // i.e. if theDataflow is in study
+      if ( aSO->FindAttribute(anAttr, "AttributeName") ) {
+        _PTR(AttributeName) aName ( anAttr );
+       aName->SetValue( theDataflow->Name() );
+       updateObjBrowser();
+       return true;
+      }    
+  }
+  return false;
+}