Salome HOME
BugID: IPAL10963, added a method setModifiedFlag to SUPERVGUI_Main and commented...
authorsrn <srn@opencascade.com>
Fri, 24 Mar 2006 08:26:52 +0000 (08:26 +0000)
committersrn <srn@opencascade.com>
Fri, 24 Mar 2006 08:26:52 +0000 (08:26 +0000)
src/SUPERVGUI/SUPERVGUI_DataModel.cxx
src/SUPERVGUI/SUPERVGUI_Main.cxx
src/SUPERVGUI/SUPERVGUI_Main.h

index e9cac640166fc66323c5f7a754dcea4b2720813a..0c2a7a3f76584163fd0970c94f3b65067fcdf1df 100644 (file)
@@ -79,8 +79,8 @@ bool SUPERVGUI_DataModel::close()
 //================================================================
 bool SUPERVGUI_DataModel::isModified() const
 {
-  SalomeApp_Study* study = getStudy();
-  if(study) return study->studyDS()->IsModified();
+  //SalomeApp_Study* study = getStudy();
+  //if(study) return study->studyDS()->IsModified();
   return false; 
 }
 
index e9160aa1dea2daba56b67fc2eb1d6e807b045127..ffec2139a0e304a3abaa707d6e12809278c16146 100644 (file)
@@ -649,6 +649,7 @@ void SUPERVGUI_Main::onPutInStudy( QString* theNodePortName )
          }
        }
       }
+      SUPERVGUI_Main::setModifiedFlag();  
     }
   }
 }
@@ -1270,7 +1271,9 @@ bool SUPERVGUI_Main::putDataStudy( SUPERV_Port p, const char* inout ) {
       aSupMod->updateObjBrowser();
   }
   else MESSAGE("NULL Supervision module!");
-  
+
+  SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
+  if(app) app->updateActions();  
   isIn = false;
   return true;
 }
@@ -1492,6 +1495,32 @@ void SUPERVGUI_Main::resizeView( QResizeEvent* theEvent )
       getCanvasArray()->resize( theEvent->size().width(), theEvent->size().height() );
 }
 
+/*!
+  Sets a modified flag in an active study
+ */
+void SUPERVGUI_Main::setModifiedFlag()
+{
+  SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
+  if(app) {
+    SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+    if(study) {
+      _PTR(Study) studyDS = study->studyDS();
+      _PTR(SComponent) sco = studyDS->FindComponent(STUDY_SUPERVISION);
+      if(sco) {
+       _PTR(StudyBuilder) builder = studyDS->NewBuilder();
+       _PTR(GenericAttribute) ga;
+       ga = builder->FindOrCreateAttribute(sco, "AttributeParameter");
+       _PTR(AttributeParameter) ap(ga);
+       if(ap) {
+         ap->SetBool("SUPERVISOR_MODIFIED_FLAG",1);
+         app->updateActions();
+       }
+      }
+    }
+  }
+}
+
+
 /******************************* SUPERVGUI_Thread class ****************************************/
 SUPERVGUI_Thread::SUPERVGUI_Thread()
      :QThread()
@@ -1753,3 +1782,4 @@ void SUPERVGUI_DSGraphParameters::accept() {
   }
   QDialog::accept();
 }
+
index a6a6ac83b10ca478e9de9a53a3b968d33fa59240..7af3055fa5d0d365fbada6645668a016167160df 100644 (file)
@@ -140,6 +140,11 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
     void setRunTime( QDateTime theRunTime ) { myRunTime = theRunTime; }
     QDateTime getRunTime() const { return myRunTime; }
 
+    // srn: marks an active study as being modified by the Supervisor
+    // Note: to set the modified flag the method requires that Supervision
+    //       component was previously added to study.
+    static void setModifiedFlag();
+
   signals:
     void KillMyThread(bool theValue);
     void EventToSync(); // mkr : IPAL11362