Salome HOME
Fix for IPAL10175 : Result of Dataflow execution is not add in study.
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Main.cxx
index b30721359265ed68a0f9044e9fdba350603580bd..0b858393313d41daee986941dc092f606351501a 100644 (file)
@@ -244,6 +244,13 @@ void SUPERVGUI_Main::filterNotification() {
   }
 }
 
+void SUPERVGUI_Main::changeDSGraphParameters() {
+  SUPERVGUI_DSGraphParameters* aDlg = new SUPERVGUI_DSGraphParameters(dataflow, dataflow->IsReadOnly());
+  if (aDlg->exec() )
+    sync();
+  delete aDlg;
+}
+
 void SUPERVGUI_Main::syncAsync() {
   Trace("SUPERVGUI_Main::syncAsync");
   QTimer::singleShot(1, this, SLOT(sync()));
@@ -956,6 +963,8 @@ void SUPERVGUI_Main::addDataflowToStudy() {
 bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
   Trace("SUPERVGUI_Main::putDataStudy");
 
+  bool PublishOtherComponent = false;
+
   // static variable to ensure that only one instance (thread) is executing this function 
   static bool isIn = false;
   if (isIn)   return true; 
@@ -1035,6 +1044,7 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
            if ( !aSStudy ) return false;
            aTmpSO = aDriver->PublishInStudy( aSStudy->GetStudy(), aTmpSO, anObject, "" );
            aBuilder->Addreference(aSO, _PTR(SObject)(new SALOMEDS_SObject( aTmpSO )) );
+           PublishOtherComponent = true;
          } 
          else { // can't publish object: abort transaction
            MESSAGE( "CanPublishInStudy() returned FALSE.  ok, AbortCommand.." );
@@ -1045,8 +1055,11 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
        }
        else { // component has no driver, but could store IORs (like Calculator)
          _PTR(SObject) anIORSO ( aStudy->FindObjectIOR( p->ToString() ) );
-         if ( anIORSO )
+         if ( anIORSO ) {
            aBuilder->Addreference(aSO, anIORSO);
+           // mkr : IPAL9672
+           PublishOtherComponent = true;
+         }
          else { // Hm... the object (==port value) was not found, so we don't publish it.
            MESSAGE( "The object (==port value) was not found, so we don't publish it" );
            aBuilder->AbortCommand();
@@ -1056,10 +1069,18 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
        }
       }
       else { // FNode is NULL -> bad
-       MESSAGE( "FNode is NULL.  Not good at all.  Aborting command." );
-       aBuilder->AbortCommand();
-       isIn = false;
-       return false;
+       MESSAGE( "FNode is NULL." );
+       if ( SUPERV::INode::_narrow( p->Node() ) ) { // mkr : IPAL10175
+         _PTR(SObject) anIORSO ( aStudy->FindObjectIOR( p->ToString() ) );
+         if ( anIORSO )
+           aBuilder->Addreference(aSO, anIORSO);
+       }
+       else {
+         MESSAGE( "FNode and INode are NULL.  Not good at all.  Aborting command." );
+         aBuilder->AbortCommand();
+         isIn = false;
+         return false;
+       }
       }
     } 
     else {
@@ -1071,14 +1092,16 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
     aBuilder->CommitCommand();
   else
     aBuilder->AbortCommand();
-  
-  if ( !myThread->running() ) {
-    SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
-    if ( aSupMod ) 
+
+  SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+  if ( aSupMod ) {
+    if ( PublishOtherComponent )
+      dynamic_cast<SalomeApp_Application*>( study->application() )->updateObjectBrowser(true);
+    else
       aSupMod->updateObjBrowser();
-    else MESSAGE("NULL Supervision module!");
   }
-
+  else MESSAGE("NULL Supervision module!");
+  
   isIn = false;
   return true;
 }
@@ -1114,14 +1137,14 @@ void SUPERVGUI_Main::syncNotification() {
   long  stamp;
   
   while (notification->Receive(&graph, &node, &type, &message, &sender, &counter, &date, &stamp)) {
-    if (isFiltered(graph, node, type, message, sender, counter, date, stamp)) {
+//    if (isFiltered(graph, node, type, message, sender, counter, date, stamp)) {
       QString mess("");
       mess += "NOTIF: "; mess += graph;
       mess += " / "    ; mess += node;
       mess += " / "    ; mess += type;
       mess += " / "    ; mess += message;
       getMessage()->putMessage(mess.latin1());
-    };
+//    };
   };
 }
   
@@ -1278,6 +1301,20 @@ bool SUPERVGUI_Main::ReadyToModify() {
   return true;
 }
 
+void SUPERVGUI_Main::resizeView( QResizeEvent* theEvent )
+{
+  if ( (myCurrentView == CANVAS || myCurrentView == CONTROLFLOW) && getCanvas() )
+    if ( getCanvas()->width() < theEvent->size().width()
+        ||
+        getCanvas()->height() < theEvent->size().height() )
+      getCanvas()->resize( theEvent->size().width(), theEvent->size().height() );
+  if ( myCurrentView == CANVASTABLE && getCanvasArray() )
+    if ( getCanvasArray()->width() < theEvent->size().width()
+        ||
+        getCanvasArray()->height() < theEvent->size().height() )
+      getCanvasArray()->resize( theEvent->size().width(), theEvent->size().height() );
+}
+
 /******************************* SUPERVGUI_Thread class ****************************************/
 SUPERVGUI_Thread::SUPERVGUI_Thread()
      :QThread()
@@ -1330,6 +1367,9 @@ void SUPERVGUI_Thread::run()
     // blocking function of Engine.  Return from there only after anEvent happens on node aNode
     myMain->getDataflow()->Event(aNode, aEvent, aState);
     
+    // in case node "said" something during changing state through notification mechanism - output it
+    myMain->syncNotification();
+    
     // "kill" or undefined event came
     if (( aEvent == SUPERV::UndefinedEvent && aState == SUPERV::UndefinedState ) ||
        ( aEvent == SUPERV::NoEvent && aState == SUPERV::NoState ) ||