]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix on Bug GEOM6047 V1_4_1a
authorsmh <smh@opencascade.com>
Wed, 9 Jun 2004 11:37:28 +0000 (11:37 +0000)
committersmh <smh@opencascade.com>
Wed, 9 Jun 2004 11:37:28 +0000 (11:37 +0000)
  Script GEOM_example3.py freeze IAPP
(Now, salome.sg.updateObjBrowser(0) freeze the IAPP !!! )

src/VISU_I/VISU_ViewManager_i.cc

index 1ec6ddfbfb34859f81dcbb5d57ddb1be864443e0..4d4688adfe52b13639b53af10e306fb3fb1e7f52 100644 (file)
@@ -304,38 +304,36 @@ namespace VISU{
   }
 
 
-  VISU::View_ptr ViewManager_i::GetCurrentView(){
-    class TEvent: public SALOME_Event{
-      SALOMEDS::Study_ptr myStudyDocument;
-    public:
-      TEvent( SALOMEDS::Study_ptr theStudy):
-       myStudyDocument(theStudy)
-      {}
-      virtual void Execute(){
-       if(QAD_Study* aStudy = QAD_Application::getDesktop()->findStudy( myStudyDocument )){
-         if ( QAD_StudyFrame* aStudyFrame = aStudy->getActiveStudyFrame() ) {
-           if(MYDEBUG) 
-             MESSAGE("GetCurrentView::Execute - TypeView = "<<aStudyFrame->getTypeView());
-           if ( aStudyFrame->getTypeView() == VIEW_VTK ) {
-             VISU::View3D_i* pView = new View3D_i(myStudyDocument);
-             if(pView->Create(0)) 
-               myResult = pView->_this();
-           } else if ( aStudyFrame->getTypeView() == VIEW_PLOT2D ) {
-             VISU::XYPlot_i* pView = new XYPlot_i(myStudyDocument);
-             if(pView->Create(0)) 
-               myResult = pView->_this();
-           }
+  class TGetCurrentViewEvent: public SALOME_Event{
+    SALOMEDS::Study_ptr myStudyDocument;
+  public:
+    TGetCurrentViewEvent( SALOMEDS::Study_ptr theStudy):
+      myStudyDocument(theStudy),
+      myResult(VISU::View::_nil())
+    {}
+    virtual void Execute(){
+      if(QAD_Study* aStudy = QAD_Application::getDesktop()->findStudy( myStudyDocument )){
+       if ( QAD_StudyFrame* aStudyFrame = aStudy->getActiveStudyFrame() ) {
+         if(MYDEBUG) 
+           MESSAGE("GetCurrentView::Execute - TypeView = "<<aStudyFrame->getTypeView());
+         if ( aStudyFrame->getTypeView() == VIEW_VTK ) {
+           VISU::View3D_i* pView = new View3D_i(myStudyDocument);
+           if(pView->Create(0)) 
+             myResult = pView->_this();
+         } else if ( aStudyFrame->getTypeView() == VIEW_PLOT2D ) {
+           VISU::XYPlot_i* pView = new XYPlot_i(myStudyDocument);
+           if(pView->Create(0)) 
+             myResult = pView->_this();
          }
        }
       }
-      typedef VISU::View_var TResult;
-      TResult myResult;
-    };
-    TEvent* ve = new TEvent( myStudyDocument );
-    ve->process();
-    TEvent::TResult aResult = ve->myResult;
-    ve->release();
-    return aResult._retn();
+    }
+    typedef VISU::View_ptr TResult;
+    TResult myResult;
+  };
+
+  VISU::View_ptr ViewManager_i::GetCurrentView(){
+    return ProcessEvent(new TGetCurrentViewEvent( myStudyDocument ));
   }
   
   
@@ -381,31 +379,29 @@ namespace VISU{
   }
 
 
-  VISU::TableView_ptr ViewManager_i::CreateTableView(VISU::Table_ptr theTable){
-    class TEvent: public TCreateViewEvent{
-      Table_ptr myTable;
-    public:
-      TEvent(SALOMEDS::Study_ptr theStudy,
-            Table_ptr theTable):
-       TCreateViewEvent(theStudy),
-       myTable(theTable)
-      {}
-      virtual void Execute(){
-       if ( CheckStudy( myStudyDocument ) ) {
-         VISU::TableView_i* pView = new TableView_i(myStudyDocument);
-         if(pView->Create(myTable) != NULL) 
-           myResult = pView->_this();
-       }
+  class TCreateTableViewEvent: public TCreateViewEvent{
+    Table_ptr myTable;
+  public:
+    TCreateTableViewEvent(SALOMEDS::Study_ptr theStudy,
+                         Table_ptr theTable):
+      TCreateViewEvent(theStudy),
+      myTable(theTable),
+      myResult(VISU::TableView::_nil())
+    {}
+    virtual void Execute(){
+      if ( CheckStudy( myStudyDocument ) ) {
+       VISU::TableView_i* pView = new TableView_i(myStudyDocument);
+       if(pView->Create(myTable) != NULL) 
+         myResult = pView->_this();
       }
-      typedef VISU::TableView_var TResult;
-      TResult myResult;
-    };
+    }
+    typedef VISU::TableView_ptr TResult;
+    TResult myResult;
+  };
+
+  VISU::TableView_ptr ViewManager_i::CreateTableView(VISU::Table_ptr theTable){
     if(MYDEBUG) MESSAGE("ViewManager_i::CreateTableView");
-    TEvent* ve = new TEvent(myStudyDocument,theTable);
-    ve->process();
-    TEvent::TResult aResult = ve->myResult;
-    ve->release();
-    return aResult._retn();
+    return ProcessEvent(new TCreateTableViewEvent(myStudyDocument,theTable));
   }
 
 
@@ -741,11 +737,7 @@ namespace VISU{
 
 
   CORBA::Boolean XYPlot_i::SavePicture(const char* theFileName) {
-    TSavePictureEvent* ve = new TSavePictureEvent(myView->getViewWidget(),theFileName);
-    ve->process();
-    TSavePictureEvent::TResult aResult = ve->myResult;
-    ve->release();
-    return aResult;
+    return ProcessEvent(new TSavePictureEvent(myView->getViewWidget(),theFileName));
   }
 
 
@@ -847,11 +839,7 @@ namespace VISU{
 
 
   CORBA::Boolean View3D_i::SavePicture(const char* theFileName) {
-    TSavePictureEvent* ve = new TSavePictureEvent(myStudyFrame->getRightFrame()->getViewFrame()->getViewWidget(),theFileName);
-    ve->process();
-    TSavePictureEvent::TResult aResult = ve->myResult;
-    ve->release();
-    return aResult;
+    return ProcessEvent(new TSavePictureEvent(myStudyFrame->getRightFrame()->getViewFrame()->getViewWidget(),theFileName));
   }
 
 
@@ -918,27 +906,24 @@ namespace VISU{
   }
 
 
+  class TRestoreViewParamsEvent: public SALOME_Event{
+    QAD_StudyFrame* myStudyFrame;
+    const char* myName;
+  public:
+    TRestoreViewParamsEvent(QAD_StudyFrame* theStudyFrame,
+                           const char* theName):
+      myStudyFrame(theStudyFrame),
+      myName(theName)
+    {}
+    virtual void Execute(){
+      myResult = View3D_i::RestoreViewParams(myStudyFrame,myName);
+    }
+    typedef CORBA::Boolean TResult;
+    TResult myResult;
+  };
+
   CORBA::Boolean View3D_i::RestoreViewParams(const char* theName){
-    class TEvent: public SALOME_Event{
-      QAD_StudyFrame* myStudyFrame;
-      const char* myName;
-    public:
-      TEvent(QAD_StudyFrame* theStudyFrame,
-            const char* theName):
-       myStudyFrame(theStudyFrame),
-       myName(theName)
-      {}
-      virtual void Execute(){
-       myResult = RestoreViewParams(myStudyFrame,myName);
-      }
-      typedef CORBA::Boolean TResult;
-      TResult myResult;
-    };
-    TEvent* ve = new TEvent(myStudyFrame,theName);
-    ve->process();
-    TEvent::TResult aResult = ve->myResult;
-    ve->release();
-    return aResult;
+    return ProcessEvent(new TRestoreViewParamsEvent(myStudyFrame,theName));
   }
 
 
@@ -1343,9 +1328,7 @@ namespace VISU{
   };
 
   void VISU_Gen_i::CreateTestView() {
-    TestViewEvent* ve = new TestViewEvent();
-    ve->process();
-    ve->release();
+    ProcessVoidEvent(new TestViewEvent());
   }
 
 
@@ -1389,10 +1372,7 @@ namespace VISU{
   };
 
   void VISU_Gen_i::ShowTestObject() {
-    TestObjectEvent* ve = new TestObjectEvent();
-    ve->process();
-    ve->release();
-    return;
+    ProcessVoidEvent(new TestObjectEvent());
   }
   /*! SAN & VSR : Test QT_EVENT
     <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<