Index: trunk/source/visualization/OpenGL/History
===================================================================
--- trunk/source/visualization/OpenGL/History	(revision 872)
+++ trunk/source/visualization/OpenGL/History	(revision 873)
@@ -1,3 +1,3 @@
-$Id: History,v 1.118 2008/10/15 10:33:27 lgarnier Exp $
+$Id: History,v 1.119 2008/10/24 13:49:19 lgarnier Exp $
 -------------------------------------------------------------------
 
@@ -20,4 +20,8 @@
 History file for visualization/OpenGL
 -------------------------------------
+
+24 October, Laurent Garnier
+ - Change GEANT4_QT_DEBUG flag by QTDEBUG
+ - Suppress unuseful DEBUG messages
 
 12th October Laurent Garnier
Index: trunk/source/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh
===================================================================
--- trunk/source/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh	(revision 872)
+++ trunk/source/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh	(revision 873)
@@ -62,7 +62,12 @@
   void updateQWidget();
 
-private : 
-  int readyToPaint;
-  int nbPaint;
+protected:
+  void wheelEvent(QWheelEvent *event);
+  void mousePressEvent(QMouseEvent *event);
+  void mouseMoveEvent(QMouseEvent *event);
+  void mouseDoubleClickEvent(QMouseEvent *event);
+  void mouseReleaseEvent(QMouseEvent *event);
+  void contextMenuEvent(QContextMenuEvent *e);
+  void keyPressEvent (QKeyEvent * event); 
 };
 
Index: trunk/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh
===================================================================
--- trunk/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh	(revision 872)
+++ trunk/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh	(revision 873)
@@ -106,17 +106,10 @@
   void CreateGLQtContext ();
   virtual void CreateMainWindow (QGLWidget*,QString);
-  void manageContextMenuEvent(QContextMenuEvent *e);
-#if QT_VERSION < 0x040000
-  void G4MousePressEvent(QPoint);
-#else
-  void G4MousePressEvent(QPoint);
-#endif
+  void G4resizeGL(int, int);
+  void G4manageContextMenuEvent(QContextMenuEvent *e);
+  void G4MousePressEvent(QMouseEvent *event);
   void G4MouseReleaseEvent();
-  void G4MouseDoubleClickEvent(QPoint p);
-#if QT_VERSION < 0x040000
-  void G4MouseMoveEvent(int, int, Qt::ButtonState);
-#else
-  void G4MouseMoveEvent(int, int, Qt::MouseButtons);
-#endif
+  void G4MouseDoubleClickEvent();
+  void G4MouseMoveEvent(QMouseEvent *event);
   void G4wheelEvent (QWheelEvent * event); 
   void G4keyPressEvent (QKeyEvent * event); 
@@ -124,4 +117,5 @@
   void rotateQtCamera(float, float);
   void moveScene(float, float, float,bool);
+  void FinishView();
 
 
@@ -140,4 +134,10 @@
   float fDeltaRotationAngleY;
   float fDeltaRotationAngleZ;
+
+  bool hasToRepaint;
+  bool readyToPaint;
+  bool zoomAction;
+  QPoint beginZoom;
+  QPoint endZoom;
 
 private:
Index: trunk/source/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh
===================================================================
--- trunk/source/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh	(revision 872)
+++ trunk/source/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh	(revision 873)
@@ -59,5 +59,4 @@
   void initializeGL ();
   void DrawView ();
-  void FinishView ();
   void resizeGL(int width,int height);
   void paintGL();
@@ -73,11 +72,4 @@
   void keyPressEvent (QKeyEvent * event); 
 
-private : 
-  bool hasToRepaint;
-  bool readyToPaint;
-  bool zoomAction;
-  int nbPaint;
-  QPoint beginZoom;
-  QPoint endZoom;
   //  QImage glBufferImage;
 };
Index: trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQt.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQt.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQt.cc	(revision 873)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4OpenGLImmediateQt.cc,v 1.3 2008/10/15 10:26:25 lgarnier Exp $
+// $Id: G4OpenGLImmediateQt.cc,v 1.4 2008/10/24 13:49:19 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -58,5 +58,5 @@
 G4VViewer* G4OpenGLImmediateQt::CreateViewer
 (G4VSceneHandler& scene, const G4String& name) {
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
   printf("G4OpenGLImmediateQt::CreateViewer \n");
 #endif
@@ -78,5 +78,5 @@
       " new G4OpenGLImmediateQtViewer." << G4endl;
   }
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
   printf("G4OpenGLImmediateQt::CreateViewer END \n");
 #endif
Index: trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc	(revision 873)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4OpenGLImmediateQtViewer.cc,v 1.5 2008/10/15 10:24:04 lgarnier Exp $
+// $Id: G4OpenGLImmediateQtViewer.cc,v 1.6 2008/10/24 13:49:19 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -35,5 +35,4 @@
 
 #include "G4OpenGLImmediateQtViewer.hh"
-#include "G4VisManager.hh"
 
 #include "G4ios.hh"
@@ -42,200 +41,217 @@
 (G4OpenGLImmediateSceneHandler& sceneHandler,
  const G4String&  name):
- G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
- G4OpenGLViewer (sceneHandler),
- G4OpenGLQtViewer (sceneHandler),
- G4OpenGLImmediateViewer (sceneHandler),
- QGLWidget()                      // FIXME : gerer le pb du parent !
- {
-   nbPaint =0;
+  G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+  G4OpenGLViewer (sceneHandler),
+  G4OpenGLQtViewer (sceneHandler),
+  G4OpenGLImmediateViewer (sceneHandler)
+{
+
+  //set true to picking
+  fVP.SetPicking(true);
+#if QT_VERSION < 0x040000
+  setFocusPolicy(QWidget::StrongFocus); // enable keybord events
+#else
+  setFocusPolicy(Qt::StrongFocus); // enable keybord events
+#endif
+  hasToRepaint =false;
+
   if (fViewId < 0) return;  // In case error in base class instantiation.
 }
 
 G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQtViewer() {
-#ifdef GEANT4_QT_DEBUG
-   printf("GLWidget::~GLWidget \n");
-#endif
-     makeCurrent();
-#ifdef GEANT4_QT_DEBUG
-   printf("GLWidget::~GLWidget END\n");
-#endif
+  makeCurrent();
 }
 
 void G4OpenGLImmediateQtViewer::Initialise() {
-#ifdef GEANT4_QT_DEBUG
-   printf("GLWidget::Initialise \n");
-#endif
-#ifdef GEANT4_QT_DEBUG
-   printf("readyToPaint = false \n");
-#endif
-   readyToPaint = false;
-   CreateGLQtContext ();
-#ifdef GEANT4_QT_DEBUG
-   printf("G4OpenGLImmediateQtViewer::Initialise () 2\n");
-#endif
-
-   CreateMainWindow (this,QString(fName));
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLImmediateQtViewer::Initialise () 3\n");
-#endif
-
-  CreateFontLists ();  // FIXME Does nothing!
-  
-#ifdef GEANT4_QT_DEBUG
-  printf("readyToPaint = true \n");
-#endif
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::Initialise \n");
+#endif
+  readyToPaint = false;
+  CreateMainWindow (this,QString(fName));
+  CreateFontLists ();
+
   readyToPaint = true;
-  
-  // First Draw
+}
+
+void G4OpenGLImmediateQtViewer::initializeGL () {
+
+  InitializeGLView ();
+
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::InitialiseGL ()\n");
+#endif
+
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  //   glDrawBuffer (GL_FRONT); // FIXME : Ne marche pas avec cette ligne, mais affiche le run correctement...
+  // clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+
+  if (fSceneHandler.GetScene() == 0) {
+    hasToRepaint =false;
+  } else {
+    hasToRepaint =true;
+  }
+
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::InitialiseGL END\n");
+#endif
+}
+
+
+void G4OpenGLImmediateQtViewer::DrawView () {
+
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::DrawView %d %d   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
+#endif
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  //  glDrawBuffer (GL_FRONT);
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //Make sure current viewer is attached and clean...
+  //Qt version needed
+  glViewport (0, 0, WinSize_x, WinSize_y);
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    NeedKernelVisit ();
+    ProcessView ();
+    glFlush ();
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::DrawView First ProcessView ok\n");
+#endif
+    HaloingSecondPass ();
+
+  }
+
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::DrawView before needKernelVisit %d\n",fNeedKernelVisit);
+#endif
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::DrawView before ProcessView\n");
+#endif
+  ProcessView ();
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::DrawView before FinishView ok\n");
+#endif
+  FinishView ();
+
+  if (isRecording()) {
+    savePPMToTemp();
+  }
+   
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::DrawView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",WinSize_x, WinSize_y);
+#endif
+  hasToRepaint = true;
+}
+
+void G4OpenGLImmediateQtViewer::FinishView()
+{
+   glFlush ();
+}
+
+
+/**
+   - Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
+*/
+void G4OpenGLImmediateQtViewer::resizeGL(
+                                         int aWidth
+                                         ,int aHeight)
+{  
+  G4resizeGL(aWidth,aHeight);
+}
+
+
+void G4OpenGLImmediateQtViewer::paintGL()
+{
+#ifdef G4DEBUG
+  printf("\n\nG4OpenGLImmediateQtViewer::paintGL ??\n");
+#endif
+  if (!readyToPaint) {
+    readyToPaint= true;
+    return;
+  }
+  // DO NOT RESIZE IF SIZE HAS NOT CHANGE
+  if ( !hasToRepaint) {
+    if (((WinSize_x == (G4int)width())) &&(WinSize_y == (G4int) height())) {
+      return;
+    }
+  }
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",readyToPaint);
+#endif
+  WinSize_x = (G4int) width();
+  WinSize_y = (G4int) height();
+
+  setupViewport(width(),height());
+
   SetView();
-#ifdef GEANT4_QT_DEBUG
-  printf("    ClearView\n");
-#endif
+   
   ClearView (); //ok, put the background correct
-  ShowView();
-  FinishView();
-}
-
-void G4OpenGLImmediateQtViewer::initializeGL () {
-
-   InitializeGLView ();
-
-#ifdef GEANT4_QT_DEBUG
-   printf("G4OpenGLImmediateQtViewer::InitialiseGL () 1\n");
-#endif
-
-   // If a double buffer context has been forced upon us, ignore the
-   // back buffer for this OpenGLImmediate view.
-   glDrawBuffer (GL_FRONT); // FIXME : Ne marche pas avec cette ligne, mais affiche le run correctement...
-   // clear the buffers and window.
-   ClearView ();
-#ifdef GEANT4_QT_DEBUG
-   //   printf("G4OpenGLImmediateQtViewer::InitialiseGL () 2\n");
-#endif
-   FinishView ();
-   
-
-
-   glDepthFunc (GL_LEQUAL);
-   glDepthMask (GL_TRUE);
-
-#ifdef GEANT4_QT_DEBUG
-   printf("G4OpenGLImmediateQtViewer::InitialiseGL  -------------------------------------------------------------------------------------\n");
-#endif
-}
-
-
-void G4OpenGLImmediateQtViewer::DrawView () {
-
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLImmediateQtViewer::DrawView %d %d   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
-#endif
-   // If a double buffer context has been forced upon us, ignore the
-   // back buffer for this OpenGLImmediate view.
-  glDrawBuffer (GL_FRONT);
-
-   G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
-
-   //Make sure current viewer is attached and clean...
-   //Qt version needed
-   //   glViewport (0, 0, WinSize_x, WinSize_y);
-
-   if(style!=G4ViewParameters::hlr &&
-      haloing_enabled) {
-#ifdef GEANT4_QT_DEBUG
-     printf("G4OpenGLImmediateQtViewer::DrawView DANS LE IF\n");
-#endif
-
-     HaloingFirstPass ();
-     NeedKernelVisit ();
-     ProcessView ();
-     glFlush ();
-
-     HaloingSecondPass ();
-
-   }
-
-   NeedKernelVisit ();  // Always need to visit G4 kernel.
-   ProcessView ();
-   FinishView ();
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLImmediateQtViewer::DrawView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",WinSize_x, WinSize_y);
-#endif
-  readyToPaint = false;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////
-void G4OpenGLImmediateQtViewer::FinishView (
-) 
-//////////////////////////////////////////////////////////////////////////////
-//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
-{
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLImmediateQtViewer::FinishView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
-#endif
-
-   glFlush ();
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLImmediateQtViewer::FinishView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
-#endif
-
-}
-
+  DrawView();
+
+  hasToRepaint = false; // could be set to false by DrawView
+
+
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n\n\n",readyToPaint);
+#endif
+}
+
+void G4OpenGLImmediateQtViewer::mousePressEvent(QMouseEvent *event)
+{
+  G4MousePressEvent(event);
+}
+
+void G4OpenGLImmediateQtViewer::keyPressEvent (QKeyEvent * event) 
+{
+  G4keyPressEvent(event);
+}
+
+void G4OpenGLImmediateQtViewer::wheelEvent (QWheelEvent * event) 
+{
+  G4wheelEvent(event);
+}
 
 /**
- - Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
+ * This function was build in order to make a zoom on double clic event.
+ * It was think to build a rubberband on the zoom area, but never work fine
  */
-void G4OpenGLImmediateQtViewer::resizeGL(
- int width
-,int height)
-{  
-  setupViewport(width,height);
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLImmediateQtViewer::resizeGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
-#endif
-}
-
-
-void G4OpenGLImmediateQtViewer::paintGL()
- {
-   if (!readyToPaint) {
-     readyToPaint= true;
-     return;
-   }
-   // DO NOT RESIZE IF SIZE HAS NOT CHANGE
-   if (((WinSize_x == (G4int)width())) &&(WinSize_y == (G4int) height())) {
-     return;
-   }
-   nbPaint++;
-#ifdef GEANT4_QT_DEBUG
-   printf("\n\nG4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV %d ready %d\n",nbPaint,readyToPaint);
-#endif
-   WinSize_x = (G4int) width();
-   WinSize_y = (G4int) height();
-
-   setupViewport(width(),height());
-
-   SetView();
-#ifdef GEANT4_QT_DEBUG
-//   //  printf("before ClearView\n");
-#endif
-#ifdef GEANT4_QT_DEBUG
-   printf("    ClearView\n");
-#endif
-   
-   ClearView (); //ok, put the background correct
-   DrawView();
-   readyToPaint = true; // could be set to false by DrawView
-
-
-#ifdef GEANT4_QT_DEBUG
-   printf("G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d ready %d\n\n\n",nbPaint,readyToPaint);
-#endif
- }
+void G4OpenGLImmediateQtViewer::mouseDoubleClickEvent(QMouseEvent *event)
+{
+  G4MouseDoubleClickEvent();
+}
+
+void G4OpenGLImmediateQtViewer::mouseReleaseEvent(QMouseEvent *event)
+{
+  G4MouseReleaseEvent();
+}
+
+void G4OpenGLImmediateQtViewer::mouseMoveEvent(QMouseEvent *event)
+{
+  G4MouseMoveEvent(event);
+}
+
+
+void G4OpenGLImmediateQtViewer::contextMenuEvent(QContextMenuEvent *e)
+{
+  G4manageContextMenuEvent(e);
+}
 
 void G4OpenGLImmediateQtViewer::updateQWidget() {
+  hasToRepaint= true;
   updateGL();
-}
-
-#endif
+  hasToRepaint= false;
+}
+
+#endif
Index: trunk/source/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc	(revision 873)
@@ -209,4 +209,5 @@
     fpViewer -> SetView ();
     fpViewer -> ClearView ();
+    printf("G4OpenGLImmediateSceneHandler::ClearTransientStore----------------------------------------------\n");
     fpViewer -> DrawView ();
   }
Index: trunk/source/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc	(revision 873)
@@ -88,4 +88,7 @@
 void G4OpenGLImmediateXmViewer::DrawView () {
 
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateXmViewer::DrawView %d %d   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
+#endif
   G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
 
@@ -101,4 +104,7 @@
     ProcessView ();
     glFlush ();
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateXmViewer::DrawView First ProcessView ok\n");
+#endif
 
     HaloingSecondPass ();
@@ -106,6 +112,15 @@
   }
 
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateXmViewer::DrawView before needKernelVisit %d\n",fNeedKernelVisit);
+#endif
   NeedKernelVisit ();  // Always need to visit G4 kernel.
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateXmViewer::DrawView before ProcessView\n");
+#endif
   ProcessView ();
+#ifdef G4DEBUG
+  printf("G4OpenGLImmediateXmViewer::DrawView before FinishView ok\n");
+#endif
   FinishView ();
 
Index: trunk/source/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc	(revision 873)
@@ -25,10 +25,9 @@
 //
 //
-// $Id: G4OpenGLQtExportDialog.cc,v 1.7 2008/03/10 16:57:04 lgarnier Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4OpenGLQtExportDialog.cc,v 1.9 2008/10/24 14:17:10 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
 
-//#define GEANT4_QT_DEBUG
 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
 
Index: trunk/source/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLQtMovieDialog.cc	(revision 873)
@@ -25,10 +25,9 @@
 //
 //
-// $Id: G4OpenGLQtMovieDialog.cc,v 1.6 2008/03/14 09:22:31 lgarnier Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4OpenGLQtMovieDialog.cc,v 1.8 2008/10/24 13:49:19 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
 
-//#define GEANT4_QT_DEBUG
 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
 
Index: trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 873)
@@ -36,6 +36,4 @@
 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
 
-//#define GEANT4_QT_DEBUG
-
 #include "G4OpenGLQtViewer.hh"
 
@@ -88,15 +86,8 @@
 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::SetView ++++++++++++++++++++\n");
-#endif
-  //   if(!fHDC) return;
-  //   if(!fHGLRC) return;
-  //   ::wglMakeCurrent(fHDC,fHGLRC);
-  //  fWindow->makeCurrent();
+#ifdef G4DEBUG
+  printf("G4OpenGLQtViewer::SetView\n");
+#endif
   G4OpenGLViewer::SetView ();
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::SetView --------------------\n");
-#endif
 }
 
@@ -126,7 +117,4 @@
 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::ShowView  +++++++++++++++++++++\n");
-#endif
   if (!GLWindow) {
     G4cerr << "Visualization window not defined, please choose one before\n" << G4endl;
@@ -137,29 +125,9 @@
     GLWindow->activateWindow();
 #endif
-#ifdef GEANT4_QT_DEBUG
-    printf("G4OpenGLQtViewer::ShowView -----------------------\n");
-#endif
   }
   glFlush ();
-  //   // Empty the Windows message queue :
-  //   MSG event;
-  //   while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
-  //     ::TranslateMessage(&event);
-  //     ::DispatchMessage (&event);
-  //   }
-}
-
-
-
-//////////////////////////////////////////////////////////////////////////////
-void G4OpenGLQtViewer::CreateGLQtContext (
-) 
-//////////////////////////////////////////////////////////////////////////////
-//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
-{
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::CreateGLQtContext \n");
-#endif
-}
+}
+
+
 
 
@@ -174,7 +142,11 @@
 
   if(fWindow) return; //Done.
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
   printf("G4OpenGLQtViewer::CreateMainWindow glWidget\n");
 #endif
+
+  // check if it is already launched, 
+  // if not, we suppose that the G4Qt is not launch.
+  //  bool isReady = G4Qt::Inited();
 
   // launch Qt if not
@@ -219,5 +191,5 @@
 
     if (found==false) {
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
       printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist, but not found\n");
 #endif
@@ -225,5 +197,5 @@
     }
   } else {
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
     printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist\n");
 #endif
@@ -263,5 +235,5 @@
 
   if(!fWindow) return;
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
   printf("G4OpenGLQtViewer::CreateMainWindow glWidget END\n");
 #endif
@@ -276,7 +248,4 @@
  */
 // void G4OpenGLQtViewer::dialogClosed() {
-// #ifdef GEANT4_QT_DEBUG
-//   printf("G4OpenGLQtViewer::dialogClosed END\n");
-// #endif
 //   //  GLWindow = NULL;
 // }
@@ -328,5 +297,5 @@
   fLastEventTime = new QTime();
 
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
   printf("G4OpenGLQtViewer::G4OpenGLQtViewer END\n");
 #endif
@@ -343,8 +312,4 @@
 #else
   G4cout <<removeTempFolder().toStdString().c_str() <<G4endl;
-#endif
-
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::~G4OpenGLQtViewer \n");
 #endif
 }
@@ -577,14 +542,8 @@
     mDrawing->clear();
   }
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer:: fDrawingWireframe 1\n");
-#endif
   QObject ::connect(fDrawingWireframe, 
                     SIGNAL(activated()),
                     this, 
                     SLOT(actionDrawingWireframe()));
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer:: fDrawingWireframe 2\n");
-#endif
   QObject ::connect(fDrawingLineRemoval, 
                     SIGNAL(activated()),
@@ -860,5 +819,20 @@
 }
 
-void G4OpenGLQtViewer::manageContextMenuEvent(QContextMenuEvent *e)
+
+void G4OpenGLQtViewer::G4resizeGL(
+ int aWidth
+,int aHeight)
+{  
+  setupViewport(aWidth,aHeight);
+  
+  if (((WinSize_x != (G4int)aWidth)) || (WinSize_y != (G4int) aHeight)) {
+    hasToRepaint =true;
+  }
+  WinSize_x = (G4int) aWidth;
+  WinSize_y = (G4int) aHeight;
+}
+
+
+void G4OpenGLQtViewer::G4manageContextMenuEvent(QContextMenuEvent *e)
 {
   if (!GLWindow) {
@@ -948,7 +922,4 @@
  */
 void G4OpenGLQtViewer::actionMousePick() {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::actionMousePick \n");
-#endif
   emit toggleMouseAction(STYLE3);
 }
@@ -1480,16 +1451,9 @@
   }
   
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::actionSaveImage() \n");
-#endif
 }
 
 
 void G4OpenGLQtViewer::actionMovieParameters() {
-
   showMovieParametersDialog();
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::actionMovieParameters() \n");
-#endif
 }
 
@@ -1528,4 +1492,9 @@
 
 
+void G4OpenGLQtViewer::FinishView()
+{
+   glFlush ();
+   fWindow->swapBuffers ();
+}
 
 /**
@@ -1533,17 +1502,28 @@
    @param p mouse click point
 */
-#if QT_VERSION < 0x040000
-void G4OpenGLQtViewer::G4MousePressEvent(QPoint p)
-#else
-void G4OpenGLQtViewer::G4MousePressEvent(QPoint p)
-#endif
+void G4OpenGLQtViewer::G4MousePressEvent(QMouseEvent *event)
 {
-  fAutoMove = false; // stop automove
-  fLastPos1 = p;
-  fLastPos2 = fLastPos1;
-  fLastPos3 = fLastPos2;
-  fLastEventTime->start();
-  if (fMouseAction == STYLE3){  // pick
-    Pick(p.x(),p.y());
+#if QT_VERSION < 0x040000
+  if ((event->button() & Qt::LeftButton)
+      && !((event->state() & Qt::ShiftButton)
+           || (event->state() & Qt::ControlButton)
+           || (event->state() & Qt::AltButton)
+           || (event->state() & Qt::MetaButton))) {
+#else
+  if ((event->buttons() & Qt::LeftButton)
+      && !((event->modifiers() & Qt::ShiftModifier)
+           || (event->modifiers() & Qt::ControlModifier)
+           || (event->modifiers() & Qt::AltModifier)
+           || (event->modifiers() & Qt::MetaModifier))) {
+#endif
+    fWindow->setMouseTracking(true);
+    fAutoMove = false; // stop automove
+    fLastPos1 = event->pos();
+    fLastPos2 = fLastPos1;
+    fLastPos3 = fLastPos2;
+    fLastEventTime->start();
+    if (fMouseAction == STYLE3){  // pick
+      Pick(event->pos().x(),event->pos().y());
+    }
   }
 }
@@ -1553,13 +1533,7 @@
 void G4OpenGLQtViewer::G4MouseReleaseEvent()
 {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::mouseRealease() %d,%d  %d,%d  %d,%d\n",fLastPos1.x(),fLastPos1.y(),fLastPos2.x(),fLastPos2.y(),fLastPos3.x(),fLastPos3.y());
-#endif
   fSpinningDelay = fLastEventTime->elapsed();
   QPoint delta = (fLastPos3-fLastPos1);
   if ((delta.x() == 0) && (delta.y() == 0)) {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::mouseRealease() EXIT 1 \n");
-#endif
     return;
   }
@@ -1579,12 +1553,16 @@
         lastMoveTime.start();
         cycles = 1 ;
-        //      }
       ((QApplication*)G4Qt::getInstance ())->processEvents();
-#ifdef GEANT4_QT_DEBUG
-        printf("G4OpenGLQtViewer::mouseRealease() cycle :%d \n",lastMoveTime.elapsed());
-#endif
       cycles ++ ;
     }
   }
+  fWindow->setMouseTracking(false);
+
+}
+
+
+void G4OpenGLQtViewer::G4MouseDoubleClickEvent()
+{
+  fWindow->setMouseTracking(true);
 }
 
@@ -1597,10 +1575,13 @@
 */
 
-#if QT_VERSION < 0x040000
-void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::ButtonState mButtons)
-#else
-  void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::MouseButtons mButtons)
-#endif
+void G4OpenGLQtViewer::G4MouseMoveEvent(QMouseEvent *event)
 {
+
+  
+#if QT_VERSION < 0x040000
+  Qt::ButtonState mButtons = event->state();
+#else
+  Qt::MouseButtons mButtons = event->buttons();
+#endif
 
   if (fAutoMove) {
@@ -1610,5 +1591,5 @@
   fLastPos3 = fLastPos2;
   fLastPos2 = fLastPos1;
-  fLastPos1 = QPoint(pos_x, pos_y);
+  fLastPos1 = QPoint(event->x(), event->y());
 
   int deltaX = fLastPos2.x()-fLastPos1.x();
@@ -1720,7 +1701,4 @@
 ,int aHeight
 ){
-#ifdef GEANT4_QT_DEBUG
-  printf("should rescale \n");
-#endif
   //  GLfloat* feedback_buffer;
   //  GLint returned;
@@ -1803,7 +1781,4 @@
 {
   // FIXME
-#ifdef GEANT4_QT_DEBUG
-  printf("saving EPS\n");
-#endif
 
   FILE* fp;
@@ -2006,8 +1981,4 @@
   fVP.SetZoomFactor(fVP.GetZoomFactor()+(fVP.GetZoomFactor()*(event->delta())/1200)); 
   updateQWidget();
-
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::wheel event  +++++++++++++++++++++ %f %d\n",fVP.GetZoomFactor(),event->delta());
-#endif
 }
 
Index: trunk/source/visualization/OpenGL/src/G4OpenGLStoredQt.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLStoredQt.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLStoredQt.cc	(revision 873)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4OpenGLStoredQt.cc,v 1.7 2008/10/15 10:26:25 lgarnier Exp $
+// $Id: G4OpenGLStoredQt.cc,v 1.9 2008/10/24 14:21:34 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -32,6 +32,4 @@
 
 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
-
-//#define GEANT4_QT_DEBUG
 
 #include "G4VisFeaturesOfOpenGL.hh"
@@ -50,7 +48,4 @@
 {
   G4OpenGLViewerMessenger::GetInstance();
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQt::Create  \n");
-#endif
 }
 
@@ -62,8 +57,8 @@
 
 G4VViewer* G4OpenGLStoredQt::CreateViewer
-#ifdef GEANT4_QT_DEBUG
+(G4VSceneHandler& scene, const G4String& name) {
+#ifdef G4DEBUG
   printf("G4OpenGLStoredQt::CreateViewer \n");
 #endif
-(G4VSceneHandler& scene, const G4String& name) {
   G4VViewer* pView =
     new G4OpenGLStoredQtViewer
@@ -83,5 +78,5 @@
       " new G4OpenGLStoredQtViewer." << G4endl;
   }
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
   printf("G4OpenGLStoredQt::CreateViewer END \n");
 #endif
Index: trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc	(revision 873)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4OpenGLStoredQtViewer.cc,v 1.18 2008/10/15 10:29:39 lgarnier Exp $
+// $Id: G4OpenGLStoredQtViewer.cc,v 1.19 2008/10/24 13:49:19 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -33,6 +33,4 @@
 
 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
-
-//#define GEANT4_QT_DEBUG
 
 #include "G4OpenGLStoredQtViewer.hh"
@@ -51,10 +49,4 @@
   G4OpenGLStoredViewer (sceneHandler)             // FIXME : gerer le pb du parent !
 {
-  // if no scene...
-//   if (fSceneHandler.GetScene() == 0) {
-//     G4cerr << "G4OpenGLStoredQtViewer: Creating a Viewer without a scene is not allowed. \nPlease use /vis/scene/create before /vis/open/.... "
-// 	   << G4endl;
-//     return;
-//   }
 
   //set true to picking
@@ -65,5 +57,4 @@
   setFocusPolicy(Qt::StrongFocus); // enable keybord events
 #endif
-  nbPaint =0;
   hasToRepaint =false;
 
@@ -72,34 +63,18 @@
 
 G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() {
-#ifdef GEANT4_QT_DEBUG
-  printf("GLWidget::~GLWidget \n");
-#endif
   makeCurrent();
   // this is connect to the Dialog for deleting it properly
   // when close event.
   //   ((QDialog*)window())->reject();
-#ifdef GEANT4_QT_DEBUG
-  printf("GLWidget::~GLWidget END\n");
-#endif
 }
 
 void G4OpenGLStoredQtViewer::Initialise() {
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
   printf("G4OpenGLStoredQtViewer::Initialise 1\n");
 #endif
   readyToPaint = false;
-  CreateGLQtContext ();
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQtViewer::Initialise () 2\n");
-#endif
   CreateMainWindow (this,QString(fName));
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQtViewer::Initialise () 3\n");
-#endif
-  CreateFontLists ();  // FIXME Does nothing!
+  CreateFontLists ();
   
-#ifdef GEANT4_QT_DEBUG
-  printf("readyToPaint = true \n");
-#endif
   readyToPaint = true;
 }
@@ -109,5 +84,5 @@
   InitializeGLView ();
 
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
   printf("G4OpenGLStoredQtViewer::InitialiseGL () 1\n");
 #endif
@@ -115,5 +90,4 @@
   // clear the buffers and window.
   ClearView ();
-  //   printf("G4OpenGLStoredQtViewer::InitialiseGL () 2\n");
   FinishView ();
    
@@ -127,6 +101,6 @@
   }
 
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQtViewer::InitialiseGL  -------------------------------------------------------------------------------------\n");
+#ifdef G4DEBUG
+  printf("G4OpenGLStoredQtViewer::InitialiseGL  END\n");
 #endif
 }
@@ -135,6 +109,5 @@
 void G4OpenGLStoredQtViewer::DrawView () {
 
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::setupViewport\n");
+#ifdef G4DEBUG
   printf("G4OpenGLStoredQtViewer::DrawView %d %d   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
 #endif
@@ -149,8 +122,7 @@
   // /vis/viewer/rebuild, but if not, make decision and set flag only
   // if necessary...
-  if (!fNeedKernelVisit) 
-
+  if (!fNeedKernelVisit) {
     if (!fNeedKernelVisit) KernelVisitDecision ();
-   
+  }
   G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
   ProcessView ();
@@ -159,5 +131,5 @@
   if(style!=G4ViewParameters::hlr &&
      haloing_enabled) {
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
     printf("G4OpenGLStoredQtViewer::DrawView DANS LE IF\n");
 #endif
@@ -177,5 +149,5 @@
     // have been done, so...
     if (!kernelVisitWasNeeded) {
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
       printf("**************************  G4OpenGLStoredQtViewer::DrawView Don't need kernel Visit \n");
 #endif
@@ -183,5 +155,5 @@
       FinishView ();
     } else {
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
       printf("**************************  G4OpenGLStoredQtViewer::DrawView need kernel Visit \n");
 #endif
@@ -193,5 +165,5 @@
         DrawDisplayLists ();
         FinishView ();
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
         printf("***************************  CASE 4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
 #endif
@@ -207,19 +179,8 @@
   }
 
-#ifdef GEANT4_QT_DEBUG
+#ifdef G4DEBUG
   printf("G4OpenGLStoredQtViewer::DrawView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",WinSize_x, WinSize_y);
 #endif
   hasToRepaint =true;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////
-void G4OpenGLStoredQtViewer::FinishView (
-) 
-//////////////////////////////////////////////////////////////////////////////
-//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
-{
-  glFlush ();
-  swapBuffers ();
 }
 
@@ -232,28 +193,14 @@
                                       ,int aHeight)
 {  
-  setupViewport(aWidth,aHeight);
-
-  if (((WinSize_x != (G4int)aWidth)) || (WinSize_y != (G4int) aHeight)) {
-    hasToRepaint =true;
-  }
-  WinSize_x = (G4int) aWidth;
-  WinSize_y = (G4int) aHeight;
-  
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQtViewer::resizeGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d %d=%d %d=%d\n",hasToRepaint,width(),aWidth,height(),aHeight);
-#endif
-}
-
-
-/** 
-    @see :
-*/
+  G4resizeGL(aWidth,aHeight);
+}
+
 
 void G4OpenGLStoredQtViewer::paintGL()
 {
+#ifdef G4DEBUG
+  printf("G4OpenGLStoredQtViewer::paintGL ??\n");
+#endif
   if (!readyToPaint) {
-#ifdef GEANT4_QT_DEBUG
-    printf("G4OpenGLStoredQtViewer::paintGL ============  Not ready %d\n",readyToPaint);
-#endif
     readyToPaint= true;
     return;
@@ -264,29 +211,17 @@
   if ( !hasToRepaint) {
     if (((WinSize_x == (G4int)width())) &&(WinSize_y == (G4int) height())) {
-#ifdef GEANT4_QT_DEBUG
-      printf("G4OpenGLStoredQtViewer::paintGL ============  Dont repaint\n");
-#endif
       return;
     }
   }
-  nbPaint++;
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV %d ready %d\n",nbPaint,readyToPaint);
+#ifdef G4DEBUG
+  printf("G4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",readyToPaint);
 #endif
   WinSize_x = (G4int) width();
   WinSize_y = (G4int) height();
-     
+
   setupViewport(width(),height());
-  //     glViewport (0, 0, width(), height());
-  //   glLoadIdentity();
-     
-     
+
   SetView();
-     
-  //   //  printf("before ClearView\n");
-#ifdef GEANT4_QT_DEBUG
-  printf("    ClearView\n");
-#endif
-     
+          
   ClearView (); //ok, put the background correct
   DrawView();
@@ -294,6 +229,6 @@
   hasToRepaint =false;
      
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d ready %d\n",nbPaint,readyToPaint);
+#ifdef G4DEBUG
+  printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n",readyToPaint);
 #endif
 }
@@ -301,23 +236,5 @@
 void G4OpenGLStoredQtViewer::mousePressEvent(QMouseEvent *event)
 {
-#if QT_VERSION < 0x040000
-  if ((event->button() & Qt::LeftButton)
-      && !((event->state() & Qt::ShiftButton)
-           || (event->state() & Qt::ControlButton)
-           || (event->state() & Qt::AltButton)
-           || (event->state() & Qt::MetaButton))) {
-#else
-  if ((event->buttons() & Qt::LeftButton)
-      && !((event->modifiers() & Qt::ShiftModifier)
-           || (event->modifiers() & Qt::ControlModifier)
-           || (event->modifiers() & Qt::AltModifier)
-           || (event->modifiers() & Qt::MetaModifier))) {
-#endif
-#ifdef GEANT4_QT_DEBUG
-    printf("G4OpenGLStoredQtViewer::mousePressEvent\n");
-#endif
-    setMouseTracking(true);
-    G4MousePressEvent(event->pos());
-  }
+  G4MousePressEvent(event);
 }
 
@@ -338,9 +255,5 @@
 void G4OpenGLStoredQtViewer::mouseDoubleClickEvent(QMouseEvent *event)
 {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQtViewer::mouseDoubleClickEvent\n");
-#endif
-  setMouseTracking(true);
-  //   glBufferImage = grabFrameBuffer().convertToFormat(QImage::Format_ARGB32);//_Premultiplied);  
+  G4MouseDoubleClickEvent();
 }
 
@@ -348,18 +261,9 @@
 {
   G4MouseReleaseEvent();
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQtViewer::mouseReleaseEvent ================\n");
-#endif
-  setMouseTracking(false);
 }
 
 void G4OpenGLStoredQtViewer::mouseMoveEvent(QMouseEvent *event)
 {
-  
-#if QT_VERSION < 0x040000
-  G4MouseMoveEvent(event->x(),event->y(),event->state());
-#else
-  G4MouseMoveEvent(event->x(),event->y(),event->buttons());
-#endif
+  G4MouseMoveEvent(event);
 }
 
@@ -367,8 +271,5 @@
 void G4OpenGLStoredQtViewer::contextMenuEvent(QContextMenuEvent *e)
 {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLStoredQtViewer::contextMenuEvent\n");
-#endif
-  manageContextMenuEvent(e);
+  G4manageContextMenuEvent(e);
 }
 
Index: trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc	(revision 873)
@@ -363,4 +363,5 @@
     fpViewer -> SetView ();
     fpViewer -> ClearView ();
+    printf("G4OpenGLStoredSceneHandler::ClearTransientStore----------------------------------------------\n");
     fpViewer -> DrawView ();
   }
Index: trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
===================================================================
--- trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc	(revision 872)
+++ trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc	(revision 873)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLViewer.cc,v 1.39 2008/07/28 15:36:45 lgarnier Exp $
-// GEANT4 tag $Name: HEAD $
+// $Id: G4OpenGLViewer.cc,v 1.41 2008/10/24 13:49:19 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
@@ -33,6 +33,4 @@
 
 #ifdef G4VIS_BUILD_OPENGL_DRIVER
-
-//#define GEANT4_QT_DEBUG
 
 #include "G4ios.hh"
@@ -942,13 +940,4 @@
     targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
 
-
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLViewer:: %f %f %f Tp: %f %f %f Vpd:%f %f %f - Up:%f %f %f Cp:%f %f %f\n",
-         dx,dy,deltaRotation,targetPoint[0],targetPoint[1],targetPoint[2],
-         vp.x(),vp.y(),vp.z(),
-         up.x(),up.y(),up.z(),
-         cameraPosition[0],cameraPosition[1],cameraPosition[2]);
-#endif
-
   if (fVP.GetLightsMoveWithCamera()) {
     new_up = (new_vp.cross(yprime)).unit();
@@ -959,9 +948,5 @@
     new_up = up;
     if (new_vp.z()*vp.z() <0) {
-#ifdef GEANT4_QT_DEBUG
-      //            printf("G4OpenGLViewer:: ***********************************************************\n");
-#endif
       new_up.set(new_up.x(),-new_up.y(),new_up.z());
-      //      new_vp.set(-new_vp.x(),new_vp.y(),new_vp.z());
     }
   }
