]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL17651
authorapo <apo@opencascade.com>
Sun, 25 Nov 2007 14:39:56 +0000 (14:39 +0000)
committerapo <apo@opencascade.com>
Sun, 25 Nov 2007 14:39:56 +0000 (14:39 +0000)
   4.x: "Xlib: unexpected async reply" during execution of the script attached to N7PAL15530.

src/VISU_I/VISU_View_i.cc

index c950f0dabeb6b717408c6e487101c238afc60642..c25f276cce809eb36801d4754f736738ea40b2b1 100644 (file)
@@ -1116,50 +1116,91 @@ namespace VISU {
     return -1;
   }
 
-  class TEnableGridEvent: public SALOME_Event
-  {
-  public:
-    typedef void (Plot2d_ViewFrame::* TFun)(bool, const int, bool, const int, bool);
-    TEnableGridEvent (Plot2d_ViewFrame* theView, TFun theFun,
-                     CORBA::Boolean theMajor, CORBA::Long theNumMajor,
-                     CORBA::Boolean theMinor, CORBA::Long theNumMinor):
-      myView(theView), myFun(theFun),
-      myMajor(theMajor), myNumMajor(theNumMajor),
-      myMinor(theMinor), myNumMinor(theNumMinor)
-    {}
-
-    virtual void Execute()
-    {
-      (myView->*myFun)(myMajor,myNumMajor,myMinor,myNumMinor,true);
-    }
-  protected:
-    Plot2d_ViewFrame* myView;
-    TFun myFun;
-    CORBA::Boolean myMajor, myMinor;
-    CORBA::Long myNumMajor, myNumMinor;
-  };
-
   void XYPlot_i::EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
                              CORBA::Boolean theMinor, CORBA::Long theNumMinor)
   {
-    if (GetViewWindow())
-      myView->setXGrid(theMajor,theNumMajor,theMinor,theNumMinor);
+    class TEvent: public SALOME_Event
+    {
+    public:
+      TEvent (Plot2d_ViewFrame* theView, 
+             CORBA::Boolean theMajor, 
+             CORBA::Long theNumMajor,
+             CORBA::Boolean theMinor, 
+             CORBA::Long theNumMinor):
+       myView(theView),
+       myMajor(theMajor), 
+       myNumMajor(theNumMajor),
+       myMinor(theMinor), 
+       myNumMinor(theNumMinor)
+      {}
+      
+      virtual void Execute()
+      {
+       myView->setXGrid( myMajor, myNumMajor, myMinor, myNumMinor );
+      }
+    protected:
+      Plot2d_ViewFrame* myView;
+      CORBA::Boolean myMajor, myMinor;
+      CORBA::Long myNumMajor, myNumMinor;
+    };
+
+    if ( GetViewWindow() )
+      ProcessVoidEvent( new TEvent( myView, theMajor, theNumMajor, theMinor, theNumMinor ) );
   }
-  void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
-                            CORBA::Boolean theMinor, CORBA::Long theNumMinor)
+  void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, 
+                            CORBA::Long theNumMajor,
+                            CORBA::Boolean theMinor, 
+                            CORBA::Long theNumMinor)
   {
-    this->EnableYGrid(theMajor,theNumMajor,theMinor,theNumMinor,
-                     false,0,false,0);
+    this->EnableYGrid( theMajor, theNumMajor, theMinor, theNumMinor, false, 0, false, 0 );
   }
 
-  void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
-                            CORBA::Boolean theMinor, CORBA::Long theNumMinor,
-                            CORBA::Boolean the2Major, CORBA::Long the2NumMajor,
-                            CORBA::Boolean the2Minor, CORBA::Long the2NumMinor)
+  void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor,
+                            CORBA::Long theNumMajor,
+                            CORBA::Boolean theMinor, 
+                            CORBA::Long theNumMinor,
+                            CORBA::Boolean the2Major, 
+                            CORBA::Long the2NumMajor,
+                            CORBA::Boolean the2Minor, 
+                            CORBA::Long the2NumMinor)
   {
+    class TEvent: public SALOME_Event
+    {
+    public:
+      TEvent (Plot2d_ViewFrame* theView, 
+             CORBA::Boolean theMajor,
+             CORBA::Long theNumMajor,
+             CORBA::Boolean theMinor, 
+             CORBA::Long theNumMinor,
+             CORBA::Boolean the2Major, 
+             CORBA::Long the2NumMajor,
+             CORBA::Boolean the2Minor, 
+             CORBA::Long the2NumMinor):
+       myView(theView),
+       myMajor(theMajor), 
+       myNumMajor(theNumMajor),
+       myMinor(theMinor), 
+       myNumMinor(theNumMinor),
+       my2Major(the2Major), 
+       my2NumMajor(the2NumMajor),
+       my2Minor(the2Minor), 
+       my2NumMinor(the2NumMinor)
+      {}
+      
+      virtual void Execute()
+      {
+       myView->setYGrid( myMajor, myNumMajor, myMinor, myNumMinor,
+                         my2Major, my2NumMajor, my2Minor, my2NumMinor);
+      }
+    protected:
+      Plot2d_ViewFrame* myView;
+      CORBA::Boolean myMajor, myMinor, my2Major, my2Minor;
+      CORBA::Long myNumMajor, myNumMinor, my2NumMajor, my2NumMinor;
+    };
+
     if (GetViewWindow())
-      myView->setYGrid(theMajor,theNumMajor,theMinor,theNumMinor,
-                       the2Major,the2NumMajor,the2Minor,the2NumMinor);
+      ProcessVoidEvent( new TEvent( myView, theMajor, theNumMajor, theMinor, theNumMinor, 
+                                   the2Major, the2NumMajor, the2Minor, the2NumMinor ) );
   }
   
   class TSetScaleModeEvent: public SALOME_Event