Salome HOME
Memory Leaks
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI.cxx
index 811600dce436addfc3d69180e60fcd7d6a4551e6..d8055e4608ea2621e6ae1c350b234e550dc85484 100644 (file)
@@ -308,7 +308,6 @@ void SUPERVGUI::displayDataflow() {
       (aStudyFrame->getRightFrame()->getViewFrame());
     if(aViewFrame) {
       main = new SUPERVGUI_Main(aViewFrame, desktop, aDataFlow);
-      main->setAsFromStudy(true);
       registerGraph(aIORName, main);
       study->showFrame(aStudyFrame);
     }
@@ -454,7 +453,7 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) {
     aGraph = engine->StreamGraph( MAIN_NEW );
 
   if ( CORBA::is_nil( aGraph ) ) {
-    QString msg( mode == New ? QString("MSG_CANT_CREATE_DF") : QString("MSG_BAD_FILE").arg(f) );
+    QString msg( mode == New ? tr("MSG_CANT_CREATE_DF") : tr("MSG_BAD_FILE").arg(f) );
     QAD_MessageBox::warn1( QAD_Application::getDesktop(), tr("ERROR"), tr(msg), tr("BUT_OK") );
     return false;
   }
@@ -478,62 +477,56 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) {
 }
 
 void SUPERVGUI::reloadDataflow() {
-    Trace("SUPERVGUI::reloadDataflow")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RELOAD"));
-    } else {
-        main->sync();
-    };
+  Trace("SUPERVGUI::reloadDataflow");
+  if ( main )  
+    main->sync();
+  else 
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RELOAD"));
 }
 
 void SUPERVGUI::runDataflow() {
-    Trace("SUPERVGUI::runDataflow")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
-    } else {
-        main->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag 
-        main->run();
-    };
+  Trace("SUPERVGUI::runDataflow");
+  if ( main )
+    main->run( /*andSuspend=*/false );
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
 }
 
 void SUPERVGUI::stepByStep() {
-    Trace("SUPERVGUI::stepByStep")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
-    } else {
-        main->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag 
-        main->startExecute();
-    }
+  Trace("SUPERVGUI::stepByStep");
+  if ( main )
+    main->run( /*andSuspend=*/true );
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
 }
 
 void SUPERVGUI::killDataflow() {
-    Trace("SUPERVGUI::killDataflow")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_KILL"));
-    } else {
-        main->kill();
-    };
+  Trace("SUPERVGUI::killDataflow");
+  if ( main )
+    main->kill();
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_KILL"));
 }
 
 void SUPERVGUI::suspendResumeDataflow() {
-    Trace("SUPERVGUI::suspendResumeDataflow")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_SUSPEND"));
-    } else {
-        main->suspendResume();
-    };
+  Trace("SUPERVGUI::suspendResumeDataflow");
+  if ( main )
+    main->suspendResume();
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_SUSPEND"));
 }
 
 void SUPERVGUI::showComponents() {
   Trace("SUPERVGUI::showComponents");
-  if (main==0) {
-    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_ADD"));
-  } else {
-    if (main->isEditable())
+  if ( main ) {
+    if ( main->isEditable() )
       main->addNode();
     else
       QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOTEDITABLE"));
   }
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_ADD"));
+
 }
 
 
@@ -659,21 +652,6 @@ void SUPERVGUI::deleteObject() {
     
     SALOMEDS::SObject_var  aObj = aStudy->FindObjectID( anIObj->getEntry() );
     if (!aObj->_is_nil()) {
-      if (aIsDataflow) {
-       SALOMEDS::GenericAttribute_var anAttr;
-       if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
-         SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-         QString ior = anIOR->Value();
-           
-         SUPERVGUI_Main* aMain;
-         for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
-           if ((aMain->getStudy() == study) && (aMain->getHashCode() == ior)) {
-             aMain->setAsFromStudy(false);
-             break;
-           }
-         }
-        }
-      }
       QAD_Operation* op = new SALOMEGUI_ImportOperation( study );
       SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
       op->start();