Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 660)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 673)
@@ -97,4 +97,17 @@
 }
 
+/**
+ * Set the viewport of the scene
+ */
+void G4OpenGLQtViewer::setupViewport(int aWidth, int aHeight)
+{
+  int side = qMin(aWidth, aHeight);
+  glViewport((aWidth - side) / 2, (aHeight - side) / 2, side, side);
+  
+  glMatrixMode(GL_PROJECTION);
+  glLoadIdentity();
+  glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
+  glMatrixMode(GL_MODELVIEW);
+}
 
 
@@ -514,23 +527,23 @@
 
 #if QT_VERSION < 0x030200
-  QAction *controlPanels = new QAction("&Control panels","&Control panels",CTRL+Key_C,mActions);
-  QAction *exitG4 =  new QAction("&Exit to G4Vis >","&Exit to G4Vis >",CTRL+Key_E,mActions);
+//   QAction *controlPanels = new QAction("&Control panels","&Control panels",CTRL+Key_C,mActions);
+//   QAction *exitG4 =  new QAction("&Exit to G4Vis >","&Exit to G4Vis >",CTRL+Key_E,mActions);
   QAction *createEPS =  new QAction("&Save as ...","&Save as ...",CTRL+Key_S,mActions);
 #else
-  QAction *controlPanels = new QAction("&Control panels",CTRL+Key_C,mActions);
-  QAction *exitG4 =  new QAction("&Exit to G4Vis >",CTRL+Key_E,mActions);
+//   QAction *controlPanels = new QAction("&Control panels",CTRL+Key_C,mActions);
+//   QAction *exitG4 =  new QAction("&Exit to G4Vis >",CTRL+Key_E,mActions);
   QAction *createEPS =  new QAction("&Save as ...",CTRL+Key_S,mActions);
 #endif
-  controlPanels->addTo(mActions);
-  exitG4->addTo(mActions);
+//   controlPanels->addTo(mActions);
+//   exitG4->addTo(mActions);
   createEPS->addTo(mActions);
-  QObject ::connect(controlPanels, 
-                    SIGNAL(activated()),
-                    this, 
-                    SLOT(actionControlPanels()));
-  QObject ::connect(exitG4, 
-                    SIGNAL(activated()),
-                    this, 
-                    SLOT(actionExitG4()));
+//   QObject ::connect(controlPanels, 
+//                     SIGNAL(activated()),
+//                     this, 
+//                     SLOT(actionControlPanels()));
+//   QObject ::connect(exitG4, 
+//                     SIGNAL(activated()),
+//                     this, 
+//                     SLOT(actionExitG4()));
   QObject ::connect(createEPS, 
                     SIGNAL(activated()),
@@ -541,15 +554,15 @@
   // === Action Menu ===
   QMenu *mActions = fContextMenu->addMenu("&Actions");
-  QAction *controlPanels = mActions->addAction("Control panels");
-  QAction *exitG4 = mActions->addAction("Exit to G4Vis >");
+//   QAction *controlPanels = mActions->addAction("Control panels");
+//   QAction *exitG4 = mActions->addAction("Exit to G4Vis >");
   QAction *createEPS = mActions->addAction("Save as ...");
-  QObject ::connect(controlPanels, 
-                    SIGNAL(triggered()),
-                    this, 
-                    SLOT(actionControlPanels()));
-  QObject ::connect(exitG4, 
-                    SIGNAL(triggered()),
-                    this, 
-                    SLOT(actionExitG4()));
+//   QObject ::connect(controlPanels, 
+//                     SIGNAL(triggered()),
+//                     this, 
+//                     SLOT(actionControlPanels()));
+//   QObject ::connect(exitG4, 
+//                     SIGNAL(triggered()),
+//                     this, 
+//                     SLOT(actionExitG4()));
   QObject ::connect(createEPS, 
                     SIGNAL(triggered()),
@@ -1031,15 +1044,15 @@
 
 
-void G4OpenGLQtViewer::actionControlPanels() {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::actionControlPanels \n");
-#endif
-}
-
-void G4OpenGLQtViewer::actionExitG4() {
-#ifdef GEANT4_QT_DEBUG
-  printf("G4OpenGLQtViewer::actionExitG4() \n");
-#endif
-}
+// void G4OpenGLQtViewer::actionControlPanels() {
+// #ifdef GEANT4_QT_DEBUG
+//   printf("G4OpenGLQtViewer::actionControlPanels \n");
+// #endif
+// }
+
+// void G4OpenGLQtViewer::actionExitG4() {
+// #ifdef GEANT4_QT_DEBUG
+//   printf("G4OpenGLQtViewer::actionExitG4() \n");
+// #endif
+// }
 
 void G4OpenGLQtViewer::actionCreateEPS() {
@@ -1194,4 +1207,5 @@
 }
 
+
 /**
    @param pos_x mouse x position
@@ -1203,10 +1217,9 @@
 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)
+  void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::MouseButtons mButtons)
 #endif
 {
   int dx = pos_x - lastPos.x();
   int dy = pos_y - lastPos.y();
-  
   if (fMouseAction) {  // rotate
     if (mButtons & Qt::LeftButton) {
@@ -1292,5 +1305,4 @@
 }
 
-
 /** This is the benning of a rescale function. It does nothing for the moment
     @param aWidth : new width
@@ -1308,11 +1320,11 @@
   FILE* file;
   
-  feedback_buffer = new GLfloat[size];
-  glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
-  glRenderMode (GL_FEEDBACK);
-  
-  glViewport (0, 0, aWidth, aHeight);
-  DrawView();
-  returned = glRenderMode (GL_RENDER);
+//   feedback_buffer = new GLfloat[size];
+//   glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
+//   glRenderMode (GL_FEEDBACK);
+  
+//   glViewport (0, 0, aWidth, aHeight);
+//   DrawView();
+//   returned = glRenderMode (GL_RENDER);
 
 }
@@ -1358,7 +1370,7 @@
   } else {
 #if QT_VERSION < 0x040000
-    G4cerr << "Could not open "<< file.ascii()<<"\n" << G4endl;
-#else
-    G4cerr << "Could not open "<< file.toStdString().c_str()<<"\n" << G4endl;
+    G4cerr << "Could not open "<< aFilename.ascii()<<"\n" << G4endl;
+#else
+    G4cerr << "Could not open "<< aFilename.toStdString().c_str()<<"\n" << G4endl;
 #endif
   }
