Index: trunk/geant4/N03/visTutor/exN03Vis14.mac
===================================================================
--- trunk/geant4/N03/visTutor/exN03Vis14.mac	(revision 562)
+++ trunk/geant4/N03/visTutor/exN03Vis14.mac	(revision 562)
@@ -0,0 +1,156 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis14.mac                                    #
+#                                                                     #
+#  AUTHOR(S): Laurent Garnier                                         #
+#                                                                     #
+#  DATE: July 13, 2007                                                #
+#                                                                     #
+#  CONTENTS: A basic macro for visualization of detector geometry     #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis14.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,Qt          #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLQT_DRIVER   1                         # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLQT           1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+###########################################
+# Visualization of detector geometry 
+#  with the OGLSQT (OpenGL Stored QT) driver
+###########################################
+
+# Invoke the OGLSQT driver 
+/vis/open OGLSQT
+
+# Bird's-eye view of the detector geometry 
+#
+#  viewpoint  : (theta,phi) = (20*deg, 70*deg), 
+#  zoom factor: 0.8 of the full screen size
+#
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi  20 70
+/vis/viewer/zoom               0.8 
+/vis/drawVolume
+
+# The following two commands "flush" 
+#  the action of the current viewer.
+#  They are required for the post-processing drivers 
+#  such as DAWNFILE, VRMLFILE, HepRep drivers, etc.
+#  For OpenGL drivers, these commands are not required
+#  but harmless even if they are described.
+/vis/viewer/flush
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Bird's-eye view of a detector component (Absorber)
+#  viewpoint  : (theta,phi) = (35*deg, 35*deg), 
+#  zoom factor: 1.1 of the full screen size
+#  coordinate axes:
+#     x-axis:red,  y-axis:green,  z-axis:blue
+#     origin: (0,0,0),  length: 500
+#  Scale: length = 10 cm, Orientation = z, color = red, 
+#         placing_algorithm = manual, 
+#         center = (-2.5 cm , -5 cm, 0 cm)
+#
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume           Absorber 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm  40 -100 -140   Absorber 
+/vis/scene/add/scale     10 cm z 1 0 0 manual -2.5 -5 0  cm
+
+# "Flush the action of all the existing viewers.
+#   Note: You should execute these commands, e.g.,  
+#         when the current scene is modified.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+# Bird's-eye view of a detector component (Gap)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume                Gap 
+/vis/scene/add/axes  	  0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm  50 -100 -140   Gap 
+/vis/scene/add/scale      10 cm z 1 0 0 manual -2.5 -5  0 cm
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Bird's-eye view of the whole detector components (world)
+#  * The argument "world" of the command 
+#    "/vis/scene/add/volume" is omittable.
+#  * "/vis/viewer/set/culling false" makes the invisible 
+#    world volume visible.
+#    (The invisibility of the world volume is set 
+#     in ExN03DetectorConstruction.cc.)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/viewer/set/culling         global false
+/vis/drawVolume 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm 50 -100 -240   World
+/vis/scene/add/scale     10 cm x 1 0 0 
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Make the culling on for next visualization
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling       global true
Index: trunk/geant4/OpenGLQT_exemple/cmt/glwidget.makesav
===================================================================
--- trunk/geant4/OpenGLQT_exemple/cmt/glwidget.makesav	(revision 562)
+++ trunk/geant4/OpenGLQT_exemple/cmt/glwidget.makesav	(revision 562)
@@ -0,0 +1,229 @@
+#-- start of make_header -----------------
+
+#====================================
+#  Application glwidget
+#
+#   Generated Wed Jul 18 20:55:39 2007  by laurentgarnier
+#
+#====================================
+
+include ${CMTROOT}/src/Makefile.core
+
+ifdef tag
+CMTEXTRATAGS = $(tag)
+else
+tag       = $(CMTCONFIG)
+endif
+
+cmt_glwidget_has_no_target_tag = 1
+
+#--------------------------------------------------------
+
+ifdef cmt_glwidget_has_target_tag
+
+tags      = $(tag),$(CMTEXTRATAGS),target_glwidget
+
+OpenGLQT_exemple_tag = $(tag)
+
+ifdef READONLY
+cmt_local_tagfile_glwidget = /tmp/CMT_$(OpenGLQT_exemple_tag)_glwidget.make$(cmt_lock_pid)
+else
+cmt_local_tagfile_glwidget = $(OpenGLQT_exemple_tag)_glwidget.make
+endif
+
+else
+
+tags      = $(tag),$(CMTEXTRATAGS)
+
+OpenGLQT_exemple_tag = $(tag)
+
+ifdef READONLY
+cmt_local_tagfile_glwidget = /tmp/CMT_$(OpenGLQT_exemple_tag).make$(cmt_lock_pid)
+else
+cmt_local_tagfile_glwidget = $(OpenGLQT_exemple_tag).make
+endif
+
+endif
+
+-include $(cmt_local_tagfile_glwidget)
+
+ifdef cmt_glwidget_has_target_tag
+
+ifdef READONLY
+cmt_final_setup_glwidget = /tmp/CMT_OpenGLQT_exemple_glwidgetsetup.make
+cmt_local_glwidget_makefile = /tmp/CMT_glwidget$(cmt_lock_pid).make
+else
+cmt_final_setup_glwidget = $(bin)OpenGLQT_exemple_glwidgetsetup.make
+cmt_local_glwidget_makefile = $(bin)glwidget.make
+endif
+
+else
+
+ifdef READONLY
+cmt_final_setup_glwidget = /tmp/CMT_OpenGLQT_exemplesetup.make
+cmt_local_glwidget_makefile = /tmp/CMT_glwidget$(cmt_lock_pid).make
+else
+cmt_final_setup_glwidget = $(bin)OpenGLQT_exemplesetup.make
+cmt_local_glwidget_makefile = $(bin)glwidget.make
+endif
+
+endif
+
+ifdef READONLY
+cmt_final_setup = /tmp/CMT_OpenGLQT_exemplesetup.make
+else
+cmt_final_setup = $(bin)OpenGLQT_exemplesetup.make
+endif
+
+glwidget ::
+
+
+ifdef READONLY
+glwidget ::
+	@echo tags=$(tags)
+	@echo cmt_local_tagfile=$(cmt_local_tagfile)
+endif
+
+
+dirs ::
+	@if test ! -r requirements ; then echo "No requirements file" ; fi; \
+	  if test ! -d $(bin) ; then $(mkdir) -p $(bin) ; fi
+
+javadirs ::
+	@if test ! -d $(javabin) ; then $(mkdir) -p $(javabin) ; fi
+
+srcdirs ::
+	@if test ! -d $(src) ; then $(mkdir) -p $(src) ; fi
+
+help ::
+	@echo 'glwidget'
+
+binobj = 
+ifdef STRUCTURED_OUTPUT
+binobj = glwidget/
+glwidget::
+	@if test ! -d $(bin)$(binobj) ; then $(mkdir) -p $(bin)$(binobj) ; fi
+	@echo "STRUCTURED_OUTPUT="$(bin)$(binobj)
+endif
+
+#-- end of make_header ------------------#-- start of application_header
+
+glwidget :: dirs  $(bin)glwidget${application_suffix}
+	@/bin/echo "------> glwidget ok"
+
+#-- end of application_header
+#-- start of application
+
+$(bin)glwidget${application_suffix} :: $(bin)window.o $(bin)glwidget.o $(bin)main.o $(use_stamps) $(glwidgetstamps) requirements $(use_requirements)
+	$(link_echo) $@
+	$(link_silent) cd $(bin); $(cpplink) -o glwidget.exe.new $(bin)window.o $(bin)glwidget.o $(bin)main.o $(use_linkopts) $(glwidgetlinkopts); mv -f glwidget.exe.new glwidget${application_suffix}
+
+#-----------------------------------------------------------------
+#
+#  New section for automatic installation
+#
+#-----------------------------------------------------------------
+
+install_dir = ${CMTINSTALLAREA}/$(tag)/bin
+glwidgetinstallname = glwidget${application_suffix}
+
+glwidget :: glwidgetinstall
+
+install :: glwidgetinstall
+
+glwidgetinstall :: $(install_dir)/$(glwidgetinstallname)
+	@if test ! "${CMTINSTALLAREA}" = ""; then\
+	  echo "installation done"; \
+	fi
+
+$(install_dir)/$(glwidgetinstallname) :: $(bin)$(glwidgetinstallname)
+	@if test ! "${CMTINSTALLAREA}" = ""; then \
+	  $(cmt_install_action) \
+	    -source "`(cd $(bin); pwd)`" \
+	    -name "$(glwidgetinstallname)" \
+	    -out "$(install_dir)" \
+	    -cmd "$(cmt_installarea_command)" \
+	    -cmtpath "$($(package)_cmtpath)"; \
+	fi
+
+##glwidgetclean :: glwidgetuninstall
+
+uninstall :: glwidgetuninstall
+
+glwidgetuninstall ::
+	@echo "------> (glwidget.make) Removing installed files"
+	@if test ! "${CMTINSTALLAREA}" = ""; then \
+	  $(cmt_uninstall_action) \
+	    -source "`(cd $(bin); pwd)`" \
+	    -name "$(glwidgetinstallname)" \
+	    -out "$(install_dir)" \
+	    -cmtpath "$($(package)_cmtpath)"; \
+	fi
+
+#-- end of application
+#-- start of dependency ------------------
+
+$(bin)glwidget_dependencies.make :: dirs
+
+ifndef QUICK
+$(bin)glwidget_dependencies.make :: $(src)window.cpp $(src)glwidget.cpp $(src)main.cpp  requirements $(use_requirements) $(cmt_final_setup_glwidget)
+	@echo "------> (glwidget.make) Rebuilding $@"; \
+	  args=`echo $? | sed -e "s#requirements.*##"`; \
+	  $(build_dependencies) glwidget -all_sources $${args}
+endif
+
+#$(glwidget_dependencies)
+
+-include $(bin)glwidget_dependencies.make
+
+#-- end of dependency -------------------
+#-- start of cpp ------
+
+$(bin)$(binobj)window.o : $(window_cpp_dependencies)
+	$(cpp_echo) $@
+	$(cpp_silent) cd $(bin); $(cppcomp) -o $(binobj)window.o $(use_pp_cppflags) $(glwidget_pp_cppflags) $(app_glwidget_pp_cppflags) $(window_pp_cppflags) $(use_cppflags) $(glwidget_cppflags) $(app_glwidget_cppflags) $(window_cppflags) $(window_cpp_cppflags)  $(src)window.cpp
+
+#-- end of cpp ------#-- start of cpp ------
+
+$(bin)$(binobj)glwidget.o : $(glwidget_cpp_dependencies)
+	$(cpp_echo) $@
+	$(cpp_silent) cd $(bin); $(cppcomp) -o $(binobj)glwidget.o $(use_pp_cppflags) $(glwidget_pp_cppflags) $(app_glwidget_pp_cppflags) $(glwidget_pp_cppflags) $(use_cppflags) $(glwidget_cppflags) $(app_glwidget_cppflags) $(glwidget_cppflags) $(glwidget_cpp_cppflags)  $(src)glwidget.cpp
+
+#-- end of cpp ------#-- start of cpp ------
+
+$(bin)$(binobj)main.o : $(main_cpp_dependencies)
+	$(cpp_echo) $@
+	$(cpp_silent) cd $(bin); $(cppcomp) -o $(binobj)main.o $(use_pp_cppflags) $(glwidget_pp_cppflags) $(app_glwidget_pp_cppflags) $(main_pp_cppflags) $(use_cppflags) $(glwidget_cppflags) $(app_glwidget_cppflags) $(main_cppflags) $(main_cpp_cppflags)  $(src)main.cpp
+
+#-- end of cpp ------#-- start of cleanup_header --------------
+
+clean :: glwidgetclean
+	@cd .
+
+ifndef PEDANTIC
+.DEFAULT::
+	@echo "You should provide a target for this file  $@"
+#	@exit 0
+endif
+
+#ifdef PEDANTIC
+#.DEFAULT::
+#	@echo "You should provide a target for this file  $@"
+#	@exit 1
+#endif
+
+
+
+
+glwidgetclean ::
+#-- end of cleanup_header ---------------
+#-- start of cleanup_application ------
+	@echo "------> (glwidget.make) Removing application files"
+	-$(cleanup_echo) glwidget${application_suffix}
+	-@cd $(bin); /bin/rm -f glwidget${application_suffix}
+#-- end of cleanup_application ------
+#-- start of cleanup_objects ------
+	$(cleanup_echo) objects
+	-$(cleanup_silent) cd $(bin); /bin/rm -f $(bin)window.o $(bin)glwidget.o $(bin)main.o
+	-$(cleanup_silent) cd $(bin); /bin/rm -rf glwidget_deps glwidget_dependencies.make
+#-- end of cleanup_objects ------
Index: trunk/geant4/OpenGLQT_exemple/glwidget.cpp
===================================================================
--- trunk/geant4/OpenGLQT_exemple/glwidget.cpp	(revision 562)
+++ trunk/geant4/OpenGLQT_exemple/glwidget.cpp	(revision 562)
@@ -0,0 +1,204 @@
+ #include <QtGui>
+ #include <QtOpenGL>
+
+ #include <math.h>
+
+ #include "glwidget.h"
+
+ GLWidget::GLWidget(QWidget *parent)
+     : QGLWidget(parent)
+ {
+     object = 0;
+     xRot = 0;
+     yRot = 0;
+     zRot = 0;
+
+     trolltechGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0);
+     trolltechPurple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0);
+ }
+
+ GLWidget::~GLWidget()
+ {
+     makeCurrent();
+     glDeleteLists(object, 1);
+ }
+
+ QSize GLWidget::minimumSizeHint() const
+ {
+     return QSize(50, 50);
+ }
+
+ QSize GLWidget::sizeHint() const
+ {
+     return QSize(400, 400);
+ }
+
+void GLWidget::setXRotation(int angle)
+ {
+     normalizeAngle(&angle);
+     if (angle != xRot) {
+         xRot = angle;
+         emit xRotationChanged(angle);
+         updateGL();
+     }
+ }
+
+ void GLWidget::setYRotation(int angle)
+ {
+     normalizeAngle(&angle);
+     if (angle != yRot) {
+         yRot = angle;
+         emit yRotationChanged(angle);
+         updateGL();
+     }
+ }
+
+ void GLWidget::setZRotation(int angle)
+ {
+     normalizeAngle(&angle);
+     if (angle != zRot) {
+         zRot = angle;
+         emit zRotationChanged(angle);
+         updateGL();
+     }
+ }
+
+ void GLWidget::initializeGL()
+ {
+     qglClearColor(trolltechPurple.dark());
+     object = makeObject();
+     glShadeModel(GL_FLAT);
+     glEnable(GL_DEPTH_TEST);
+     glEnable(GL_CULL_FACE);
+ }
+
+ void GLWidget::paintGL()
+ {
+     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+     glLoadIdentity();
+     glTranslated(0.0, 0.0, -10.0);
+     glRotated(xRot / 16.0, 1.0, 0.0, 0.0);
+     glRotated(yRot / 16.0, 0.0, 1.0, 0.0);
+     glRotated(zRot / 16.0, 0.0, 0.0, 1.0);
+     glCallList(object);
+ }
+
+ void GLWidget::resizeGL(int width, int height)
+ {
+     int side = qMin(width, height);
+     glViewport((width - side) / 2, (height - side) / 2, side, side);
+
+     glMatrixMode(GL_PROJECTION);
+     glLoadIdentity();
+     glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
+     glMatrixMode(GL_MODELVIEW);
+ }
+
+ void GLWidget::mousePressEvent(QMouseEvent *event)
+ {
+     lastPos = event->pos();
+ }
+
+ void GLWidget::mouseMoveEvent(QMouseEvent *event)
+ {
+        int dx = event->x() - lastPos.x();
+     int dy = event->y() - lastPos.y();
+
+     if (event->buttons() & Qt::LeftButton) {
+         setXRotation(xRot + 8 * dy);
+         setYRotation(yRot + 8 * dx);
+     } else if (event->buttons() & Qt::RightButton) {
+         setXRotation(xRot + 8 * dy);
+         setZRotation(zRot + 8 * dx);
+     }
+     lastPos = event->pos();
+ }
+
+ GLuint GLWidget::makeObject()
+ {
+     GLuint list = glGenLists(1);
+     glNewList(list, GL_COMPILE);
+
+     glBegin(GL_QUADS);
+
+     GLdouble x1 = +0.06;
+     GLdouble y1 = -0.14;
+     GLdouble x2 = +0.14;
+     GLdouble y2 = -0.06;
+     GLdouble x3 = +0.08;
+     GLdouble y3 = +0.00;
+     GLdouble x4 = +0.30;
+     GLdouble y4 = +0.22;
+
+     quad(x1, y1, x2, y2, y2, x2, y1, x1);
+     quad(x3, y3, x4, y4, y4, x4, y3, x3);
+
+     extrude(x1, y1, x2, y2);
+     extrude(x2, y2, y2, x2);
+     extrude(y2, x2, y1, x1);
+     extrude(y1, x1, x1, y1);
+     extrude(x3, y3, x4, y4);
+     extrude(x4, y4, y4, x4);
+     extrude(y4, x4, y3, x3);
+
+     const double Pi = 3.14159265358979323846;
+     const int NumSectors = 200;
+
+     for (int i = 0; i < NumSectors; ++i) {
+         double angle1 = (i * 2 * Pi) / NumSectors;
+         GLdouble x5 = 0.30 * sin(angle1);
+         GLdouble y5 = 0.30 * cos(angle1);
+         GLdouble x6 = 0.20 * sin(angle1);
+         GLdouble y6 = 0.20 * cos(angle1);
+
+         double angle2 = ((i + 1) * 2 * Pi) / NumSectors;
+         GLdouble x7 = 0.20 * sin(angle2);
+         GLdouble y7 = 0.20 * cos(angle2);
+         GLdouble x8 = 0.30 * sin(angle2);
+         GLdouble y8 = 0.30 * cos(angle2);
+
+         quad(x5, y5, x6, y6, x7, y7, x8, y8);
+
+         extrude(x6, y6, x7, y7);
+         extrude(x8, y8, x5, y5);
+     }
+
+     glEnd();
+
+     glEndList();
+     return list;
+ }
+
+ void GLWidget::quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
+                     GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4)
+ {
+     qglColor(trolltechGreen);
+
+     glVertex3d(x1, y1, -0.05);
+     glVertex3d(x2, y2, -0.05);
+     glVertex3d(x3, y3, -0.05);
+     glVertex3d(x4, y4, -0.05);
+
+     glVertex3d(x4, y4, +0.05);
+     glVertex3d(x3, y3, +0.05);
+     glVertex3d(x2, y2, +0.05);
+     glVertex3d(x1, y1, +0.05);
+ }
+
+ void GLWidget::extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
+ {
+     qglColor(trolltechGreen.dark(250 + int(100 * x1)));
+
+     glVertex3d(x1, y1, +0.05);
+     glVertex3d(x2, y2, +0.05);
+     glVertex3d(x2, y2, -0.05);
+     glVertex3d(x1, y1, -0.05);
+ }
+
+ void GLWidget::normalizeAngle(int *angle)
+ {
+     while (*angle < 0)
+         *angle += 360 * 16;
+     while (*angle > 360 * 16)
+         *angle -= 360 * 16;
+ }
Index: trunk/geant4/OpenGLQT_exemple/glwidget.h
===================================================================
--- trunk/geant4/OpenGLQT_exemple/glwidget.h	(revision 562)
+++ trunk/geant4/OpenGLQT_exemple/glwidget.h	(revision 562)
@@ -0,0 +1,50 @@
+#ifndef GLWIDGET_H
+#define GLWIDGET_H
+
+ #include <QGLWidget>
+
+ class GLWidget : public QGLWidget
+ {
+     Q_OBJECT
+
+ public:
+     GLWidget(QWidget *parent = 0);
+     ~GLWidget();
+
+     QSize minimumSizeHint() const;
+     QSize sizeHint() const;
+
+ public slots:
+     void setXRotation(int angle);
+     void setYRotation(int angle);
+     void setZRotation(int angle);
+
+ signals:
+     void xRotationChanged(int angle);
+     void yRotationChanged(int angle);
+     void zRotationChanged(int angle);
+
+ protected:
+     void initializeGL();
+     void paintGL();
+     void resizeGL(int width, int height);
+     void mousePressEvent(QMouseEvent *event);
+     void mouseMoveEvent(QMouseEvent *event);
+
+ private:
+     GLuint makeObject();
+     void quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
+               GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4);
+     void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
+     void normalizeAngle(int *angle);
+
+     GLuint object;
+     int xRot;
+     int yRot;
+     int zRot;
+     QPoint lastPos;
+     QColor trolltechGreen;
+     QColor trolltechPurple;
+ };
+
+ #endif
Index: trunk/geant4/OpenGLQT_exemple/src/moc_window.cpp
===================================================================
--- trunk/geant4/OpenGLQT_exemple/src/moc_window.cpp	(revision 562)
+++ trunk/geant4/OpenGLQT_exemple/src/moc_window.cpp	(revision 562)
@@ -0,0 +1,60 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'window.h'
+**
+** Created: Thu Jul 26 11:42:48 2007
+**      by: The Qt Meta Object Compiler version 59 (Qt 4.2.2)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "window.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'window.h' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 59
+#error "This file was generated using the moc from 4.2.2. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+static const uint qt_meta_data_Window[] = {
+
+ // content:
+       1,       // revision
+       0,       // classname
+       0,    0, // classinfo
+       0,    0, // methods
+       0,    0, // properties
+       0,    0, // enums/sets
+
+       0        // eod
+};
+
+static const char qt_meta_stringdata_Window[] = {
+    "Window\0"
+};
+
+const QMetaObject Window::staticMetaObject = {
+    { &QDialog::staticMetaObject, qt_meta_stringdata_Window,
+      qt_meta_data_Window, 0 }
+};
+
+const QMetaObject *Window::metaObject() const
+{
+    return &staticMetaObject;
+}
+
+void *Window::qt_metacast(const char *_clname)
+{
+    if (!_clname) return 0;
+    if (!strcmp(_clname, qt_meta_stringdata_Window))
+	return static_cast<void*>(const_cast<Window*>(this));
+    return QDialog::qt_metacast(_clname);
+}
+
+int Window::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+    _id = QDialog::qt_metacall(_c, _id, _a);
+    if (_id < 0)
+        return _id;
+    return _id;
+}
Index: trunk/geant4/interfaces/.gdb_history
===================================================================
--- trunk/geant4/interfaces/.gdb_history	(revision 562)
+++ trunk/geant4/interfaces/.gdb_history	(revision 562)
@@ -0,0 +1,4 @@
+run
+where
+exit
+quit
Index: trunk/geant4/interfaces/Doxyfile
===================================================================
--- trunk/geant4/interfaces/Doxyfile	(revision 562)
+++ trunk/geant4/interfaces/Doxyfile	(revision 562)
@@ -0,0 +1,238 @@
+# Doxyfile 1.5.2
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING      = UTF-8
+PROJECT_NAME           = 
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = 
+CREATE_SUBDIRS         = YES
+OUTPUT_LANGUAGE        = English
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_JAVA   = NO
+BUILTIN_STL_SUPPORT    = NO
+CPP_CLI_SUPPORT        = NO
+DISTRIBUTE_GROUP_DOC   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = YES
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = NO
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = /usr/local/geant4.8.2.p01/src/geant4/source/interfaces
+INPUT_ENCODING         = UTF-8
+FILE_PATTERNS          = *.cc \
+                         *.hh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXCLUDE_SYMBOLS        = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = YES
+INLINE_SOURCES         = YES
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = NO
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = NO
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+MSCGEN_PATH            = /Applications/-Local/Divers/Doxygen.app/Contents/Resources/
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = YES
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = YES
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = YES
+CALLER_GRAPH           = YES
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = /sw/bin
+DOTFILE_DIRS           = 
+DOT_GRAPH_MAX_NODES    = 50
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
Index: trunk/geant4/interfaces/G4History.macro
===================================================================
--- trunk/geant4/interfaces/G4History.macro	(revision 562)
+++ trunk/geant4/interfaces/G4History.macro	(revision 562)
@@ -0,0 +1,42 @@
+/run/verbose 2
+/vis/scene/create
+/vis/open DAWNFILE
+/vis/sceneHandler/create DAWNFILE
+/vis/sceneHandler/attach
+/vis/viewer/create ! ! 600
+/vis/open OGLIX
+/control/execute visTutor/gui.mac
+/gui/addMenu file File
+/gui/addButton file Continue continue
+/gui/addButton file Exit "exit"
+/gui/addMenu run Run
+/gui/addButton run "beamOn 1" "/run/beamOn 1"
+/gui/addButton run run1 "/control/execute run1.mac"
+/gui/addButton run run2 "/control/execute run2.mac"
+/gui/addMenu gun Gun
+/gui/addButton gun "50 MeV"  "/gun/energy 50 MeV"
+/gui/addButton gun "1 GeV"   "/gun/energy 1 GeV"
+/gui/addButton gun "10 GeV"  "/gun/energy 10 GeV"
+/gui/addButton gun "e-"      "/gun/particle e-"
+/gui/addButton gun "pi0"     "/gun/particle pi0"
+/gui/addButton gun "pi+"     "/gun/particle pi+"
+/gui/addButton gun "neutron" "/gun/particle neutron"
+/gui/addButton gun "proton"  "/gun/particle proton"
+/gui/addMenu vis Vis
+/gui/addButton vis Vis0(OGLIX) "/control/execute visTutor/exN03Vis0.mac"
+/gui/addButton vis Vis1(OGLSX) "/control/execute visTutor/exN03Vis1.mac"
+/gui/addButton vis Vis2(OGLSX) "/control/execute visTutor/exN03Vis2.mac"
+/gui/addButton vis Vis3(OGLSX) "/control/execute visTutor/exN03Vis3.mac"
+/gui/addButton vis Vis4(OGLIX) "/control/execute visTutor/exN03Vis4.mac"
+/gui/addButton vis Vis5(OIX)   "/control/execute visTutor/exN03Vis5.mac"
+/gui/addButton vis Vis6(VRML2FILE) "/control/execute visTutor/exN03Vis6.mac"
+/gui/addButton vis Vis7(DAWNFILE) "/control/execute visTutor/exN03Vis7.mac"
+/gui/addButton vis Vis8(DAWNFILE) "/control/execute visTutor/exN03Vis8.mac"
+/gui/addButton vis Vis9(OGLIWIN) "/control/execute visTutor/exN03Vis9.mac"
+/gui/addButton vis Vis10(OIWin32) "/control/execute visTutor/exN03Vis10.mac"
+/gui/addButton vis Vis11(OGLSXm) "/control/execute visTutor/exN03Vis11.mac"
+/gui/addMenu viewer Viewer
+/gui/addButton viewer "Set style solid" "/vis/viewer/set/style solid"
+/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wire"
+/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
+/N03/event/printModulo 100
Index: trunk/geant4/interfaces/basic/include/G4UIQt.h
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UIQt.h	(revision 562)
+++ trunk/geant4/interfaces/basic/include/G4UIQt.h	(revision 562)
@@ -0,0 +1,123 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIQt.hh,v 1.13 2006/06/29 19:09:33 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01 $
+//
+#ifndef G4UIQt_h
+#define G4UIQt_h 
+
+#if defined(G4UI_BUILD_QT_SESSION) || defined(G4UI_USE_QT)
+
+#include <map>
+
+#include "G4VBasicShell.hh"
+#include "G4VInteractiveSession.hh"
+
+#include <QtGui/qmainwindow.h>
+#include <QtGui/qlineedit.h>
+#include <QtGui/qtextedit.h>
+#include <QObject>
+class G4UIsession;
+
+// Class description :
+//
+//  G4UIQt : class to handle a Motif interactive session.
+// G4UIQt is the Motif version of G4UIterminal.
+//
+//  A command box is at disposal for entering/recalling Geant4 commands.
+//  A menubar could be customized through the AddMenu, AddButton methods.
+//  Note that there are corresponding Geant4 commands to add a 
+// menus in the menubar and add buttons in a menu.
+//  Ex : 
+//    /gui/addMenu   test Test
+//    /gui/addButton test Init /run/initialize
+//    /gui/addButton test "Set gun" "/control/execute gun.g4m"
+//    /gui/addButton test "Run one event" "/run/beamOn 1"
+//
+//  Command completion, by typing "tab" key, is available on the 
+// command line.
+//
+// Class description - end :
+
+class G4UIQt : public G4VBasicShell, public G4VInteractiveSession {
+
+public: // With description
+  G4UIQt(int,char**);
+  // (argv, argc) or (0, NULL) had to be given.
+  G4UIsession* SessionStart();
+  // To enter interactive X loop ; waiting/executing command,...
+  void AddMenu(const char*,const char*);
+  // To add a pulldown menu in the menu bar. 
+  // First argument is the name of the menu.
+  // Second argument is the label of the cascade button.
+  // Ex : AddMenu("my_menu","My menu")
+  void AddButton(const char*,const char*,const char*);
+  // To add a push button in a pulldown menu.
+  // First argument is the name of the menu.
+  // Second argument is the label of the button.
+  // Third argument is the Geant4 command executed when the button is fired.
+  // Ex : AddButton("my_menu","Run","/run/beamOn 1"); 
+public:
+  ~G4UIQt();
+  void Prompt(G4String);
+  void SessionTerminate();
+  void PauseSessionStart(G4String);
+  G4int ReceiveG4cout(G4String);
+  G4int ReceiveG4cerr(G4String);
+//   G4String GetCommand(Widget);
+private:
+  void SecondaryLoop(G4String);
+  G4bool GetHelpChoice(G4int&);
+  void ExitHelp();
+private:
+
+  //  Widget form,shell,command,menuBar,text;
+  //  std::map<Widget,G4String, std::less<Widget> > commands;
+  //  static void commandEnteredCallback(Widget,XtPointer,XtPointer);
+  //  static void keyHandler(Widget,XtPointer,XEvent*,Boolean*);
+  G4bool fHelp;
+  G4int fHelpChoice;
+  QMainWindow *fMainWindow;
+  UIQtCentralWidget *fCentralWidget;
+};
+
+class UIQtCentralWidget : public QWidget, public QObject {
+
+Q_OBJECT
+
+  QLineEdit *promptArea;
+  QTextEdit *textArea;
+
+private slots:
+  void clearButtonCallback();
+
+};
+
+#endif
+
+#endif
+
Index: trunk/geant4/interfaces/basic/include/wframe.h
===================================================================
--- trunk/geant4/interfaces/basic/include/wframe.h	(revision 562)
+++ trunk/geant4/interfaces/basic/include/wframe.h	(revision 562)
@@ -0,0 +1,135 @@
+#ifndef WFRAME_H
+#define WFRAME_H
+
+#include <QtGui/qmainwindow.h>
+
+class WFrame : public QMainWindow
+{
+  // macro Q_OBJECT indispensable pour sp&eacute;cifier &agrave; Qt l'utilisation du m&eacute;canisme interne de 
+  // communication entre les classes.
+
+    public:
+
+  /**
+   * @brief Constructeur de notre classe.
+   * Initialise les menus, la toolbar et les zones images et d'information.
+   * @param parent : parent de cette fen&ecirc;tre : ici 0 signifie que c'est la fen&ecirc;tre principale
+   * @param applicationPath : chemin absolu de lancement de cette application
+   */
+  WFrame(QMainWindow* parent = 0,const QString& applicationPath= "", Qt::WFlags = Qt::Window );
+
+  /**
+   * @brief Destructeur de classe.
+   */
+  virtual ~WFrame();
+
+ private:
+
+  /** @brief Pointeur sur le widget de la palette  */
+  Palette* m_palette;
+
+  /** @brief Pointeur sur le widget de la visu */	
+  Visu2D* m_visu2d;
+
+  /** @brief Pointeur sur le widget des statistiques */	
+  WStatistiques *m_wStatistiques;
+
+  /** @brief Pointeur sur notre image  */
+  Image *m_pImage;
+
+  /** @brief chemin absolu de lancement de cette application */
+  QString m_applicationPath;
+
+  /** @brief Classe d'&eacute;venements associ&eacute;s au bouton Rectangle  */
+  QAction *m_actionRectangle;
+
+  /** @brief Classe d'&eacute;venements associ&eacute;s au bouton Ellipse */
+  QAction *m_actionEllipse;
+
+  /** @brief Classe d'&eacute;venements associ&eacute;s au bouton Carre  */
+  QAction *m_actionCarre;
+
+  /** @brief Classe d'&eacute;venements associ&eacute;s au bouton Cercle  */
+  QAction *m_actionCercle;
+
+  /** @brief Classe d'&eacute;venements associ&eacute;s au bouton Polygone  */
+  QAction *m_actionPolygone;
+
+  /** @brief Pointeur utilisé pour mémoriser la forme en cours ; pas de bouton directement associé */
+  QAction *m_actionFormeEnCours;
+
+  /** @brief Classe d'&eacute;venements associ&eacute;s au mode déplacement de la forme */
+  QAction *m_actionDeplaceForme;
+
+  /** @brief Classe d'&eacute;venements associ&eacute;s au mode selection de la couleur */
+  QAction *m_actionSelectCouleur;
+
+  /** @brief Classe d'&eacute;venements associ&eacute;s au bouton d'effacement des formes représentées */
+  QAction *m_actionEffaceFormes;
+
+  /** @brief Classe d'&eacute;venements associ&eacute;s au mode ajoute nouvelle forme */
+  QAction *m_actionModeAjoute;
+
+  /** @brief Label associ&eacute; &agrave; la barre de status  */
+  QLabel* m_label;
+
+  public slots:
+  /**
+   * @brief M&eacute;thode appel&eacute;e lors de la selection d'une nouvelle image.
+   * @return true si l'image est correcte, false sinon
+   */
+  bool OuvreImage();
+
+  /**
+   * @brief M&eacute;thode appel&eacute;e par visu2d lorsque un changement de la barre d'info est n&eacute;cessaire
+   * @param s nouvelle string &agrave; affecter &agrave; la barre d'infos
+   */
+  void MAJBarreInfo(const QString& s);
+
+  /**
+   * @brief M&eacute;thode appel&eacute;e lors du clic sur le bouton Rectangle de la toolbar
+   */
+  void ClicRectangle();
+
+  /**
+   * @brief M&eacute;thode appel&eacute;e lors du clic sur le bouton Ellipse de la toolbar
+   */
+  void ClicEllipse();
+
+  /**
+   * @brief M&eacute;thode appel&eacute;e lors du clic sur le bouton Carre de la toolbar
+   */
+  void ClicCarre();
+
+  /**
+   * @brief M&eacute;thode appel&eacute;e lors du clic sur le bouton Cercle de la toolbar
+   */
+  void ClicCercle();
+
+  /**
+   * @brief M&eacute;thode appel&eacute;e lors du clic sur le bouton Polygone de la toolbar
+   */
+  void ClicPolygone();
+
+  /**
+   * @brief Methode appel&eacute;e lors de la mise à jour de la palette. 
+   */
+  void MAJPalette();
+
+  /**
+   * @brief Appelée lorsque la sélection a changé ; pour mettre à jour la fenêtre de stat. 
+   */
+  void MAJStatistiques(Selection*, int);
+
+ protected:
+  /** @brief Initialise les menus */
+  void InitMenus();
+
+  /** @brief Initialise la barre d'outils  */
+  void InitToolBar();
+
+  /** @brief Change le type de forme sélectionné  */
+  void SetType(QAction* tb, TYPE_FORME type);
+};
+
+#endif // WFRAME_H
Index: trunk/geant4/interfaces/basic/src/G4UIQt.cc.orig
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIQt.cc.orig	(revision 562)
+++ trunk/geant4/interfaces/basic/src/G4UIQt.cc.orig	(revision 562)
@@ -0,0 +1,678 @@
+// TODO !
+
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIQt.cc,v 1.14 2007/05/29 11:09:49 $
+// GEANT4 tag $Name: geant4-08-01 $
+//
+// L. Garnier
+
+//#define DEBUG
+
+#ifdef G4UI_BUILD_QT_SESSION
+
+#include "G4Types.hh"
+
+#include <string.h>
+
+#include "G4UIQt.hh"
+#include "G4UImanager.hh"
+#include "G4StateManager.hh"
+#include "G4UIcommandTree.hh"
+#include "G4UIcommandStatus.hh"
+
+#include "G4Qt.hh"
+
+#include <QtGui/qapplication.h>
+#include <QtGui/qwidget.h>
+#include <QtGui/qmenu.h>
+#include <QtGui/qmenubar.h>
+#include <QtGui/qboxlayout.h>
+#include <QtGui/qpushbutton.h>
+#include <QtGui/qlabel.h>
+#include <QtGui/qsplitter.h>
+#include <QtGui/qscrollbar.h>
+#include <QtGui/qdialog.h>
+
+#include <stdlib.h>
+
+// Pourquoi Static et non  variables de classe ?
+static G4bool exitSession = true;
+static G4bool exitPause = true;
+/***************************************************************************/
+/**
+ Build a Qt window with a menubar, output area and promt area 
+      +-----------------------+
+      |exit menu|             |
+      |                       |
+      | +-------------------+ |
+      | |                   | |
+      | |  Output area      | |
+      | |                   | |
+      | +-------------------+ |
+      |     | clear |         |
+      | +-------------------+ |
+      | |  promt history    | |
+      | +-------------------+ |
+      | +-------------------+ |
+      | |> promt area       | |
+      | +-------------------+ |
+      +-----------------------+
+*/
+
+G4UIQt::G4UIQt (
+    int argc,
+    char** argv
+)
+        :fHelpDialog(NULL)
+
+        /***************************************************************************/
+        /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    G4Qt* interactorManager = G4Qt::getInstance ();
+    G4UImanager* UI = G4UImanager::GetUIpointer();
+    if(UI!=NULL)
+        UI->SetSession(this);
+
+    fMainWindow = new QMainWindow();
+    fMainWindow->setWindowTitle( "G4UI Session" );
+    fMainWindow->resize(800,600);
+    fMainWindow->move(QPoint(300,100));
+
+    QSplitter *splitter = new QSplitter(Qt::Vertical);
+    fTextArea = new QTextEdit();
+    QPushButton *clearButton = new QPushButton("clear");
+    connect(clearButton, SIGNAL(clicked()), SLOT(clearButtonCallback()));
+
+    fCommandHistoryArea = new QTextEdit();
+    fCommandLabel = new QLabel();
+
+    fCommandArea = new QLineEdit();
+    fCommandArea->activateWindow();
+    connect(fCommandArea, SIGNAL(returnPressed()), SLOT(commandEnteredCallback()));
+    fCommandArea->setFocusPolicy ( Qt::StrongFocus );
+    fCommandArea->setFocus(Qt::TabFocusReason);
+    fTextArea->setReadOnly(true);
+    fCommandHistoryArea->setReadOnly(true);
+
+
+
+    // Set layouts
+    QVBoxLayout *layoutSplitter = new QVBoxLayout;
+
+    QWidget* topWidget = new QWidget();
+    QVBoxLayout *layoutTop = new QVBoxLayout;
+
+    QWidget* bottomWidget = new QWidget();
+    QVBoxLayout *layoutBottom = new QVBoxLayout;
+
+
+    layoutTop->addWidget(fTextArea);
+    layoutTop->addWidget(clearButton);
+    topWidget->setLayout(layoutTop);
+
+    layoutBottom->addWidget(fCommandHistoryArea);
+    layoutBottom->addWidget(fCommandLabel);
+    layoutBottom->addWidget(fCommandArea);
+    bottomWidget->setLayout(layoutBottom);
+
+
+    layoutSplitter->addWidget(topWidget);
+    layoutSplitter->addWidget(bottomWidget);
+    splitter->setLayout(layoutSplitter);
+
+    fMainWindow->setCentralWidget(splitter);
+
+    // Add a quit subMenu
+    QMenu *fileMenu = fMainWindow->menuBar()->addMenu("File");
+    fileMenu->addAction("Quitter", fMainWindow, SLOT(close()));
+
+    // Add a Help menu
+    QMenu *helpMenu = fMainWindow->menuBar()->addMenu("Help");
+    helpMenu->addAction("Show Help", this, SLOT(showHelpCallback()));
+
+    // Set the splitter size. The fTextArea sould be 2/3 on the fMainWindow
+    QList<int> vals = splitter->sizes();
+    if(vals.size()==2) {
+        vals[0] = (splitter->orientation()==Qt::Vertical ? splitter->height() : splitter->width())*3/4;
+        vals[1] = (splitter->orientation()==Qt::Vertical ? splitter->height() : splitter->width())*1/4;
+        splitter->setSizes(vals);
+    }
+
+
+    if(UI!=NULL)
+        UI->SetCoutDestination(this);  // TO KEEP
+}
+/***************************************************************************/
+G4UIQt::~G4UIQt(
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    G4UImanager* UI = G4UImanager::GetUIpointer();  // TO KEEP
+    if(UI!=NULL) {  // TO KEEP
+        UI->SetSession(NULL);  // TO KEEP
+        UI->SetCoutDestination(NULL);  // TO KEEP
+    }
+
+
+    if (fMainWindow!=NULL)
+        delete fMainWindow;
+}
+/***************************************************************************/
+/*
+    Start the Qt main loop
+ */
+G4UIsession* G4UIQt::SessionStart (
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+
+    G4Qt* interactorManager = G4Qt::getInstance ();
+    fMainWindow->show();
+    Prompt("session");
+    exitSession = false;
+
+
+    printf("disable secondary loop\n");
+    interactorManager->DisableSecondaryLoop (); // TO KEEP
+    ((QApplication*)interactorManager->GetMainInteractor())->exec();
+    // on ne passe pas le dessous ? FIXME ????
+    // je ne pense pas 13/06
+
+    //   void* event; // TO KEEP
+    //   while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
+    //     interactorManager->DispatchEvent(event); // TO KEEP
+    //     if(exitSession==true) break; // TO KEEP
+    //   } // TO KEEP
+
+    interactorManager->EnableSecondaryLoop ();
+    printf("enable secondary loop\n");
+    return this;
+}
+/***************************************************************************/
+
+/**
+  Display the prompt in the prompt area
+ */
+void G4UIQt::Prompt (
+    G4String aPrompt
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    fCommandLabel->setText((char*)aPrompt.data());
+}
+/***************************************************************************/
+void G4UIQt::SessionTerminate (
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    G4Qt* interactorManager = G4Qt::getInstance ();
+    fMainWindow->close();
+    ((QApplication*)interactorManager->GetMainInteractor())->exit();
+}
+/***************************************************************************/
+void G4UIQt::PauseSessionStart (
+    G4String a_state
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    printf("G4UIQt::PauseSessionStart\n");
+    if(a_state=="G4_pause> ") {  // TO KEEP
+        SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP
+    } // TO KEEP
+
+    if(a_state=="EndOfEvent") { // TO KEEP
+        // Picking with feed back in event data Done here !!!
+        SecondaryLoop ("End of event, type continue to exit this state"); // TO KEEP
+    } // TO KEEP
+}
+/***************************************************************************/
+void G4UIQt::SecondaryLoop (
+    G4String a_prompt
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    printf("G4UIQt::SecondaryLoop\n");
+    G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
+    Prompt(a_prompt); // TO KEEP
+    exitPause = false; // TO KEEP
+    void* event; // TO KEEP
+    while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
+        interactorManager->DispatchEvent(event); // TO KEEP
+        if(exitPause==true)
+            break; // TO KEEP
+    } // TO KEEP
+    Prompt("session"); // TO KEEP
+}
+/***************************************************************************/
+/**
+  Receive a cout from Geant4. We have to display it in the cout zone
+ */
+G4int G4UIQt::ReceiveG4cout (
+    G4String a_string
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    fTextArea->append(QString((char*)a_string.data()).trimmed());
+    fTextArea->verticalScrollBar()->setSliderPosition(fTextArea->verticalScrollBar()->maximum());
+    return 0;
+}
+/***************************************************************************/
+/**
+  Receive a cerr from Geant4. We have to display it in the cout zone
+ */
+G4int G4UIQt::ReceiveG4cerr (
+    G4String a_string
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    QColor previousColor = fTextArea->textColor();
+    fTextArea->setTextColor(Qt::red);
+    fTextArea->append(QString((char*)a_string.data()).trimmed());
+    fTextArea->setTextColor(previousColor);
+    fTextArea->verticalScrollBar()->setSliderPosition(fTextArea->verticalScrollBar()->maximum());
+    return 0;
+}
+
+/***************************************************************************/
+void G4UIQt::AddMenu (
+    const char* a_name
+    ,const char* a_label
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    printf("G4UIQt::AddMenu %s %s\n",a_name,a_label);
+
+    //  QMenu *fileMenu = fMainWindow->menuBar()->addMenu(a_label);
+    QMenu *fileMenu = new QMenu(a_label);
+    fMainWindow->menuBar()->insertMenu(fMainWindow->menuBar()->actions().last(),fileMenu);
+    AddInteractor (a_name,(G4Interactor)fileMenu);
+}
+/***************************************************************************/
+void G4UIQt::AddButton (
+    const char* a_menu
+    ,const char* a_label
+    ,const char* a_command
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    if(a_menu==NULL)
+        return; // TO KEEP
+    if(a_label==NULL)
+        return; // TO KEEP
+    if(a_command==NULL)
+        return; // TO KEEP
+    QMenu *parent = (QMenu*)GetInteractor(a_menu);
+    if(parent==NULL)
+        return;
+
+    signalMapper = new QSignalMapper(this);
+    QAction *action = parent->addAction(a_label, signalMapper, SLOT(map()));
+    signalMapper->setMapping(action, QString(a_command));
+    connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(buttonCallback(const QString&)));
+}
+
+
+
+
+/**
+  Open the help dialog in a separate window.
+  This will be display as a tree widget
+  Implementation of <b>void G4VBasicShell::TerminalHelp(G4String newCommand)</b>
+ 
+  @param newCommand : open the tree widget item on this command if is set
+ */
+void G4UIQt::TerminalHelp(G4String newCommand) {
+    if (!fHelpDialog) {
+        fHelpDialog = new QDialog;
+
+        QSplitter *splitter = new QSplitter(Qt::Horizontal);
+        fHelpArea = new QTextEdit();
+        QPushButton *exitButton = new QPushButton("Exit");
+        connect(exitButton, SIGNAL(clicked()), fHelpDialog,SLOT(close()));
+        fHelpArea->setReadOnly(true);
+
+        // the help tree
+        G4UImanager* UI = G4UImanager::GetUIpointer();
+        if(UI==NULL)
+            return;
+        G4UIcommandTree * treeTop = UI->GetTree();
+
+
+        // build widget
+        fHelpTreeWidget = new QTreeWidget();
+        fHelpTreeWidget->setColumnCount(2);
+        fHelpTreeWidget->setColumnHidden(1,true);
+        QStringList labels;
+        labels << QString("Command") << QString("Description");
+        fHelpTreeWidget->setHeaderLabels(labels);
+
+        QList<QTreeWidgetItem *> items;
+        G4int treeSize = treeTop->GetTreeEntry();
+        QTreeWidgetItem * newItem;
+        for (int a=0;a<treeSize;a++) {
+            // Creating new item
+            QStringList stringList;
+            stringList << QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).trimmed()  ;
+            stringList << QString((char*)(treeTop->GetTree(a+1)->GetTitle()).data()).trimmed()  ;
+
+            newItem = new QTreeWidgetItem(stringList);
+
+            // look for childs
+            CreateChildTree(newItem,treeTop->GetTree(a+1));
+            items.append(newItem);
+        }
+        fHelpTreeWidget->insertTopLevelItems(0, items);
+
+        //connecting callback
+        //  QSignalMapper signalMapper = new QSignalMapper(this);
+
+        connect(fHelpTreeWidget, SIGNAL(itemSelectionChanged ()),this, SLOT(helpTreeCallback()));
+
+        // Set layouts
+        QHBoxLayout *splitterLayout = new QHBoxLayout;
+
+        QVBoxLayout *vLayout = new QVBoxLayout;
+
+        splitterLayout->addWidget(fHelpTreeWidget);
+        splitterLayout->addWidget(fHelpArea);
+        splitter->setLayout(splitterLayout);
+
+        vLayout->addWidget(splitter);
+        vLayout->addWidget(exitButton);
+        fHelpDialog->setLayout(vLayout);
+
+    }
+
+    // Look for the choosen command "newCommand"
+    size_t i = newCommand.index(" ");
+    G4String targetCom="";
+    if( i != std::string::npos ) {
+        G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
+        newValue.strip(G4String::both);
+        targetCom = ModifyToFullPathCommand( newValue );
+        printf("test : av:%s-- ap:%s--\n",((char*)newValue.data()),((char*)targetCom.data()));
+    }
+    if (targetCom != "") {
+        QList<QTreeWidgetItem *> list = fHelpTreeWidget->findItems(QString(((char*)targetCom.data())),Qt::MatchFixedString,0);
+        for (int a=0;a<13;a++) {
+            printf("verif.... =%s= +%s+\n",fHelpTreeWidget->topLevelItem(a)->text(0).toStdString().c_str(),((char*)targetCom.data()));
+        }
+
+        if (!list.isEmpty()) {
+            printf("found...........\n");
+            if (list.first()->childCount() >0)
+                list.first()->setExpanded(true);
+
+            QList<QTreeWidgetItem *> selected = fHelpTreeWidget->selectedItems();
+            if (!selected.isEmpty()) {
+                for (int a=0;a<selected.count();a++) {
+                    printf("unselect %d\n",selected.count());
+                    //          selected.at(a)->setSelected(false);
+                    selected.first()->setSelected(false);
+                }
+                printf("AAA\n");
+            }
+            printf("BB\n");
+            list.first()->setSelected(true);
+            printf("CC\n");
+
+            // Call the update of the right textArea
+            helpTreeCallback();
+            printf("DD\n");
+        }
+    }
+    fHelpDialog->resize(800,600);
+    fHelpDialog->move(QPoint(400,150));
+    fHelpDialog->show();
+    fHelpDialog->raise();
+    fHelpDialog->activateWindow();
+}
+
+
+
+void G4UIQt::CreateChildTree(QTreeWidgetItem *a_parent,G4UIcommandTree *a_commandTree) {
+
+    // Creating new item
+    QTreeWidgetItem * newItem;
+
+
+    // Get the Sub directories
+    for (int a=0;a<a_commandTree->GetTreeEntry();a++) {
+
+        QStringList stringList;
+        stringList << QString((char*)(a_commandTree->GetTree(a+1)->GetPathName()).data()).trimmed()  ;
+        stringList << QString((char*)(a_commandTree->GetTree(a+1)->GetTitle()).data()).trimmed()  ;
+        newItem = new QTreeWidgetItem(stringList);
+
+        CreateChildTree(newItem,a_commandTree->GetTree(a+1));
+        a_parent->addChild(newItem);
+    }
+
+
+
+    // Get the Commands
+
+    for (int a=0;a<a_commandTree->GetCommandEntry();a++) {
+
+        QStringList stringList;
+        stringList << QString((char*)(a_commandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed()  ;
+        stringList << QString((char*)(a_commandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed()  ;
+        newItem = new QTreeWidgetItem(stringList);
+
+        a_parent->addChild(newItem);
+        newItem->setExpanded(false);
+    }
+}
+
+
+/**
+  This fonction return the command list parameters in a QString
+ 
+ */
+/***************************************************************************/
+QString G4UIQt::GetCommandList (
+    G4UIcommand *a_command
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+
+    QString txt;
+    G4String commandPath = a_command->GetCommandPath();
+    G4String rangeString = a_command->GetRange();
+
+    if((commandPath.length()-1)!='/') {
+        txt += "Command " + QString((char*)(commandPath).data()) + "\n";
+    }
+    txt += "Guidance :\n";
+    G4int n_guidanceEntry = a_command->GetGuidanceEntries();
+
+    for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
+        txt += QString((char*)(a_command->GetGuidanceLine(i_thGuidance)).data()) + "\n";
+    }
+    if( ! rangeString.isNull() ) {
+        txt += " Range of parameters : " + QString((char*)(rangeString).data()) + "\n";
+    }
+    G4int n_parameterEntry = a_command->GetParameterEntries();
+    if( n_parameterEntry > 0 ) {
+        G4UIparameter *param;
+
+        // Re-implementation of G4UIparameter.cc
+
+        for( G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
+            param = a_command->GetParameter(i_thParameter);
+            txt += "\nParameter : " + QString((char*)(param->GetParameterName()).data()) + "\n";
+            if( ! param->GetParameterGuidance().isNull() )
+                txt += QString((char*)(param->GetParameterGuidance()).data())+ "\n" ;
+            txt += " Parameter type  : " + QString(param->GetParameterType())+ "\n";
+            if(param->IsOmittable()) {
+                txt += " Omittable       : True\n";
+            } else {
+                txt += " Omittable       : False\n";
+            }
+            if( param->GetCurrentAsDefault() ) {
+                txt += " Default value   : taken from the current value\n";
+            } else if( ! param->GetDefaultValue().isNull() ) {
+                txt += " Default value   : " + QString((char*)(param->GetDefaultValue()).data())+ "\n";
+            }
+            if( ! param->GetParameterRange().isNull() )
+                txt += " Parameter range : " + QString((char*)(param->GetParameterRange()).data())+ "\n";
+            if( ! param->GetParameterCandidates().isNull() )
+                txt += " Candidates      : " + QString((char*)(param->GetParameterCandidates()).data())+ "\n";
+        }
+    }
+    return txt;
+}
+
+
+
+/***************************************************************************/
+void G4UIQt::expandHelpItem (
+    QTreeWidgetItem *a_parent
+    ,G4UIcommand* a_expandCommand
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+}
+
+
+
+/***************************************************************************/
+//
+//             SLOTS DEFINITIONS
+//
+/***************************************************************************/
+
+/***************************************************************************/
+void G4UIQt::showHelpCallback (
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    TerminalHelp("");
+}
+
+/***************************************************************************/
+void G4UIQt::clearButtonCallback (
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    fTextArea->clear();
+}
+
+
+/**
+  Callback call when "click on a menu entry.
+  Send the associated command to geant4
+ */
+void G4UIQt::commandEnteredCallback (
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    printf ("debug : callback\n");
+    G4String command (fCommandArea->text().toStdString().c_str());
+    if (fCommandArea->text().toStdString().c_str() != "") {
+        fCommandHistoryArea->append(fCommandArea->text());
+
+        if (command(0,4) != "help") {
+            ApplyShellCommand (command,exitSession,exitPause);
+        } else {
+            printf ("terminal help\n");
+            TerminalHelp(command);
+        }
+        if(exitSession==true)
+            SessionTerminate();
+    }
+    fCommandArea->setText("");
+}
+
+/**
+  Callback call when "enter" clicked on the command zone.
+  Send the command to geant4
+ */
+void G4UIQt::buttonCallback (
+    const QString& a_command
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    G4String ss = G4String(a_command.toStdString().c_str());
+    printf ("debug : execute:\n-%s- %d %d \n",ss.data(),exitSession,exitPause);
+    ApplyShellCommand(ss,exitSession,exitPause);
+    if(exitSession==true)
+        SessionTerminate();
+}
+/**
+This callback is activated when user selected a item in the help tree
+ */
+void G4UIQt::helpTreeCallback (
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+    //  G4bool GetHelpChoice(G4int&);
+    QTreeWidgetItem* item =  NULL;
+    if (!fHelpTreeWidget)
+        return ;
+
+    if (!fHelpArea)
+        return;
+
+    item = fHelpTreeWidget->selectedItems().first();
+    if (!item)
+        return;
+
+    G4UImanager* UI = G4UImanager::GetUIpointer();
+    if(UI==NULL)
+        return;
+    G4UIcommandTree * treeTop = UI->GetTree();
+    G4UIcommand* command = treeTop->FindPath(item->text (1).toStdString().c_str());
+    if (command) {
+        fHelpArea->setText(GetCommandList(command));
+    } else {
+        // this is not a command, this is a sub directory
+        // We display the Title
+        fHelpArea->setText(item->text (1).toStdString().c_str());
+    }
+}
+
+
+#endif
Index: trunk/geant4/interfaces/currentEvent.rndm
===================================================================
--- trunk/geant4/interfaces/currentEvent.rndm	(revision 562)
+++ trunk/geant4/interfaces/currentEvent.rndm	(revision 562)
@@ -0,0 +1,5 @@
+Uvec
+1878463799
+0
+9876
+54321
Index: trunk/geant4/interfaces/currentRun.rndm
===================================================================
--- trunk/geant4/interfaces/currentRun.rndm	(revision 562)
+++ trunk/geant4/interfaces/currentRun.rndm	(revision 562)
@@ -0,0 +1,5 @@
+Uvec
+1878463799
+0
+1180857998
+122938492
Index: trunk/geant4/interfaces/vis.mac
===================================================================
--- trunk/geant4/interfaces/vis.mac	(revision 562)
+++ trunk/geant4/interfaces/vis.mac	(revision 562)
@@ -0,0 +1,66 @@
+#
+# Macro file for the initialization phase of "exampleN03.cc"
+# when running in interactive mode
+#
+# Sets some default verbose
+#
+/control/verbose 2
+/control/saveHistory
+/run/verbose 2
+#
+# create empty scene
+#
+/vis/scene/create
+#
+# Create a scene handler for a specific graphics system
+# (Edit the next line(s) to choose another graphic system)
+#
+# Use this open statement to get an .eps and .prim files
+# suitable for viewing in DAWN.
+/vis/open DAWNFILE
+#
+# Use this open statement instead for OpenGL in immediate mode.
+#/vis/open OGLIQT
+/vis/open OGLIX
+#
+# Use this open statement instead to get a HepRep version 1 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepFile
+#
+# Use this open statement instead to get a HepRep version 2 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepXML
+#
+# Output an empty detector
+/vis/viewer/flush
+#
+# Draw trajectories at end of event, showing trajectory points as
+# markers of size 2 pixels
+/vis/scene/add/trajectories
+/vis/modeling/trajectories/create/drawByCharge
+/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
+# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
+#
+# To draw gammas only
+#/vis/filtering/trajectories/create/particleFilter
+#/vis/filtering/trajectories/particleFilter-0/add gamma
+#
+# To draw charged particles only
+#/vis/filtering/trajectories/particleFilter-0/invert true
+#
+# Many other options available with /vis/modeling and /vis/filtering.
+# For example, select colour by particle ID
+#/vis/modeling/trajectories/create/drawByParticleID
+#/vis/modeling/trajectories/drawByParticleID-0/set e- red
+#
+/vis/scene/endOfEventAction accumulate
+#
+# At end of each run, an automatic flush causes graphical output.
+#/run/beamOn 1
+# When you exit Geant4, you will find a file called scene-0.heprep.zip.
+# Unzipping this will give you three separate HepRep files suitable for
+# viewing in WIRED.
+# The first file will contain just detector geometry.
+# The second file will contain the detector plus one event.
+# The third file will contain the detector plus ten events.
Index: trunk/geant4/interfaces/visTutor/History
===================================================================
--- trunk/geant4/interfaces/visTutor/History	(revision 562)
+++ trunk/geant4/interfaces/visTutor/History	(revision 562)
@@ -0,0 +1,36 @@
+====================================
+examples/novice/N03/visTutor/History
+====================================
+
+3rd May 2005  John Allison  (examples-V07-00-03)
+- Replaced vis manager with G4VisExecutive.
+
+10-12-04 Joseph Perl
+- exNo3Vis5.mac: changed name in comments in header from ...Vis6 to ...Vis5.
+- exNo3Vis6.mac: changed name in comments in header from ...Vis7 to ...Vis6.
+- exNo3Vis7.mac: changed name in comments in header from ...Vis8 to ...Vis7.
+- exNo3Vis8.mac: changed name in comments in header from ...Vis9 to ...Vis8.
+- exNo3Tree1.mac: changed name in comments in header from ...Tree0 to ...Tree1.
+
+27-11-03 Gabriele Cosmo 
+- removed script exN03Vis5.mac of OPACS and renamed scripts 6/7/8/9 to
+  5/6/7/8 respectively. Added scripts to gui.mac.
+
+14-11-01 Satoshi Tanaka (exN03VisTutor-V03-02-02)
+- exN03Vis8.mac : Batch visualization with the DAWNFILE driver
+- exN03Vis9.mac : Multi-page PostScript file generation (old exN03Vis8.mac)
+
+08-11-01 Satoshi Tanaka (exN03VisTutor-V03-02-01a)
+- /vis/viewer/viewpointThetaPhi ==> /vis/viewer/set/viewpointThetaPhi
+
+07-11-01 Satoshi Tanaka (exN03VisTutor-V03-02-01)
+- Macros are rewritten with /vis/viewer/flush
+- Comments are updated.
+
+18-09-01 Satoshi Tanaka (exN03VisTutor-V03-02-00)
+- Updation for automatic visualization at Hebden Bridge mini-workshop.
+- /vis/viewer/flush and /vis/flushAll are not included yet.
+  (To be included in the next tag.) 
+- /vis/drawTree may still require /vis/scene/notifyHandlers.
+  (John Allison will revise the /vis/drawTree command soon.)
+
Index: trunk/geant4/interfaces/visTutor/exN03Tree0.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Tree0.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Tree0.mac	(revision 562)
@@ -0,0 +1,59 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Tree0.mac                                    #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#                                                                     #
+#  CONTENTS: A macro to demonstrate ASCII DTREE                       #
+#                                                                     #
+#  USAGE:                                                             #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Tree0.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix / Windows                     #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     # 
+#  VERBOSE LEVEL:                                                     #
+#                                                                     # 
+#    <  10: - does not print daughters of repeated logical volumes.   #
+#           - does not repeat replicas.                               #
+#    >= 10: prints all physical volumes.                              #
+#    For level of detail add:                                         #
+#    >=  0: prints physical volume name.                              #
+#    >=  1: prints logical volume name.                               #
+#    >=  2: prints solid name and type.                               #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#    * The geometry tree is displayed in the stdout.                  #
+#    * The compound command to visualize geometry tree:               # 
+#      /vis/drawTree [<physical-volume-name>] [<system>]              # 
+#######################################################################
+
+# Draw the whole geometry tree
+/vis/drawTree 
+
+# Draw a part of tree
+/vis/drawTree Gap 
+
+# Change the level to display details 
+/vis/ASCIITree/verbose 1
+/vis/drawTree
+
+# Change the level to display details
+/vis/ASCIITree/verbose 2
+/vis/drawTree
+
+# Change the level to display details
+/vis/ASCIITree/verbose 10
+/vis/drawTree
Index: trunk/geant4/interfaces/visTutor/exN03Tree1.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Tree1.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Tree1.mac	(revision 562)
@@ -0,0 +1,63 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Tree1.mac                                    #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#                                                                     #
+#  CONTENTS: A macro to demonstrate GAG DTREE                         #
+#                                                                     #
+#  USAGE:                                                             #
+#          * Edit exampleN03.cc to use the GAG interface              #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Tree1.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix/Windows, GAG (Java version)   #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     # 
+#  VERBOSE LEVEL:                                                     #
+#                                                                     # 
+#    <  10: - does not print daughters of repeated logical volumes.   #
+#           - does not repeat replicas.                               #
+#    >= 10: prints all physical volumes.                              #
+#    For level of detail add:                                         #
+#    >=  0: prints physical volume name.                              #
+#    >=  1: prints logical volume name.                               #
+#    >=  2: prints solid name and type.                               #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#    * The geometry tree is displayed in GAG windows stdout.          #
+#      (If you are using the G4 character terminals, the tree is      #
+#       displayed in stdout.)                                         # 
+#    * The compound command to visualize geometry tree:               # 
+#      /vis/drawTree [<physical-volume-name>] [<system>]              #
+#######################################################################
+
+# Draw the whole geometry tree
+#  Note: "!" means the default argument, i.e., "world"
+/vis/drawTree ! GAGTree
+
+# Draw a part of tree
+/vis/drawTree Gap GAGTree
+
+# Change the level to display details 
+/vis/GAGTree/verbose 1
+/vis/drawTree ! GAGTree
+
+# Change the level to display details
+/vis/GAGTree/verbose 2
+/vis/drawTree ! GAGTree
+
+# Change the level to display details
+/vis/GAGTree/verbose 10
+/vis/drawTree ! GAGTree
Index: trunk/geant4/interfaces/visTutor/exN03Vis0.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis0.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis0.mac	(revision 562)
@@ -0,0 +1,108 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis0.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#        May      20, 2000                                            # 
+#        November 10, 1999                                            #
+#                                                                     #
+#  CONTENTS: A simplest macro to demonstrate visualization of         #
+#            detector geometry and events                             #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis0.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+##############################################
+# Visualization of detector geometry 
+#  with the OGLIX (OpenGL Immediate X) driver
+##############################################
+
+# Invoke the OGLIX driver
+/vis/open OGLIX
+#/vis/open DAWNFILE
+
+# Set camera 
+/vis/viewer/reset 
+/vis/viewer/set/viewpointThetaPhi 70 20
+
+# Create an empty scene and add the detector geometry to it
+/vis/drawVolume
+
+# The following command "flush" 
+#  the action of the current viewer.
+#  They are required for the post-processing drivers 
+#  such as DAWNFILE, VRMLFILE, HepRep drivers, etc.
+#  For OpenGL drivers, these commands are not required
+#  but harmless even if they are described.
+/vis/viewer/flush
+
+#########################################################
+# Visualization of events with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver
+/vis/open DAWNFILE
+
+# Add the world volume to the current scene
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Set camera 
+/vis/viewer/reset 
+/vis/viewer/zoom              1.5
+/vis/viewer/set/viewpointThetaPhi 70 20
+
+# Visualize events added to the current scene
+/tracking/storeTrajectory 1
+/run/beamOn 3
Index: trunk/geant4/interfaces/visTutor/exN03Vis1.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis1.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis1.mac	(revision 562)
@@ -0,0 +1,164 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis1.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#        May      20, 2000                                            # 
+#        November 10, 1999                                            #
+#                                                                     #
+#  CONTENTS: A basic macro for visualization of detector geometry     #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis1.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+###########################################
+# Visualization of detector geometry 
+#  with the OGLSX (OpenGL Stored X) driver
+###########################################
+
+# Invoke the OGLSX driver 
+/vis/open OGLSX
+
+# Bird's-eye view of the detector geometry 
+#
+#  viewpoint  : (theta,phi) = (20*deg, 70*deg), 
+#  zoom factor: 0.8 of the full screen size
+#
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi  20 70
+/vis/viewer/zoom               0.8 
+/vis/drawVolume
+
+# The following two commands "flush" 
+#  the action of the current viewer.
+#  They are required for the post-processing drivers 
+#  such as DAWNFILE, VRMLFILE, HepRep drivers, etc.
+#  For OpenGL drivers, these commands are not required
+#  but harmless even if they are described.
+/vis/viewer/flush
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Bird's-eye view of a detector component (Absorber)
+#  viewpoint  : (theta,phi) = (35*deg, 35*deg), 
+#  zoom factor: 1.1 of the full screen size
+#  coordinate axes:
+#     x-axis:red,  y-axis:green,  z-axis:blue
+#     origin: (0,0,0),  length: 500
+#  Scale: length = 10 cm, Orientation = z, color = red, 
+#         placing_algorithm = manual, 
+#         center = (-2.5 cm , -5 cm, 0 cm)
+#
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume           Absorber 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm  40 -100 -140   Absorber 
+/vis/scene/add/scale     10 cm z 1 0 0 manual -2.5 -5 0  cm
+
+# "Flush the action of all the existing viewers.
+#   Note: You should execute these commands, e.g.,  
+#         when the current scene is modified.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+# Bird's-eye view of a detector component (Gap)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume                Gap 
+/vis/scene/add/axes  	  0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm  50 -100 -140   Gap 
+/vis/scene/add/scale      10 cm z 1 0 0 manual -2.5 -5  0 cm
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Bird's-eye view of the whole detector components (world)
+#  * The argument "world" of the command 
+#    "/vis/scene/add/volume" is omittable.
+#  * "/vis/viewer/set/culling false" makes the invisible 
+#    world volume visible.
+#    (The invisibility of the world volume is set 
+#     in ExN03DetectorConstruction.cc.)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/viewer/set/culling         global false
+/vis/drawVolume 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm 50 -100 -240   World
+/vis/scene/add/scale     10 cm x 1 0 0 
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Make the culling on for next visualization
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling       global true
Index: trunk/geant4/interfaces/visTutor/exN03Vis10.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis10.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis10.mac	(revision 562)
@@ -0,0 +1,72 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis10.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Guy Barrand                                             #
+#                                                                     #
+#  DATE: June 09, 2000                                                #
+#                                                                     #
+#  CONTENTS: A basic macro for demonstrating Inventor driver          #
+#                                                                     #
+#  USAGE:  % $G4BINDIR/exampleN03  visTutor/exN03Vis6.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Windows,                           #
+#                                  some Inventor (TGS, SGI, Coin)     #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    G4VIS_BUILD_OIWIN32_DRIVER                                       # 
+#    G4UI_BUILD_WIN32_SESSION                                         # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    G4VIS_USE_OIWIN32                                                #
+#    G4UI_USE_WIN32                                                   # 
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+# Create "scene-0" 
+/vis/scene/create
+
+# Invoke the OpenInventor driver 
+/vis/sceneHandler/create OIWin32
+/vis/viewer/create
+
+# Add the world volume to the current scene
+/vis/scene/add/volume
+#/vis/scene/add/volume Layer
+# Name of the absorbers = name of their material (Lead) !
+#/vis/scene/add/volume Lead
+# Name of the gaps = name of their material (liquidArgon) !
+#/vis/scene/add/volume liquidArgon
+#/vis/scene/add/trajectories
+/tracking/storeTrajectory 1
+
+# Bird-eye view of events
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi   45 45 
+
+/vis/scene/notifyHandlers
+
+/control/verbose 2
+#######################################################################
+#   Controls on an Inventor examiner viewer are :                     #
+#  - in picking mode (cursor is the upper left arrow)                 #
+#   Ctrl + pick a volume : see daughters.                             #
+#   Shift + pick a volume : see mother.                               #
+#  - in viewing mode (cursor is the hand)                             #
+#   Left-button + pointer move : rotate.                              #
+#   Ctrl+Left-button + pointer move : pan.                            #
+#   Ctrl+Shift+Left-button + pointer move : scale.                    #
+#   Middle-button + pointer move : pan.                               #
+#                                                                     #
+#######################################################################
+
+/vis/viewer/update
+
+/run/beamOn 1
+
+
Index: trunk/geant4/interfaces/visTutor/exN03Vis11.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis11.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis11.mac	(revision 562)
@@ -0,0 +1,157 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis11.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Guy Barrand dd                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        April    08, 2004                                            #
+#                                                                     #
+#  CONTENTS: A basic macro for visualization of detector geometry     #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis11.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+###########################################
+# Visualization of detector geometry 
+#  with the OGLSXm (OpenGL Stored Motif) driver
+###########################################
+
+# Invoke the OGLSXm driver 
+/vis/open OGLSXm
+
+# Bird's-eye view of the detector geometry 
+#
+#  viewpoint  : (theta,phi) = (20*deg, 70*deg), 
+#  zoom factor: 0.8 of the full screen size
+#
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi  20 70
+/vis/viewer/zoom               0.8 
+/vis/drawVolume
+
+# The following two commands "flush" 
+#  the action of the current viewer.
+#  They are required for the post-processing drivers 
+#  such as DAWNFILE, VRMLFILE, HepRep drivers, etc.
+#  For OpenGL drivers, these commands are not required
+#  but harmless even if they are described.
+/vis/viewer/flush
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Bird's-eye view of a detector component (Absorber)
+#  viewpoint  : (theta,phi) = (35*deg, 35*deg), 
+#  zoom factor: 1.1 of the full screen size
+#  coordinate axes:
+#     x-axis:red,  y-axis:green,  z-axis:blue
+#     origin: (0,0,0),  length: 500
+#  Scale: length = 10 cm, Orientation = z, color = red, 
+#         placing_algorithm = manual, 
+#         center = (-2.5 cm , -5 cm, 0 cm)
+#
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume           Absorber 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm  40 -100 -140   Absorber 
+/vis/scene/add/scale     10 cm z 1 0 0 manual -2.5 -5 0  cm
+
+# "Flush the action of all the existing viewers.
+#   Note: You should execute these commands, e.g.,  
+#         when the current scene is modified.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+# Bird's-eye view of a detector component (Gap)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume                Gap 
+/vis/scene/add/axes  	  0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm  50 -100 -140   Gap 
+/vis/scene/add/scale      10 cm z 1 0 0 manual -2.5 -5  0 cm
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Bird's-eye view of the whole detector components (world)
+#  * The argument "world" of the command 
+#    "/vis/scene/add/volume" is omittable.
+#  * "/vis/viewer/set/culling false" makes the invisible 
+#    world volume visible.
+#    (The invisibility of the world volume is set 
+#     in ExN03DetectorConstruction.cc.)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/viewer/set/culling         global false
+/vis/drawVolume 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm 50 -100 -240   World
+/vis/scene/add/scale     10 cm x 1 0 0 
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Make the culling on for next visualization
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling       global true
Index: trunk/geant4/interfaces/visTutor/exN03Vis12.loop
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis12.loop	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis12.loop	(revision 562)
@@ -0,0 +1,4 @@
+# exN03Vis12.loop
+/vis/ogl/set/startTime {startTime} ns {timeRange} ns
+# Print eps file
+#/vis/oglx/printEPS
Index: trunk/geant4/interfaces/visTutor/exN03Vis12.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis12.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis12.mac	(revision 562)
@@ -0,0 +1,97 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis12.mac                                    #
+#                                                                     #
+#  AUTHOR(S): John Allison                                            #
+#                                                                     #
+#  DATE: 16th August 2006                                             #
+#                                                                     #
+#  CONTENTS: A basic macro for demonstrating time slicing             #
+#                                                                     #
+#  USAGE:  % $G4BINDIR/exampleN03  visTutor/exN03Vis12.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Mac/Unix with X-Windows, OpenGL    #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+/control/verbose 2
+/vis/verbose confirmations
+
+/vis/open OGLSX
+/vis/drawVolume
+/vis/scene/add/eventID
+/vis/scene/add/trajectories rich
+
+# Set up drawByCharge with time slicing
+/vis/modeling/trajectories/create/drawByCharge
+/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 5
+/vis/modeling/trajectories/drawByCharge-0/default/setDrawAuxPts true
+/vis/modeling/trajectories/drawByCharge-0/default/setAuxPtsSize 5
+/vis/modeling/trajectories/drawByCharge-0/default/setTimeSliceInterval 0.001 ns
+/vis/modeling/trajectories/list
+#/N03/det/setField 5 T
+#/N03/det/update
+/run/beamOn
+
+# Configure OpenGL for display-by-time
+/vis/ogl/set/fade 1
+/vis/ogl/set/displayHeadTime true
+/control/alias timeRange 0.1
+/vis/verbose warnings
+/control/verbose 0
+/control/loop visTutor/exN03Vis12.loop startTime -{timeRange} 0.7 0.005
+/control/verbose 2
+/vis/verbose confirmations
+/vis/ogl/set/displayHeadTime false
+
+# Set up drawByParticleID with time slicing
+/vis/modeling/trajectories/create/drawByParticleID
+/vis/modeling/trajectories/drawByParticleID-0/set e- red
+/vis/modeling/trajectories/drawByParticleID-0/set e+ blue
+/vis/modeling/trajectories/drawByParticleID-0/set pi- cyan
+/vis/modeling/trajectories/drawByParticleID-0/set pi+ magenta
+#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByParticleID-0/default/setStepPtsSize 5
+#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawAuxPts true
+/vis/modeling/trajectories/drawByParticleID-0/default/setAuxPtsSize 5
+/vis/modeling/trajectories/drawByParticleID-0/default/setTimeSliceInterval 0.001 ns
+/vis/modeling/trajectories/list
+
+# Remove gammas
+/vis/filtering/trajectories/create/particleFilter
+/vis/filtering/trajectories/particleFilter-0/add gamma
+/vis/filtering/trajectories/particleFilter-0/invert true
+
+/gun/energy 1 GeV
+/run/beamOn
+/control/alias timeRange 0.1
+/vis/ogl/set/displayHeadTime true
+/vis/ogl/set/displayLightFront true -90 0 0 mm
+/vis/verbose warnings
+/control/verbose 0
+/control/loop visTutor/exN03Vis12.loop startTime -{timeRange} 0.7 0.001
+/control/verbose 2
+/vis/verbose confirmations
+/vis/ogl/set/displayLightFront false
+/vis/ogl/set/displayHeadTime false
+
+# To see pi -> mu -> e decay.
+/gun/particle pi+
+/vis/filtering/trajectories/particleFilter-0/add anti_nu_mu
+/vis/filtering/trajectories/particleFilter-0/add nu_mu
+/vis/filtering/trajectories/particleFilter-0/add anti_nu_e
+/vis/filtering/trajectories/particleFilter-0/add nu_e
+# Accumulate several events for effect
+# /vis/scene/endOfEventAction accumulate
+/gun/energy 100 MeV
+#/vis/viewer/set/globalLineWidthScale 2
+/run/beamOn
+/control/alias timeRange 1000
+/vis/ogl/set/displayHeadTime true
+/vis/verbose warnings
+/control/verbose 0
+/control/loop visTutor/exN03Vis12.loop startTime -{timeRange} 3000 5
+/control/verbose 2
+/vis/verbose confirmations
Index: trunk/geant4/interfaces/visTutor/exN03Vis13.loop
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis13.loop	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis13.loop	(revision 562)
@@ -0,0 +1,7 @@
+# exN03Vis13.loop
+/vis/viewer/pan {dx} 0 mm
+/vis/ogl/set/endTime {endTime} ns {timeRange} ns
+# Force refresh here (since auto-refresh switched off in main mac).
+/vis/viewer/refresh
+# Print eps file
+#/vis/oglx/printEPS
Index: trunk/geant4/interfaces/visTutor/exN03Vis13.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis13.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis13.mac	(revision 562)
@@ -0,0 +1,70 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis13.mac                                    #
+#                                                                     #
+#  AUTHOR(S): John Allison                                            #
+#                                                                     #
+#  DATE: 18th August 2006                                             #
+#                                                                     #
+#  CONTENTS: Time development of an electrmagnetic shower.            #
+#                                                                     #
+#  USAGE:  % $G4BINDIR/exampleN03  visTutor/exN03Vis12.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Mac/Unix with X-Windows, OpenGL    #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+/control/verbose 2
+/vis/verbose confirmations
+
+/vis/open OGLSX 600x600-0+0
+/vis/drawVolume
+/vis/scene/add/eventID
+/vis/scene/add/trajectories rich
+
+# Set up drawByParticleID with time slicing
+/vis/modeling/trajectories/create/drawByParticleID
+/vis/modeling/trajectories/drawByParticleID-0/set e- red
+/vis/modeling/trajectories/drawByParticleID-0/set e+ blue
+/vis/modeling/trajectories/drawByParticleID-0/set pi- cyan
+/vis/modeling/trajectories/drawByParticleID-0/set pi+ magenta
+#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByParticleID-0/default/setStepPtsSize 5
+#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawAuxPts true
+/vis/modeling/trajectories/drawByParticleID-0/default/setAuxPtsSize 5
+/control/alias interval 0.01
+/control/alias halfInterval 0.005
+/vis/modeling/trajectories/drawByParticleID-0/default/setTimeSliceInterval {interval} ns
+/vis/modeling/trajectories/list
+
+# Remove gammas
+/vis/filtering/trajectories/create/particleFilter
+/vis/filtering/trajectories/particleFilter-0/add gamma
+/vis/filtering/trajectories/particleFilter-0/invert true
+
+# Create trajecgtories
+/gun/energy 10 GeV
+/vis/viewer/set/globalLineWidthScale 2
+/run/beamOn
+
+# Run time sequence
+/vis/ogl/set/fade 1
+/vis/ogl/set/displayHeadTime true
+# The trajectories can appear of jump ahead of the light front because
+# their time range overlaps the viewer's time range.  To mitigate this
+# effect of discrete time intervals, advance the light front by half the
+# trajectories interval...
+/vis/ogl/set/displayLightFront true -90 0 0 mm -{halfInterval} ns
+/vis/viewer/panTo -9 0 cm
+/vis/viewer/zoomTo 2
+/control/alias timeRange 0.1
+/control/alias dx 0.3
+# Switch off auto-refresh to avoid refresh on /vis/viewer/pan in loop.
+# (Then force refresh in loop.)
+/vis/viewer/set/autoRefresh 0
+/vis/verbose warnings
+/control/verbose 0
+/control/loop visTutor/exN03Vis13.loop endTime 0 0.7 0.001
+/control/verbose 2
+/vis/verbose confirmations
Index: trunk/geant4/interfaces/visTutor/exN03Vis2.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis2.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis2.mac	(revision 562)
@@ -0,0 +1,127 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis2.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            # 
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#        May      20, 2000                                            #
+#        November 10, 1999                                            #
+#                                                                     #
+#  CONTENTS: A basic macro for visualization of events                #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis2.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#######################################################################
+
+#################################################
+# Store particle trajactories for visualization
+#################################################
+/tracking/storeTrajectory 1
+
+#######################################################
+# Visualization with the OGLSX (OpenGL Stored X) driver
+#######################################################
+
+# Invoke the OGLSX driver 
+/vis/open OGLSX
+
+# Create an empty scene and add the detector geometry to it 
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Set viewing parameters
+#  viewpoint  : (theta,phi) = (10*deg, 10*deg).
+#  drawing style: surface
+/vis/viewer/reset
+/vis/viewer/set/style surface
+/vis/viewer/set/viewpointThetaPhi   10  10
+
+# Generate one event and visualize it.
+/run/beamOn  1
+
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Create an empty scene and add the detector geometry to it 
+/vis/drawVolume 
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Set the trajectory-accumulation mode to "accumulate".
+#  Trajectories of each event are accumulated
+#  and visualized at the end of one run.
+/vis/scene/endOfEventAction    accumulate
+
+# Visualize many events (bird's eye view)
+#  viewpoint  : (theta,phi) = (45*deg, 45*deg) 
+#  zoom factor: 1.5 x (full screen size)
+#  drawing style: wireframe
+/vis/viewer/reset
+/vis/viewer/set/style  wireframe
+/vis/viewer/set/viewpointThetaPhi   45 45
+/vis/viewer/zoom        1.5
+/run/beamOn             50
+
+# Visualize many events (zoomed-up view)
+#  viewpoint  : (theta,phi) = (90*deg, 0) 
+#  zoom factor: 5 x (full screen size)
+/vis/viewer/reset
+/vis/viewer/set/style  wireframe
+/vis/viewer/set/viewpointThetaPhi   90 0
+/vis/viewer/zoom        5
+/run/beamOn             50
+
+# Reset trajectory-accumulation mode to "refresh" (default)
+#  Trajectories are visualized at the end of each event.
+/vis/scene/endOfEventAction       refresh
Index: trunk/geant4/interfaces/visTutor/exN03Vis3.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis3.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis3.mac	(revision 562)
@@ -0,0 +1,136 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis3.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#        May      20, 2000                                            # 
+#        November 10, 1999                                            #
+#                                                                     #
+#  CONTENTS: A basic macro for demonstrating various drawing styles   #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis3.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/local)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#######################################################################
+
+##############################################
+# Store particle trajactories for visualization
+##############################################
+/tracking/storeTrajectory 1
+
+###########################################################
+# Visualization with the OGLIX (OpenGL Immediate X) driver
+###########################################################
+
+# Invoke the OGLSX driver 
+/vis/open OGLSX
+
+# Create an empty scene and add the detector geometry to it 
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Bird-eye view of events with 
+#  the hidden-surface drawing style
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi  45 45 
+/vis/viewer/set/style          surface
+/run/beamOn                    10
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+#
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Create an empty scene and add the detector geometry to it 
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Bird-eye view of events with the 
+#  wireframe drawing style
+/vis/viewer/reset 
+/vis/viewer/zoom               1.5
+/vis/viewer/set/viewpointThetaPhi  45 45 
+/vis/viewer/set/style          wireframe
+/run/beamOn                    3
+
+# Set the trajectory-accumulation mode to "accumulate".
+#  Trajectories of each event are accumulated
+#  and visualized at the end of one run.
+/vis/scene/endOfEventAction    accumulate
+
+# Bird-eye view of events with the 
+#  hidden-surface drawing style
+/vis/viewer/set/style          surface
+/run/beamOn                    50
+
+# Cull detector geometry and show only trajectories.
+/vis/viewer/reset 
+/vis/viewer/set/culling     global  true
+/vis/viewer/set/culling     density true 999
+/vis/viewer/set/style       wireframe
+/run/beamOn                 10
+
+# Reset the culling policy for next visualization
+#  The default culling policy is:
+#   global          : on
+#   invisible       : on 
+#   low density     : off 
+#   covered daughter: off
+#
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling  density false
+
+# Reset trajectory-accumulation mode to "refresh" (default)
+#  Trajectories are visualized at the end of each event.
+/vis/scene/endOfEventAction       refresh
Index: trunk/geant4/interfaces/visTutor/exN03Vis4.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis4.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis4.mac	(revision 562)
@@ -0,0 +1,105 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis4.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            # 
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#                                                                     #
+#  CONTENTS: An example for the compound command,                     #
+#            "/vis/specify  <logical_volume_name>"                    #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis4.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window,                    #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     # 
+#    The compound command "/vis/specify <logical-volume-name>"        #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #  
+#      /vis/scene/add/logicalVolume $1                                #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+##########################################################
+# Visualization with the OGLIX driver
+##########################################################
+
+# Invoke the OGLIX driver 
+/vis/open OGLIX
+
+# Set camera 
+/vis/viewer/reset
+/vis/viewer/zoom       0.9 
+/vis/viewer/set/viewpointThetaPhi  35 35
+
+# Visualize a selected logical volume
+/vis/specify           Absorber 
+/vis/viewer/flush
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Set camera 
+/vis/viewer/reset
+/vis/viewer/zoom       0.9 
+/vis/viewer/set/viewpointThetaPhi  35 35
+
+# Visualize a selected logical volume (1)
+/vis/specify                  Absorber 
+/vis/scene/add/axes    0 0 0 500 mm
+/vis/scene/add/text    0 0 0 mm  40 -100 -200   LogVol:Absorber 
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+# Visualize a selected logical volume (2)
+/vis/specify  Gap
+/vis/scene/add/axes    0 0 0 500 mm
+/vis/scene/add/text    0 0 0 mm  40 -100 -200   LogVol:Gap
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
Index: trunk/geant4/interfaces/visTutor/exN03Vis5.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis5.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis5.mac	(revision 562)
@@ -0,0 +1,70 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis5.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Guy Barrand                                             #
+#                                                                     #
+#  DATE: June 09, 2000                                                #
+#                                                                     #
+#  CONTENTS: A basic macro for demonstrating Inventor driver          #
+#                                                                     #
+#  USAGE:  % $G4BINDIR/exampleN03  visTutor/exN03Vis6.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, Motif, X-window, OpenGL,     #
+#                                  HEPVis                             #
+#                                  Inventor (TGS or SoFree)           #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_BUILD_OIX_DRIVER       1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OIX                1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+# Create "scene-0" 
+/vis/scene/create
+
+# Invoke the OpenInventor driver 
+/vis/sceneHandler/create OIX
+/vis/viewer/create
+
+# Add the world volume to the current scene
+/vis/scene/add/volume
+#/vis/scene/add/volume Layer
+# Name of the absorbers = name of their material (Lead) !
+#/vis/scene/add/volume Lead
+# Name of the gaps = name of their material (liquidArgon) !
+#/vis/scene/add/volume liquidArgon
+#/vis/scene/add/trajectories
+/tracking/storeTrajectory 1
+
+# Bird-eye view of events
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi   45 45 
+
+/vis/scene/notifyHandlers
+
+/control/verbose 2
+#######################################################################
+#   Controls on an Inventor examiner viewer are :                     #
+#  - in picking mode (cursor is the upper left arrow)                 #
+#   Ctrl + pick a volume : see daughters.                             #
+#   Shift + pick a volume : see mother.                               #
+#  - in viewing mode (cursor is the hand)                             #
+#   Left-button + pointer move : rotate.                              #
+#   Ctrl+Left-button + pointer move : pane.                           #
+#   Ctrl+Shift+Left-button + pointer move : scale.                    #
+#   Middle-button + pointer move : pane.                              #
+#                                                                     #
+#######################################################################
+
+/vis/viewer/update
+
+/run/beamOn 1
+
Index: trunk/geant4/interfaces/visTutor/exN03Vis6.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis6.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis6.mac	(revision 562)
@@ -0,0 +1,68 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis6.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            #  
+#                                                                     #
+#  CONTENTS: A macro to demonstrate the VRMLFILE driver               #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis7.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window,                    #
+#                                  VRML viewer (e.g. VRMLview)        #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  RECOMMENDED ENVIRONMENTAL VARIABLES FOR VISUALIZATION:             #
+#                                                                     #
+#    % setenv G4VRMLFILE_VIEWER        vrmlview                       #
+#     ( The default value is "NONE".)                                 #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#   The VRML-file viewer "vrmlview" is obtainable from the following  #
+#   Web site:                                                         #
+#      http://www.sim.no/downloads.html                               #
+#                                                                     #
+#######################################################################
+
+###################################################
+# Visualization of detector geometry and events  
+# with the VRML2FILE driver.
+###################################################
+
+# Store particle trajactories for visualization
+/tracking/storeTrajectory 1
+
+# Invoke the VRML2FILE driver
+#  Note: The VRML1FILE driver generates VRML 1.0 format files.
+#        The VRML2FILE driver generates VRML 2.0 format files.
+/vis/open VRML2FILE
+
+# Create an empty scene and add the detector geometry to it
+/vis/drawVolume
+
+# Visualize 3 events in the wireframe mode 
+#  Note: The command /vis/scene/add/trajectories
+#        is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is  
+#        described in the event action.
+#  Note: "/vis/viewer/set/style wireframe" means  
+#       "half-transparent" in the VRML2FILE driver.  
+#       It is a convention only for this driver.
+#/vis/scene/add/trajectories
+/vis/viewer/set/style wireframe
+/run/beamOn 3
Index: trunk/geant4/interfaces/visTutor/exN03Vis7.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis7.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis7.mac	(revision 562)
@@ -0,0 +1,61 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis7.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      14, 2001                                            #
+#                                                                     #
+#  CONTENTS: A macro to demonstrate batch visualization to generate   #
+#            PostScript file with the DAWNFILE driver                 #
+#                                                                     #
+#          % setenv DAWN_BATCH               1                        #
+#          % make visclean                                            #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis8.mac              #
+#          Idle> exit                                                 #
+#          % gv g4_00.eps &                                           #
+#          % gv g4_01.eps &                                           #
+#          % gv g4_02.eps &                                           #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window,                    #
+#                                  DAWN (version 3.85 or after)       #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+####################################################################
+# Creation of a multi-page PostScript file with the DAWNFILE driver
+####################################################################
+
+# Invoke the DAWNFILE driver
+/vis/open DAWNFILE
+
+# Add the world volume to the current scene
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Set camera 
+/vis/viewer/reset 
+/vis/viewer/zoom              1.5
+/vis/viewer/set/viewpointThetaPhi 70 20
+
+# Visualize events added to the current scene
+/tracking/storeTrajectory 1
+/run/beamOn 3
Index: trunk/geant4/interfaces/visTutor/exN03Vis8.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis8.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis8.mac	(revision 562)
@@ -0,0 +1,87 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis8.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      14, 2001 (renamed from exN03Vis8.mac)               #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#                                                                     #
+#  CONTENTS: A macro to demonstrate creation of a "multi-page"        #
+#            PostScript file                                          #
+#                                                                     #
+#  USAGE:  % setenv G4DAWNFILE_MAX_FILE_NUM  1                        #
+#          % setenv DAWN_BATCH               a                        #
+#          % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis9.mac              #
+#          Idle> exit                                                 #
+#          % gv g4_00.eps                                             #
+#                                                                     #
+#          Then click, "<<", ">>" etc to traverse pages               #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window,                    #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    * If you execute this macro plural times, all the views are      #
+#      sequentially appended to the file "g4_00.eps".                 #
+#      For example if you execute it two times, a 6-page (3+3 page)   #
+#      PostScript file is made.                                       #
+#      Unset environmental variables to initialize your environment:  #
+#                                                                     # 
+#       % unsetenv G4DAWNFILE_MAX_FILE_NUM                            #
+#       % unsetenv DAWN_BATCH                                         # 
+#                                                                     # 
+#######################################################################
+
+####################################################################
+# Creation of a multi-page PostScript file with the DAWNFILE driver
+####################################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Set viewing parameters
+/vis/viewer/reset
+/vis/viewer/zoom               0.9 
+/vis/viewer/set/viewpointThetaPhi  35 35
+
+# Generate page 1: Absorber
+/vis/drawVolume           Absorber 
+/vis/scene/add/axes       0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm  30 -150 -200   Page1/3:Absorber 
+/vis/viewer/flush
+
+# Generate page 2: Gap
+/vis/drawVolume           Gap
+/vis/scene/add/axes       0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm 30 -100 -200   Page2/3:Gap
+/vis/viewer/flush
+
+# Generate page 3: World
+/vis/viewer/set/culling   global  false
+/vis/drawVolume           
+/vis/scene/add/axes       0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm 50 -100 -200   Page3/3:world
+/vis/viewer/flush
+
+# Make the culling on for next visualization
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling   global  true
Index: trunk/geant4/interfaces/visTutor/exN03Vis9.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/exN03Vis9.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/exN03Vis9.mac	(revision 562)
@@ -0,0 +1,65 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis9.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Guy Barrand
+#                                                                     #
+#  DATE:                                                              #
+#        Appril   08, 2004                                            #
+#                                                                     #
+#  CONTENTS: A simplest macro to demonstrate visualization of         #
+#            detector geometry and events                             #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis9.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Windows, OpenGL                    #
+#  OPTIONAL :                      DAWN (version 3.85 or after)       #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    G4VIS_BUILD_OPENGLWIN32_DRIVER                                   # 
+#   (G4UI_BUILD_WIN32_SESSION)                                        # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    G4VIS_USE_OPENGLWIN32                                            # 
+#   (G4UI_USE_WIN32)                                                  # 
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+##############################################
+# Visualization of detector geometry and trajectories
+#  with the OGLIWin32 (OpenGL Immediate Windows) driver
+##############################################
+
+# Invoke the OGLIWin32 driver
+/vis/open OGLIWin32
+
+# Set camera 
+/vis/viewer/reset 
+/vis/viewer/set/viewpointThetaPhi 70 20
+
+# Create an empty scene and add the detector geometry to it
+/vis/drawVolume
+
+# Visualize events added to the current scene
+/tracking/storeTrajectory 1
+/run/beamOn 1
+
Index: trunk/geant4/interfaces/visTutor/g4Xt.xrm
===================================================================
--- trunk/geant4/interfaces/visTutor/g4Xt.xrm	(revision 562)
+++ trunk/geant4/interfaces/visTutor/g4Xt.xrm	(revision 562)
@@ -0,0 +1,359 @@
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!! 
+!!!!  A X11 resource file to customize G4UI sessions and 
+!!!! visualization viewers based over Xt. You use it by
+!!!! setting the XENVIRONMENT environment variable to point
+!!!! to this file, for example :
+!!!!    csh> setenv XENVIRONMENT g4Xt.xrm
+!!!!     sh> XENVIRONMENT=g4Xt.xrm;export XENVIRONMENT
+!!!! 
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*topShadowColor    :white
+*bottomShadowColor :black
+*foreground        :black
+*background        :lightgrey
+*borderColor       :lightgrey
+*fontList          :-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!! G4UIXm
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*text.background   :white
+*text.fontList     :*courier*-r-*--14-*
+*text.maxLength    :8000
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! OpenInventor resources, copied from file :
+!  OpenInventor2.4.1/app-defaults/Inventor
+!
+!#################################################
+!       RESSOURCE FILE FOR OPEN INVENTOR         !
+!#################################################
+!
+! You must put this file in
+! /usr/lib/X11/app-defaults
+! or set up XAPPLRESDIR (see X window documentation)
+!
+!#################################################
+!!################################################
+!!                 POPUP MENU
+!!------------------------------------------------
+!!               FUNCTIONS MENU
+!!------------------------------------------------
+*IvMenu.IvFunctions1.labelString: Functions
+*IvFunctions2.IvHelp.labelString: Help
+*IvFunctions2.IvHome.labelString: Home
+*IvFunctions2.IvSetHome.labelString: Set Home
+*IvFunctions2.IvViewAll.labelString: View All
+*IvFunctions2.IvSeek.labelString: Seek
+*IvFunctions2.IvCopyView.labelString: Copy View
+*IvFunctions2.IvPasteView.labelString: Paste View
+!!------------------------------------------------
+!!               DRAW STYLE MENU
+!!------------------------------------------------
+*IvMenu.IvDrawStyle1.labelString: Draw Style
+*IvDrawStyle2.IvAsIs.labelString: as is
+*IvDrawStyle2.IvHiddenLine.labelString: hidden line
+*IvDrawStyle2.IvNoTexture.labelString: no texture
+*IvDrawStyle2.IvLowResolution.labelString: low resolution
+*IvDrawStyle2.IvWireFrame.labelString: wireframe
+*IvDrawStyle2.IvPoints.labelString: points
+*IvDrawStyle2.IvBoundingBoxNoDepth.labelString: bounding box ( no depth )
+*IvDrawStyle2.IvMoveSameAsStill.labelString: move same as still
+*IvDrawStyle2.IvMoveNoTexture.labelString:  move no texture.
+*IvDrawStyle2.IvMoveLowRes.labelString: move low res
+*IvDrawStyle2.IvMoveWireFrame.labelString: move wireframe
+*IvDrawStyle2.IvMoveLowResWireFrameNoDepth.labelString: move low res wire frame ( no depth )
+*IvDrawStyle2.IvMovePoints.labelString: move points
+*IvDrawStyle2.IvMoveLowResPointsNoDepth.labelString: move low res points ( no depth )
+*IvDrawStyle2.IvMoveBoundingBoxNoDepth.labelString: move bounding box ( no depth )
+*IvDrawStyle2.IvSingleBuffer.labelString: single buffer
+*IvDrawStyle2.IvDoubleBuffer.labelString: Double buffer
+*IvDrawStyle2.IvInteractiveBuffer.labelString: interactive buffer
+!!------------------------------------------------
+*IvMenu.IvViewing.labelString: Viewing
+!!------------------------------------------------
+*IvMenu.IvDecoration.labelString: Decoration
+!!------------------------------------------------
+*IvMenu.IvHeadlight.labelString: Headlight
+!!------------------------------------------------
+*IvMenu.IvPreferences.labelString: Preferences ...
+
+!!------------------------------------------------
+!!                 PREFERENCES
+!!------------------------------------------------
+*IvFormPreference1.IvSeekAnimationTime.labelString: Seek animation time
+*IvFormPreference1.IvSeconds.labelString: seconds
+*IvFormPreference1.IvSeekTo.labelString: Seek to:
+*IvFormPreference1.IvPoint.labelString: point
+*IvFormPreference1.IvObject.labelString: object
+*IvFormPreference2.IvSeekDistance.labelString: Seek distance:
+*IvFormPreference2.IvPercentage.labelString: percentage
+*IvFormPreference2.IvAbsolute.labelString: absolute
+*IvZoomForm.IvCameraZoom.labelString: Camera zoom
+*IvZoomForm.IvZoomSliderRangesFrom.labelString: Zoom slider ranges from:
+*IvZoomForm.IvTo.labelString: to:
+*IvZoomForm.IvZoomSlider.labelString: Zoom slider
+*IvZoomForm.IvZoomField.labelString: Zoom field
+*IvZoomForm.IvZoomFrom.labelString: Zoom from
+*IvZoomForm.IvZoomTo.labelString: Zoom to
+*IvFormPreference3.IvAutoClippingPlanes.labelString: Auto clipping planes 
+*IvFormPreference4.IvStereoViewing.labelString: Stereo Viewing
+*IvFormPreference6.IvNearPlane.labelString: near plane
+*IvFormPreference6.IvFarPlane.labelString: far plane
+*IvStereoThumbForm.IvCameraRotation.labelString: Camera rotation
+
+!!------------------------------------------------
+!! Preferences for Examiner Viewer
+!!------------------------------------------------
+*IvFormExaminer1.IvEnableSpinAnimation.labelString: Enable spin animation
+*IvFormExaminer1.IvShowPointOfRotationAxes.labelString: Show point of rotation axes
+*IvFormExaminer1.IvAxesSize.labelString: axes size
+*IvFormExaminer1.IvPixels.labelString: pixels
+!!------------------------------------------------
+!! Decorations for Examiner Viewer !!
+!!------------------------------------------------
+*IvExamTitle.labelString: Examiner Viewer
+*IvExamPrefTitle.labelString: Examiner Viewer Preference Sheet
+*IvExamPopupTitle.labelString: Examiner Viewer
+*IvExamIconTitle.labelString: Examiner Viewer
+*IvExamRotx.labelString: Rotx
+*IvExamRoty.labelString: Roty
+*IvExamZoom.labelString: Zoom
+*IvExamDolly.labelString: Dolly
+!!------------------------------------------------
+!! Decorations for Plane Viewer !!
+!!------------------------------------------------
+*IvPlaneTitle.labelString: Plane Viewer
+*IvPlanePrefTitle.labelString: Plane Viewer Preference Sheet
+*IvPlanePopupTitle.labelString: Plane Viewer
+*IvPlaneIconTitle.labelString: Plane Viewer
+*IvPlaneTransx.labelString: transX
+*IvPlaneTransy.labelString: transY
+*IvPlaneZoom.labelString: Zoom
+*IvPlaneDolly.labelString: Dolly
+!!------------------------------------------------
+!! Decorations for Fly Viewer !!
+!!------------------------------------------------
+*IvFlyTitle.labelString: Fly Viewer
+*IvFlyPrefTitle.labelString: Fly Viewer Preference Sheet
+*IvFlyPopupTitle.labelString: Fly Viewer
+*IvFlyIconTitle.labelString: Fly Viewer
+!! Same for Walk Viewer !!
+*IvFlyWalkRotate.labelString: Rotate
+!! Same for Walk Viewer !!
+*IvFlyWalkTilt.labelString: Tilt
+!! Same for Walk Viewer !!
+*IvFlyWalkDolly.labelString: Dolly
+!!------------------------------------------------
+!! Preferences for Fly Viewer !!
+!!------------------------------------------------
+*FlyPreference.FlyingSpeed.labelString: Flying speed:
+*FlyPreference.Increase.labelString: increase
+*FlyPreference.Decrease.labelString: decrease 
+!!------------------------------------------------
+!! Decorations for Walk Viewer !!
+!!------------------------------------------------
+*IvWalkTitle.labelString: Walk Viewer
+*IvWalkPrefTitle.labelString: Walk Viewer Preference Sheet
+*IvWalkPopupTitle.labelString: Walk Viewer
+*IvWalkIconTitle.labelString: Walk Viewer
+*IvLeftTrimForm.IvH.labelString: H
+!!------------------------------------------------
+!! Preferences for Walk Viewer !!
+!!------------------------------------------------
+*IvFormPreference5.IvViewerSpeed.labelString: Viewer speed
+*IvFormPreference5.IvIncrease.labelString: increase
+*IvFormPreference5.IvDecrease.labelString: decrease
+!!------------------------------------------------
+!!              EDITORS
+!!------------------------------------------------
+!! Drectional Light Editor !!
+!!------------------------------------------------      
+*IvDirectLightTitle.labelString: Dir Light Editor
+*IvDirectLightIconTitle.labelString: Dir Light Ed
+*IvDirectLightInten.labelString: Inten
+*IvDirectLightColorEditor.labelString: Directional Light Color
+*IvDLMenuBar.IvEdit.labelString: Edit
+*IvDLMenuBar*IvControlPullDown*IvColorEditor.labelString: Color Editor
+*IvDLMenuBar*IvControlPullDown*IvCopy.labelString: Copy
+*IvDLMenuBar*IvControlPullDown*IvPaste.labelString: Paste
+*IvDLMenuBar*IvControlPullDown*IvHelp.labelString: Help
+!!------------------------------------------------
+!! Color Editor !!
+!!------------------------------------------------
+*IvColorEditorTitle.labelString: Color Editor
+*IvColorEditorIconTitle.labelString: Color Editor
+*IvColorEditorR.labelString: R
+*IvColorEditorG.labelString: G
+*IvColorEditorB.labelString: B
+*IvColorEditorH.labelString: H
+*IvColorEditorS.labelString: S
+*IvColorEditorV.labelString: V
+*IvColorEditorRight.labelString: Right
+*IvColorEditorSwitch.labelString: Switch
+*IvColorEditorCont.labelString: Continuous
+*IvColorEditorManu.labelString: Manual
+*IvColorEditorWysi.labelString: WYSIWYG
+*IvColorEditorCopy.labelString: Copy
+*IvColorEditorPaste.labelString: Paste
+*IvColorEditorHelp.labelString: Help
+*IvColorEditorNone.labelString: None
+*IvColorEditorValue.labelString: Value
+*IvColorEditorRGB.labelString: RGB
+*IvColorEditorHSV.labelString: HSV
+*IvColorEditorRGBV.labelString: RGB V
+*IvColorEditorRGBHSV.labelString: RGB HSV
+
+*IvCEMenuBar.IvEdit.labelString: Edit
+*IvCEMenuBar.IvSliders.labelString: Sliders
+*IvButtonsForm.IvAccept.labelString: Accept
+!!------------------------------------------------
+!! Material Editor !!
+!!------------------------------------------------
+*IvMaterialEditorTitle.labelString: Material Editor
+*IvMaterialEditorIconTitle.labelString: Mat Editor
+*IvMaterialAmbientTitle.labelString: Material Ambient Color
+*IvMaterialDiffuseTitle.labelString: Material Diffuse Color
+*IvMaterialSpecularTitle.labelString: Material Specular Color
+*IvMaterialEmissiveTitle.labelString: -Material Emissive Color
+*IvMaterialEditorMaterial.labelString: Material / 
+*IvMaterialEditorAmb.labelString: Amb / 
+*IvMaterialEditorDiff.labelString: Diff /  
+*IvMaterialEditorSpec.labelString: Spec / 
+*IvMaterialEditorEmis.labelString: Emis / 
+*IvMaterialEditorColor.labelString: Color
+*IvMEMenuBar.IvEdit.labelString: Edit
+*IvMEMenuBar*IvEditPullDown.IvMaterialList.labelString: Material List
+*IvMEMenuBar*IvEditPullDown.IvContinuous.labelString: Continuous
+*IvMEMenuBar*IvEditPullDown.IvManual.labelString: Manual
+*IvMEMenuBar*IvEditPullDown.IvCopy.labelString: Copy
+*IvMEMenuBar*IvEditPullDown.IvPaste.labelString: Paste
+*IvMEMenuBar*IvEditPullDown.IvHelp.labelString: Help
+*IvControls.IvEditColor.labelString: Edit Color
+*IvsliderForm.IvtextForm.IvAmb.labelString: Amb:
+*IvsliderForm.IvtextForm.IvDiff.labelString: Diff
+*IvsliderForm.IvtextForm.IvSpec.labelString: Spec
+*IvsliderForm.IvtextForm.IvEmis.labelString: Emis
+*IvsliderForm.IvtextForm.IvShininess.labelString: Shininess
+*IvsliderForm.IvtextForm.IvTransp.labelString: Transp:
+*IvMETop.IvAccept.labelString: Accept
+!!------------------------------------------------
+!! Material List !!
+!!------------------------------------------------
+*IvMaterialListTitle.labelString: Material List
+*IvMaterialListeIconTitle.labelString: Mat List
+*IvMLMenuBar*IvPalettes.labelString: Palettes
+!!------------------------------------------------
+!! Print Dialog
+!!------------------------------------------------
+*IvPrintDialTitle.labelString: Print Dialog 
+*IvPrintDialIconTitle.labelString: -rint Dialog
+*IvPrintDialPrinter.labelString: Printer:
+*IvPrintDialPageOut.labelString: Page Output:
+*IvPrintDialToPrinter.labelString: To Printer
+*IvPrintDialToFile.labelString: To File
+*IvPrintDialQuit.labelString: Quit
+*IvPrintDialPrint.labelString: Print
+*IvPrintDialMessage.labelString: Message:
+*IvPrintDialFileFormat.labelString: File Format:
+*IvPrintDialPostScript.labelString: PostScript
+*IvPrintDialRGB.labelString: RGB
+*IvPrintDialPrintQuality.labelString: Print Quality:
+*IvPrintDialHigh.labelString: High
+*IvPrintDialDraft.labelString: Draft
+*IvPrintDialPageFormat.labelString: Page Format
+*IvPrintDialPortrait.labelString: Portrait
+*IvPrintDialLandscape.labelString: Landscape
+*IvPrintDialPrintSize.labelString: Print Size (inches):
+*IvPrintDialFileName.labelString: File Name:
+*IvPrintDialResolution.labelString: Resolution
+*IvPrintDialBy.labelString: by
+*IvPrintDialDpi.labelString: DPI:
+*IvPrintDialMess1.labelString: Printing in progress...
+*IvPrintDialMess2.labelString: ERROR:  Empty database.
+*IvPrintDialMess3.labelString: ERROR:  Exceeds 
+*IvPrintDialMess4.labelString: ERROR:  Could not execute print.
+*IvPrintDialMess5.labelString: ERROR:  Could not execute print.
+*IvPrintDialMess6.labelString: ERROR:  No printer.
+*IvPrintDialMess7.labelString: ERROR:  Couldn't open 
+*IvPrintDialMess8.labelString: ERROR:  No file name.
+*IvPrintDialMess9.labelString: ERROR:   Could not open file.
+*IvPrintDialMess10.labelString: ERROR:  Could not get data.
+*IvPrintDialMess11.labelString: ERROR:  Could not get data.
+*IvPrintDialMess12.labelString: Printing completed.
+
+!!------------------------------------------------
+!! Xt Component ( For Light and Material Sliders Set )
+!!------------------------------------------------
+*IvXtComponentTitle.labelString: Xt Component
+*IvTGSXtComponentTitle.labelString: TGS: Xt Component
+!!------------------------------------------------
+!! For All Sliders
+!!------------------------------------------------
+*IvSlidersMin.labelString: min
+*IvSlidersMax.labelString: max
+*IvSlidersStyle.labelString: style
+!!------------------------------------------------
+!! Light Slider Set 
+!!------------------------------------------------
+*IvLightSliderColor.labelString: COLOR
+*IvLightSliderRed.labelString: Red
+*IvLightSliderGreen.labelString: Green
+*IvLightSliderBlue.labelString: Blue
+*IvLightSliderIntensity1.labelString: INTENSITY
+*IvLightSliderIntensity2.labelString: Intensity
+!!------------------------------------------------
+!! Material Slider Set
+!!------------------------------------------------
+*IvMaterialSliderAmbient.labelString: AMBIENT
+*IvMaterialSliderAmbientRed.labelString: Ambient Red
+*IvMaterialSliderAmbientGreen.labelString: Ambient Green
+*IvMaterialSliderAmbientBleu.labelString: Ambient Blue
+*IvMaterialSliderDiffuse.labelString: DIFFUSE
+*IvMaterialSliderDiffuseRed.labelString: Diffuse Red
+*IvMaterialSliderDiffuseGreen.labelString:  Diffuse Green
+*IvMaterialSliderDiffuseBleu.labelString: Diffuse Blue
+*IvMaterialSliderSpecular.labelString: SPECULAR
+*IvMaterialSliderSpecularRed.labelString: Specular Red
+*IvMaterialSliderSpecularGreen.labelString: Specular Green
+*IvMaterialSliderSpecularBleu.labelString: Specular Blue
+*IvMaterialSliderEmissive.labelString: EMISSIVE
+*IvMaterialSliderEmissiveRed.labelString: Emissive Red
+*IvMaterialSliderEmissiveGreen.labelString: Emissive Green
+*IvMaterialSliderEmissiveBlue.labelString: Emissive Blue
+*IvMaterialSliderShininess.labelString: SHININESS
+*IvMaterialSliderShininessShininess.labelString: shininess 
+*IvMaterialSliderTransparency.labelString: TRANSPARENCY
+*IvMaterialSliderTransparencyTransparency.labelString: transparency
+!!------------------------------------------------
+!! Transform Slider Set
+!!------------------------------------------------
+*IvTransformSliderTrans.labelString: TRANSLATIONS
+*IvTransformSliderTransX.labelString: X Translation
+*IvTransformSliderTransY.labelString: Y Translation
+*IvTransformSliderTransZ.labelString: Z Translation
+*IvTransformSliderScale.labelString: SCALES
+*IvTransformSliderScaleX.labelString: X Scale
+*IvTransformSliderScaleY.labelString: Y Scale
+*IvTransformSliderScaleZ.labelString: Z Scale
+*IvTransformSliderRotate.labelString: ROTATIONS
+*IvTransformSliderRotateX.labelString: X Rotate
+*IvTransformSliderRotateY.labelString: Y Rotate
+*IvTransformSliderRotateZ.labelString: Z Rotate
+*IvTransformSliderScaleOrient.labelString: SCALE ORIENTATION
+*IvTransformSliderScaleOrientX.labelString: X Rotate
+*IvTransformSliderScaleOrientY.labelString: Y Rotate
+*IvTransformSliderScaleOrientZ.labelString: Z Rotate
+*IvTransformSliderCenter.labelString: CENTER
+*IvTransformSliderCenterX.labelString: X Center
+*IvTransformSliderCenterY.labelString: Y Center
+*IvTransformSliderCenterZ.labelString: Z Center
+*IvTransformSliderTitle.labelString: Transform Editor
+*IvTransformSliderIconTitle.labelString: Xf Editor
+
+
+!!------------------- THE END --------------------
Index: trunk/geant4/interfaces/visTutor/gui.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/gui.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/gui.mac	(revision 562)
@@ -0,0 +1,51 @@
+#
+#  This file permits to customize, with commands,
+# the menu bar of the G4UIXm, G4UIWin32 sessions.
+# It has no effect with G4UIterminal.
+#
+# File :
+/gui/addMenu file File
+/gui/addButton file Continue continue
+/gui/addButton file Exit "exit"
+#
+# Run menu :
+/gui/addMenu run Run
+/gui/addButton run "beamOn 1" "/run/beamOn 1"
+/gui/addButton run run1 "/control/execute run1.mac"
+/gui/addButton run run2 "/control/execute run2.mac"
+#
+# Gun menu :
+/gui/addMenu gun Gun
+/gui/addButton gun "50 MeV"  "/gun/energy 50 MeV"
+/gui/addButton gun "1 GeV"   "/gun/energy 1 GeV"
+/gui/addButton gun "10 GeV"  "/gun/energy 10 GeV"
+/gui/addButton gun "e-"      "/gun/particle e-"
+/gui/addButton gun "pi0"     "/gun/particle pi0"
+/gui/addButton gun "pi+"     "/gun/particle pi+"
+/gui/addButton gun "neutron" "/gun/particle neutron"
+/gui/addButton gun "proton"  "/gun/particle proton"
+#
+# Vis menu :
+/gui/addMenu vis Vis
+/gui/addButton vis Vis0(OGLIX) "/control/execute visTutor/exN03Vis0.mac"
+/gui/addButton vis Vis1(OGLSX) "/control/execute visTutor/exN03Vis1.mac"
+/gui/addButton vis Vis2(OGLSX) "/control/execute visTutor/exN03Vis2.mac"
+/gui/addButton vis Vis3(OGLSX) "/control/execute visTutor/exN03Vis3.mac"
+/gui/addButton vis Vis4(OGLIX) "/control/execute visTutor/exN03Vis4.mac"
+/gui/addButton vis Vis5(OIX)   "/control/execute visTutor/exN03Vis5.mac"
+/gui/addButton vis Vis6(VRML2FILE) "/control/execute visTutor/exN03Vis6.mac"
+/gui/addButton vis Vis7(DAWNFILE) "/control/execute visTutor/exN03Vis7.mac"
+/gui/addButton vis Vis8(DAWNFILE) "/control/execute visTutor/exN03Vis8.mac"
+/gui/addButton vis Vis9(OGLIWIN) "/control/execute visTutor/exN03Vis9.mac"
+/gui/addButton vis Vis10(OIWin32) "/control/execute visTutor/exN03Vis10.mac"
+/gui/addButton vis Vis11(OGLSXm) "/control/execute visTutor/exN03Vis11.mac"
+#
+# Viewer menu :
+/gui/addMenu viewer Viewer
+/gui/addButton viewer "Set style solid" "/vis/viewer/set/style solid"
+/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wire"
+#/gui/addButton viewer viewer_update "/vis/viewer/update"
+/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
+#
+# To limit the output flow in the "dump" widget :
+/N03/event/printModulo 100
Index: trunk/geant4/interfaces/visTutor/heprep.mac
===================================================================
--- trunk/geant4/interfaces/visTutor/heprep.mac	(revision 562)
+++ trunk/geant4/interfaces/visTutor/heprep.mac	(revision 562)
@@ -0,0 +1,43 @@
+# $Id: heprep.mac,v 1.2 2003/12/01 21:09:28 perl Exp $
+#
+# Macro file for "exampleN03.cc"
+#
+# can be run in batch, without graphic
+# or interactively: Idle> /control/execute heprep.mac
+#
+# Produces heprep2 file(s)
+#
+/control/verbose 0
+/control/saveHistory
+#
+/run/verbose 0
+/event/verbose 0
+/tracking/verbose 0
+#
+# muon 300 MeV to the direction (1.,0.,0.)
+# 3 events
+#
+# Create a scene containing the detector.
+/vis/scene/create
+/vis/scene/add/volume world
+#
+# Open a HepRep version 2 file suitable for viewing in WIRED.
+/vis/open HepRepXML
+#
+# Output an empty detector
+/vis/viewer/flush
+#
+# Include trajectories in the image.
+/tracking/storeTrajectory 1
+/vis/scene/add/trajectories
+#
+# If multiple events in one run, accumulate all events into a single
+# graphical image.  If this line is commented out, each event will instead
+# appear in a separate image.
+/vis/scene/endOfEventAction accumulate
+#
+# At end of each run, an automatic flush causes graphical output.
+# This run will make an image with one event.
+/run/beamOn 1
+# This run will make an image with ten events.
+/run/beamOn 10
Index: trunk/geant4/specific-geant4.8.3.sh
===================================================================
--- trunk/geant4/specific-geant4.8.3.sh	(revision 562)
+++ trunk/geant4/specific-geant4.8.3.sh	(revision 562)
@@ -0,0 +1,83 @@
+  set prompt='mac-g4> ' 
+  #//////////////////////////////////////////////////////////
+  # Core :
+  #//////////////////////////////////////////////////////////
+  export MACOSX_DEPLOYMENT_TARGET=10.4
+  export MAKECMD=make
+  export G4INSTALL=/usr/local/geant4.8.3 /src/geant4
+  export G4SYSTEM=Darwin-g++
+  export G4WORKDIR=$G4INSTALL
+  export G4STTDIR=$G4WORKDIR/stt
+  export G4LIB=$G4INSTALL/../../lib/geant4/
+  export G4DEBUG=1
+  export CPPVERBOSE=1
+  export G4LIB_USE_GRANULAR=1
+#  unset G4LIB_USE_GRANULAR
+  # Shareable library
+  export G4LIB_BUILD_SHARED=1
+  #FIXME export G4LIB_BUILD_SHARED 1
+  export DYLD_LIBRARY_PATH=$G4LIB/$G4SYSTEM
+  export CLHEP_BASE_DIR=/sw/
+  export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
+  # data :
+  export G4DATA=/geant4/data
+  export NeutronHPCrossSections=$G4DATA/G4NDL3.5
+  export G4LEVELGAMMADATA=$G4DATA/PhotonEvaporation
+  export G4RADIOACTIVEDATA=$G4DATA/RadiativeDecay
+  export G4LEDATA=$G4DATA/G4EMLOW3.0
+  #//////////////////////////////////////////////////////////
+  # GUI, Visualization :
+  #//////////////////////////////////////////////////////////
+  # GUI :
+  export G4UI_BUILD_XM_SESSION=1
+  export G4UI_USE_XM=1
+  # OpenGL :
+  export G4VIS_BUILD_OPENGLXM_DRIVER=1
+  export G4VIS_BUILD_OPENGLX_DRIVER=1
+  export G4VIS_USE_OPENGLXM=1
+  export G4VIS_USE_OPENGLX=1
+  #//////////////////////////////////////////////////////////
+  # Inventor :
+  #//////////////////////////////////////////////////////////
+  #export G4VIS_BUILD_OIX_DRIVER=1
+  #export G4VIS_USE_OIX=1
+  # SGI-Inventor :
+  # Darwin : Tiger, g++4.0 out.
+  #export OIVHOME /usr/local/SGI-Inventor/2.1.5.10/macos104_gcc40/usr
+  #export DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:"$OIVHOME/lib"
+  # OpenScientist RTK Coin* :
+  #export OIVHOME /Applications/OpenScientist/v15r0
+  #export OIVFLAGS "-I${OIVHOME}/Resources/CoinXt/include -I${OIVHOME}/Resources/CoinGL/include"
+  #export OIVLIBS "-L${OIVHOME}/lib -lCoinXt -losc_Coin"
+  #export DYLD_LIBRARY_PATH "${DYLD_LIBRARY_PATH}:${OIVHOME}/lib"
+  # OpenScientist devel Coin* :
+  #export COINGLHOME /barrand/OpenScientist/dev/CoinGL/v1r244p0
+  #export COINXTHOME /barrand/OpenScientist/dev/CoinXt/v1r122p0
+  export COINGLHOME=~/Work/svn/trunk/OpenScientist/CoinGL/v1r200p3
+  export COINXTHOME=~/Work/svn/trunk/OpenScientist/CoinXT/v1r50p4
+  export OIVFLAGS="-I${COINGLHOME}/include -I${COINXTHOME}/include"
+  export OIVLIBS="-L${COINXTHOME}/Darwin -lCoinXt -L${COINGLHOME}/Darwin -lCoin"
+  export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:${COINGLHOME}/Darwin:${COINXTHOME}/Darwin"
+  #export XENVIRONMENT visTutor/g4Xt.xrm
+#  export DYLD_BIND_AT_LAUNCH 1
+  #//////////////////////////////////////////////////////////
+  # AIDA :
+  #//////////////////////////////////////////////////////////
+  #  export G4ANALYSIS_USE 1
+  # OSC-dev implementation :
+  #  source $HOME_BARRAND/OpenScientist/dev/setup.csh
+  #  source $HOME_BARRAND/OpenScientist/dev/OnXLab/v1r0/cmt/setup.csh
+  # Set AIDA compile and link access :
+  #  export G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --cflags`
+  #  export G4ANALYSIS_AIDA_CONFIG_LIBS `aida-config --libs`
+  # Set PYTHONPATH to access local scripts :
+  #  export PYTHONPATH ${PYTHONPATH}:.
+
+  # OSC-15 implementation :
+  #   source /barrand/OpenScientist/v15r0/aida-setup.csh
+  # Set AIDA compile and link access :
+  #  export G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --cflags`
+  #  export G4ANALYSIS_AIDA_CONFIG_LIBS `aida-config --libs`
+  # Set PYTHONPATH to access local scripts :
+  #  export PYTHONPATH ${PYTHONPATH}:.
+
Index: trunk/geant4/visualization/.gdb_history
===================================================================
--- trunk/geant4/visualization/.gdb_history	(revision 562)
+++ trunk/geant4/visualization/.gdb_history	(revision 562)
@@ -0,0 +1,2 @@
+run
+quit
Index: trunk/geant4/visualization/G4History.macro
===================================================================
--- trunk/geant4/visualization/G4History.macro	(revision 562)
+++ trunk/geant4/visualization/G4History.macro	(revision 562)
@@ -0,0 +1,62 @@
+/run/verbose 2
+/vis/scene/create
+/vis/open DAWNFILE
+/vis/sceneHandler/create DAWNFILE
+/vis/sceneHandler/attach
+/vis/viewer/create ! ! 600
+/vis/open OGLSQT
+/vis/sceneHandler/create OGLSQT
+/vis/sceneHandler/attach
+/vis/viewer/create ! ! 600
+/vis/viewer/refresh
+/vis/scene/notifyHandlers
+/vis/viewer/flush
+/vis/viewer/refresh viewer-1
+/vis/viewer/update viewer-1
+/vis/scene/add/trajectories
+/tracking/storeTrajectory 1
+/vis/scene/notifyHandlers
+/vis/modeling/trajectories/create/drawByCharge
+/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
+/vis/scene/endOfEventAction accumulate
+/vis/scene/notifyHandlers
+/control/execute visTutor/gui.mac
+/gui/addMenu file File
+/gui/addButton file Continue continue
+/gui/addButton file Exit "exit"
+/gui/addMenu run Run
+/gui/addButton run "beamOn 1" "/run/beamOn 1"
+/gui/addButton run run1 "/control/execute run1.mac"
+/gui/addButton run run2 "/control/execute run2.mac"
+/gui/addMenu gun Gun
+/gui/addButton gun "50 MeV"  "/gun/energy 50 MeV"
+/gui/addButton gun "1 GeV"   "/gun/energy 1 GeV"
+/gui/addButton gun "10 GeV"  "/gun/energy 10 GeV"
+/gui/addButton gun "e-"      "/gun/particle e-"
+/gui/addButton gun "pi0"     "/gun/particle pi0"
+/gui/addButton gun "pi+"     "/gun/particle pi+"
+/gui/addButton gun "neutron" "/gun/particle neutron"
+/gui/addButton gun "proton"  "/gun/particle proton"
+/gui/addMenu vis Vis
+/gui/addButton vis Vis0(OGLIX) "/control/execute visTutor/exN03Vis0.mac"
+/gui/addButton vis Vis1(OGLSX) "/control/execute visTutor/exN03Vis1.mac"
+/gui/addButton vis Vis2(OGLSX) "/control/execute visTutor/exN03Vis2.mac"
+/gui/addButton vis Vis3(OGLSX) "/control/execute visTutor/exN03Vis3.mac"
+/gui/addButton vis Vis4(OGLIX) "/control/execute visTutor/exN03Vis4.mac"
+/gui/addButton vis Vis12(OGLIQT) "/control/execute visTutor/exN03Vis12.mac"
+/gui/addButton vis Vis14(OGLSQT) "/control/execute visTutor/exN03Vis14.mac"
+/gui/addButton vis Vis5(OIX)   "/control/execute visTutor/exN03Vis5.mac"
+/gui/addButton vis Vis6(VRML2FILE) "/control/execute visTutor/exN03Vis6.mac"
+/gui/addButton vis Vis7(DAWNFILE) "/control/execute visTutor/exN03Vis7.mac"
+/gui/addButton vis Vis8(DAWNFILE) "/control/execute visTutor/exN03Vis8.mac"
+/gui/addButton vis Vis9(OGLIWIN) "/control/execute visTutor/exN03Vis9.mac"
+/gui/addButton vis Vis10(OIWin32) "/control/execute visTutor/exN03Vis10.mac"
+/gui/addButton vis Vis11(OGLSXm) "/control/execute visTutor/exN03Vis11.mac"
+/gui/addMenu viewer Viewer
+/gui/addButton viewer "Set style solid" "/vis/viewer/set/style solid"
+/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wire"
+/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
+/N03/event/printModulo 100
+/gun/energy 1 GeV
+/run/beamOn 1
Index: trunk/geant4/visualization/GNUmakefile
===================================================================
--- trunk/geant4/visualization/GNUmakefile	(revision 562)
+++ trunk/geant4/visualization/GNUmakefile	(revision 562)
@@ -0,0 +1,65 @@
+# $Id: GNUmakefile,v 1.21 2005/06/04 14:53:18 gcosmo Exp $
+# -----------------------------------------------------------------------
+# GNUmakefile for visualization and modeling.  John Allison, 5/7/95.
+# Modeling is always made.  Others by environment.  John Allison  4/7/98.
+# -----------------------------------------------------------------------
+
+MAKEFLAGS= --no-print-directory
+
+name := G4visualization
+
+ifndef G4INSTALL
+  G4INSTALL = ../..
+endif
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+SUBDIRS := modeling
+SUBLIBS := G4modeling
+
+ifdef G4LIB_BUILD_ZLIB
+  SUBDIRS += externals/zlib
+  SUBLIBS += G4zlib
+endif
+
+# Libraries which can be used without external packages or libraries...
+ifdef G4VIS_BUILD
+  SUBDIRS += management
+  SUBLIBS += G4vis_management
+  SUBDIRS += FukuiRenderer
+  SUBLIBS += G4FR
+  SUBDIRS += HepRep
+  SUBLIBS += G4visHepRep
+  SUBDIRS += RayTracer
+  SUBLIBS += G4RayTracer
+  SUBDIRS += VRML
+  SUBLIBS += G4VRML
+  SUBDIRS += Tree
+  SUBLIBS += G4Tree
+  SUBDIRS += XXX
+  SUBLIBS += G4visXXX
+
+ifdef G4VIS_BUILD_OPENGL_DRIVER
+  SUBDIRS += OpenGL
+  SUBLIBS += G4OpenGL
+endif
+ifdef G4VIS_BUILD_OI_DRIVER
+  SUBDIRS += OpenInventor
+  SUBLIBS += G4OpenInventor
+endif
+endif #G4VIS_BUILD
+
+.PHONY: granular glob global clean
+
+glob global: granular
+
+granular:
+	@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE)); done
+
+includes:
+	@for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) $@ ); done
+
+clean clean_libs:
+	@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) $@); done
Index: trunk/geant4/visualization/History
===================================================================
--- trunk/geant4/visualization/History	(revision 562)
+++ trunk/geant4/visualization/History	(revision 562)
@@ -0,0 +1,2805 @@
+$Id: History,v 1.398 2006/11/26 22:07:44 allison Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     *************************************************************
+     * Note that modeling and test have their own History files. *
+     *************************************************************
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization category
+---------------------------------------
+
+25th November 2006  John Allison  (vis-V08-01-17)
+- visman-V08-01-15: Follow change of behaviour of G4StateManager and
+  minor message corrections.
+
+22nd November 2006  John Allison  (vis-V08-01-16)
+- visman-V08-01-14: Fixed /vis/reviewKeptEvents for "stored" viewers.
+
+21st November 2006  John Allison  (vis-V08-01-15)
+- visman-V08-01-13:
+  o Fixed double drawing of event.
+  o Restored old verbosity and printing interface (for obsolete user vis
+    managers).
+  o Fixed compiler warnings.
+- opengl-V08-01-09: Fixed compiler warnings.
+
+17th November 2006  Joseph Perl (vis-V08-01-14)
+- vis-HepRep-V08-01-04:
+  o Omit Pos and Aux attributes for hits.
+  o Protect against null Region (as in parallel geometries).
+- raytracer-V08-01-02
+  o Deprecate /vis/rayTracer/backgroundColour.
+
+16th November 2006  John Allison
+- modeling-V08-01-15: More protection for parallel worlds.
+- visman-V08-01-12:
+  o /vis/scene/notifyHandlers: Refreshes only auto-refresh viewers.
+    (Warning of scene change issued for other viewers.)
+
+15th November 2006  John Allison  (vis-V08-01-13)
+- visman-V08-01-11: First implementation of /vis/reviewKeptEvents.
+
+14th November 2006  Joseph Perl
+- vis-HepRep-V08-01-03: Improve handling of Trajectory Points.
+
+14th November 2006  John Allison  (vis-V08-01-12)
+- modeling-V08-01-14: Merged modeling-V08-01-13-branch onto main branch:
+  o Added G4Event pointer to modeling parameters.
+- visman-V08-01-10: Merged visman-V08-01-08-branch onto main branch:
+  o Visualisation of parallel worlds.
+  o Event refreshing (events are re-drawn on change or refresh of viewer).
+- raytracer-V08-01-01: Merged raytracer-V08-01-00-branch onto main branch:
+  o Followed change to G4Scene.
+- vistest-V08-01-05: Added G4EllipticalCone.
+
+13 November 2006 Joseph Perl
+- vis-HepRep-V08-01-02: Corrected handling of Hits that come via AddSolids.
+
+5th November 2006  John Allison  (vis-V08-01-11)
+- modeling-V08-01-13: Further, hopefully, complete, protection against
+  zero materials pointer.
+- vis-HepRep-V08-01-01, openinventor-V08-01-04, vistree-V08-01-02,
+  visXXX-V08-01-06: Protected against zero material pointer.
+- visman-V08-01-09: Tidy warning messages.
+
+3rd November 2006  John Allison
+- modeling-V08-01-12: Protected against zero material pointer.
+
+-----------------------------------------------
+3rd November 2006  John Allison  (vis-V08-01-10)
+- Needs greps-V08-01-10 for bug fix in G4Visible.
+- Needs tracking-V08-01-05 for new storeTrajectory command.
+- Committed tracking-V08-01-05.  Now required by vis. 
+  o Augmented /tracking/storeTrajectory.  Now takes integer parameter:
+    0 : Don't Store trajectories.
+    !=0 : Store trajectories.
+    1 : Choose G4Trajectory as default.
+    2 : Choose G4SmoothTrajectory as default.
+    3 : Choose G4RichTrajectory as default.
+  o All trajectories:
+    ~ Protect points container pointer in destructor.
+    ~ Make G4AttDef descriptions more concise.
+  o G4RichTrajectory:
+    ~ Bug fix: Create G4AttValues for user-defined creator process.
+  o G4VTrajectory: Improved ShowTrajectory.
+- visman-V08-01-08: Activated /vis/scene/add/trajectories with "rich" and
+  "smooth".  Needs tracking-V08-01-05.
+- modeling-V08-01-11: Improved protections.
+- vistest-V08-01-04: Removed MyTrackingAction (use storeTrajectory instead.)
+
+2nd November 2006  John Allison
+- modeling-V08-01-10: G4HitsModel: Added GetCurrentHit.
+- openinventor-V08-01-03: Extended picking to hits.
+
+-------------------------------------------------------------------------
+1st November 2006  John Allison  (vis-V08-01-09; co-works greps-V08-01-09)
+- modeling-V08-01-09: Minor rationalisation.
+- visman-V08-01-07:
+  o /vis/scene/add/trajectories: Allow string parameters "rich" and "smooth".
+    (Not yet activated - awaiting tags in tracking.)
+- openinventor-V08-01-02:
+  o Follow changes to greps-V08-01-09: G4AttCheck/Holder rationalisation.
+- vis-HepRep-V08-01-00: Minor rationalisation.
+- opengl-V08-01-08: Replace /vis/oglx/set/printEPS by /vis/oglx/printEPS.
+- vistree-V08-01-01: ASCIITree: Added printing of material name.
+- vistest-V08-01-03: Added G4Polycone and some G4Atts to an event action box.
+
+26th October 2006  John Allison
+- openinventor-V08-01-01:
+  o Print G4AttValues of solids and trajectories on picking.
+- modeling-V08-01-08: Cosmetics.
+
+-------------------------------------------------------------------------
+24th October 2006  John Allison  (vis-V08-01-08; co-works greps-V08-01-08)
+- opengl-V08-01-07:
+  o Calculate light front horizon properly.
+  o Improve refresh behaviour for /vis/opengl commands.
+- visXXX-V08-01-04; co-works greps-V08-01-08:
+  o Follow change to G4VisAttributes in greps-V08-01-08.
+
+-------------------------------------------------
+19th September 2006  John Allison  (vis-V08-01-07)
+- modeling-V08-01-07:
+  o G4ModelingParameters: Added ExplodeCentre
+  o Fix for Mac XCode 2.0 problem.
+- visman-V08-01-06:
+  o G4ViewParameters: Added ExplodeCentre.
+  o Bug fix in /vis/geometry/set/colour.
+- opengl-V08-01-06: Improved display-by-time feature.
+
+---------------------------------------------------------------------------
+15th September 2006  John Allison  (vis-V08-01-06 - coworks greps-V08-01-04)
+- modeling-V08-01-06
+  o Implemented explode factor(radial move) feature for top level drawn
+    volumes.  John Allison
+  o Add attribute based trajectory drawing & filtering, and attribute
+    based hit filtering.  Jane Tinsley
+- visman-V08-01-05
+  o Added /vis/viewer/clone and /vis/viewer/set/explodeFactor.  John Allison
+  o Add attribute based trajectory drawing & filtering, and attribute
+    based hit filtering.  Jane Tinsley
+
+13th September 2006  John Allison
+- visXXX-V08-01-03: Improved G4Att printing and checking.
+
+4th September 2006  John Allison
+- visman-V08-01-04: Added commands for cutaways.
+- opengl-V08-01-05: Implemented cutaways.
+
+----------------------------------------------
+30th August 2006  John Allison  (vis-V08-01-05)
+- modeling-V08-01-05:
+  o Implemented code for augmented /vis/scene/add/volume (subtraction
+    *and* intersection of clipping volume).
+  o Equipped for generic sectioning (DCUT) and cutaways.
+  o Improved DrawWithTime.
+- visman-V08-01-03:
+  o Added /vis/viewer/set/globalLineWidthScale.
+  o Augmented /vis/scene/add/volume to include intersection of clipping volume.
+  o Added G4VSceneHandler::CreateSection/CutawayPolyhedron to exploit generic
+    sectioning (DCUT) and cutaways.  Currently not activated due to
+    instabilities in BooleanProcessor.
+- opengl-V08-01-04:
+  o Implemented line width.
+  o Switched off back face culling when clipping so that the inside of
+    volumes can be seen.
+  o Added position and colour to /vis/ogl/set/displayHeadTime.
+  o Added /vis/ogl/set/displayLightFront.
+  
+29th August 2006  John Allison
+- openinventor-V08-01-00: Kernel visit rationalisation.
+- visXXX-V08-01-02: Minor tidying.
+
+-------------------------------------------------------------------------
+26th August 2006  John Allison  (vis-V08-01-04 - requires greps-V08-01-03)
+- modeling-V08-01-04:
+  o Fixed compilation warning.
+  o Follow G4VFilter const change.
+
+16th August 2006  John Allison
+- modeling-V08-01-03: Improved robustness of time slicing.
+
+----------------------------------------------
+16th August 2006  John Allison  (vis-V08-01-03)
+- opengl-V08-01-03:
+  o Fixed Solaris compilation problem.
+  o Added /vis/ogl/set/fade and displayHeadTime.
+
+-----------------------------------------------
+14th August 2006  John Allison  (vis-V08-01-02)
+- modeling-V08-01-02: Added trajectory time slicing.
+- visman-V08-01-02: Friendship extended to new OpenGL messengers.
+- opengl-V08-01-02:
+  o Implemented display-by-time.
+  o Added /vis/ogl/set/startTime and endTime.
+- raytracer-V08-01-00: Improved robustness under vis manager control.
+- vistest-V08-01-02: Added MyTrackingAction - uses G4RichTrajectory.
+
+17th July 2006  John Allison
+- opengl-V08-01-01: Added /vis/oglx/set/printEPS.
+
+---------------------------------------------
+10th July 2006  John Allison  (vis-V08-01-01)
+- Co-works with greps-V08-01-01.
+- modeling-V08-01-01:
+  o Rationalised G4VModel and G4ModelingParameters.
+  o G4PhysicalVolumeModel:
+    ^ Removed Establish/DecommissionSpecials to conform with
+      greps-V08-01-01.
+    ^ Rationalised G4Atts: Added GetAttDefs/CreateAttValues.
+- visman-V08-01-01:
+  o Removed Establish/DecommissionSpecials to conform with greps-V08-01-01.
+  o Respect rationalised G4ModelingParameters.
+  o Added GetNoOfSides that respects forced line segments per circle.
+- G4VisCommandsScene.cc: Spelling correction.
+- DAWN-V08-01-00: Respects forced line segments per circle.
+- visXXX-V08-01-01: Gets solid's G4Atts created by G4PhysicalVolumeModel.
+- vistest-V08-01-01: SetForceLineSegmentsPerCircle(100) for G4Sphere.
+
+--------------------------------------------------------------------
+3rd July 2006  John Allison  (vis-V08-01-00 - needs greps-V08-01-00)
+- modeling-V08-01-00: Added G4Atts for solids.  (Needs greps-V08-01-00.)
+- visman-V08-01-00:
+  o /vis/scene/transientsAction: Added max number of events parameter.
+  o Added /vis/viewer/clearTransients.
+  o Improved /vis/list.
+  o (Commented out) code for event copying.
+- opengl-V08-01-00:
+  o Eliminated redundant variable, doublebuffer.
+  o Implemented FinishView in all viewers.
+- vistree-V08-01-00: ASCIITree: Layout improvement.
+- visXXX-V08-01-00: General tidy and improvement to XXXFile.
+- vistest-V08-01-00: Protect against zero run manager pointer.
+
+---------------------------------------------
+12th June 2006  John Allison  (vis-V08-00-13)
+- DAWN-V08-00-04: Fixed rewind and file closure on exit.
+- VRML-V08-00-02: Fixed rewind and file closure on exit.
+
+------------------------------------------
+8th June 2006 John Allison (vis-V08-00-12)
+- visman-V08-00-23: Fixed bug in /vis/scene/endOfRunAction.
+
+-------------------------------------------
+7th June 2006  John Allison (vis-V08-00-11)
+- modeling-V08-00-14: Added protection for zero vis atts.
+- visman-V08-00-22: Zeroed modeling parameters pointer after use.
+
+-------------------------------------------
+6th June 2006  John Allison (vis-V08-00-10)
+- modeling-V08-00-13: Fixes for Sun and bug fix in G4PhysicalVolumeModel.
+- visman-V08-00-21: /vis/viewer/create: Fixed view params copy to self.
+
+------------------------------------------
+4th June 2005  Joseph Perl (vis-V08-00-09)
+- Global tag for Geant4 release 8.1
+- Corresponds to the following subdirectory tags:
+- DAWN-V08-00-03
+- vis-HepRep-V08-00-04
+- visman-V08-00-20
+- modeling-V08-00-12
+- opengl-V08-00-08
+- openinventor-V08-00-05
+- raytracer-V08-00-04
+- vistest-V08-00-08
+- vistree-V08-00-04
+- VRML-V08-00-01
+- visXXX-V08-00-04
+
+2nd June 2006  Joseph Perl
+- vis-HepRep-V08-00-03: Improvements to HepRepFile.
+
+2nd June 2006  John Allison
+- DAWN-V08-00-03: Handle file closing in DAWNFILE destructor.
+- VRML-V08-00-01: Protect zero model pointer.
+
+30th May 2006  Joseph Perl
+- opengl-V08-00-08: Fixed buffering problem in Win32.
+
+--------------------------------------------
+25th May 2006  John Allison  (vis-V08-00-08)
+- visman-V08-00-19:
+  o Changed re-computation of transients default to "off".
+  o Indent printing of models plus other minor improvements.
+- modeling-V08-00-11: Indent printing of models, fix trivial compiler warnings.
+- vistest-V08-00-07: Removed standalone - moved to
+  examples/extended/visualization.
+
+22nd May 2006  John Allison
+- modeling-V08-00-10:
+  o Remove dependency on Run.
+  o Protect zero pointer in output of G4ModelingParameters.
+- visman-V08-00-18:
+  o Remove G4Scene:Clear().  (Not used.)
+  o Require Idle state for transient re-computation.
+  o Reduce dependency on Run.  (Still used for transient re-computation.)
+  o /vis/.../list commands: Default verbosity changed to "warnings".
+- vis-HepRep-V08-00-02: Remove dependency on Run.
+
+--------------------------------------------
+12th May 2006  John Allison  (vis-V08-00-07)
+- Needs run-V08-00-02 and event-V08-00-03.
+- Main features:
+  o Protect against non-instantiation of run manager.
+  o Final refinements for re-computation of transients.
+  o G4OpenGLWin32Viewer: Fixed buffer swapping behaviour.
+- visman-V08-00-16:
+  o Added /vis/list and /vis/scene/add/eventID.
+  o Final refinements for event/run reprocessing (re-computation of
+    transients).
+- modeling-V08-00-09:
+  o Removed dependency on G4RunManager.
+  o G4CallbackModel: Added G4VGraphicsScene argument to operator().
+- opengl-V08-00-06: G4OpenGLWin32Viewer: Fixed buffer swapping behaviour.
+- raytracer-V08-00-04: SetRecomputeTransients(false).
+- raytracer-V08-00-03: Moved G4RayShooter class to Event category.
+- vistest-V08-00-06: Uses /vis/scene/add/eventID.
+
+----------------------------------------------
+21st April 2006  John Allison  (vis-V08-00-06)
+- Main features:
+  o Improved protection for null models and parameters.
+  o Improved trajectory drawing.
+  o Improved re-computation of transients in OpenGL.
+- modeling-V08-00-08:
+  o Improved protection for null models and parameters.
+  o Add context to trajectory drawers.
+  o Add generic drawer, G4TrajectoryGenericDrawer.
+- visman-V08-00-15: Improved protection for null models and parameters.
+- DAWN-V08-00-02: Improved protection for null models and parameters.
+- vis-HepRep-V08-00-01: Improved protection for null models and parameters.
+- raytracer-V08-00-02): 
+  o Relies on improved protection for null models and parameters.
+- vistree-V08-00-04: Improved protection for null models and parameters.
+- visXXX-V08-00-04: Improved protection for null models and parameters.
+- vistest-V08-00-05: Tidied.
+
+28th April 2006  John Allison
+- Co-working tags:
+  o opengl-V08-00-05: Fixes re-computation of transients in stored viewers.
+  o visman-V08-00-14: Includes changes that improve behaviour of
+    double buffered and interactive viewers when recomputing
+    transients.
+
+----------------------------------------------
+24th April 2006  John Allison  (vis-V08-00-05)
+- visman-V08-00-13:
+  o Fix bug #861.
+  o Print available models on initialisation.
+- modeling-V08-00-07:
+  o Add Print method to G4VModelFactory.
+  o Fix warnings on Linux.
+- opengl-V08-00-04: Fixed compilation problem on Windows.
+
+---------------------------------------------------------------------
+19th April 2006  John Allison (vis-V08-00-04 - needs greps-V08-00-02)
+- Main features:
+  o Implementation of 2D text in base classes and concrete implementation
+    of same in OpenGL.
+  o Continued migration to direct access to G4PhysicalVolumeModel.
+  o Addition of Trajectory Filter Models (Jane Tinslay).
+- visman-V08-00-12 (needs greps-V08-00-02):
+  o Implemented Draw2D(const G4Text&).
+  o Implemented Begin/EndPrimitives2D.
+  o Migrated to direct access to G4PhysicalVolumeModel.
+  o Introduced G4VisFilterManager.hh to manager filtering
+- modeling-V08-00-06:
+  o Upgrade to greps-V08-00-02 and minor improvements.
+  o Added G4TrajectoryFilterFactories and G4TrajectoryParticleFilter
+- DAWN-V08-00-01: Migrated to direct access to G4PhysicalVolumeModel.
+- vis-HepRep-V08-00-00: Migrated to direct access to G4PhysicalVolumeModel.
+- opengl-V08-00-03:
+  o Implemented Begin/EndPrimitives2D.
+  o Migrated to direct access to G4PhysicalVolumeModel.
+- vistree-V08-00-03:
+  o G4GAGTreeSceneHandler: Migration to direct access to G4PhysicalVolumeModel.
+- visXXX-V08-00-03: Improvement of legibility.
+- openinventor-V08-00-04: Use cmath instead of math.h.
+- vistest-V08-00-04: Added drawing of 2D text.
+
+----------------------------------------------
+28th March 2006  John Allison  (vis-V08-00-03)
+- visman-V08-00-11:
+  o Introduces trajectory drawing manager.
+  o G4VisExecutive: Adds G4TrajectoryDrawByOriginVolumeFactory.
+  o Corrects logic of transients re-computation:
+  o Unifies treatment of bools in commands.
+- modeling-V08-00-05:
+  o Introduces G4TrajectoryDrawByOriginVolume.
+  o Part migration away from EstablishSpecials mechanism.
+- vistree-V08-00-02 (needs modeling-V08-00-05):
+  o Made compatible with modeling-V08-00-05. 
+  o Migration away from EstablishSpecials mechanism.
+- openinventor-V08-00-03: Much improvement in logic.
+- visXXX-V08-00-02: Added G4XXXFile, G4XXXStored, G4XXXSG.
+- vistest-V08-00-03: Modernised and improved.
+
+----------------------------------------------
+14th March 2006  John Allison  (vis-V08-00-02)
+- opengl-V08-00-02: Refinement of display list handling.
+- vistree-V08-00-01: G4VTree and G4ASCIITree: Minor improvements to
+  readability of code.
+- modeling-V08-00-04: Added output operator<< for PVNodeID.
+
+13th March 2006  John Allison
+- visman-V08-00-10: Fixes recomputation of transients when changing drivers.
+
+---------------------------------------------
+8th March 2006  John Allison  (vis-V08-00-01)
+- visman-V08-00-09: Small bug fix to vis-V08-00-00.
+
+6th March 2006  John Allison  (vis-V08-00-00)
+- Collected tags below.  Main features since Release 8.0:
+  o Added /vis/scene/transientsAction.  The default is "rerun", i.e.,
+    when the viewer requests, the previous event or run will be
+    processed again with the original random number seed so that
+    transients (trajectories, hits, user drawing, etc.) are
+    reconstructed.  Thus, transients are "remembered" and may be
+    copied between graphics systems.  Turn off with
+    "/vis/scene/transientsAction none".
+  o Introduced /vis/geometry/... for editing vis attributes of
+    geometry volumes.
+  o For developers:
+    * Migration from use of Establish/DecommisionSpecials.
+    * Drawn path available.
+
+6th March 2006  John Allison
+- visman-V08-00-08: Added /vis/scene/transientsAction.
+
+3rd March 2006  John Allison
+- vistest-V08-00-02: Added test of transient handling.
+
+16th February 2006  John Allison
+- modeling-V08-00-03: For future removal of Establish/DecommisionSpecials.
+
+9th February 2006  John Allison
+- visman-V08-00-07: First implementation of refresh end-of-event.
+
+8th February 2006  John Allison
+- modeling-V08-00-02: Added DrawingStyle to G4ModelingParameters and fixed
+  bug in culling of covered daughters
+- visman-V08-00-06 (needs modeling-V08-00-02): Made use of
+  G4ModelingParameters::DrawingStyle.
+- vistree-V08-00-00: Fixed bug in treatment of repeated replicas.
+- visXXX-V08-00-01: Improved handling of DrawnPVPath.
+
+3rd February 2006  John Allison
+- visman-V08-00-05: Introduced /vis/geometry/...
+
+30th January 2006  John Allison
+- openinventor-V08-00-01: Implemented drawn volume path.
+
+26th January 2006  John Allison
+- raytracer-V08-00-01: Minor improvements.
+- vistest-V08-00-01: Improved ray tracer; commented about voxelisation crash.
+- modeling-V08-00-01: G4PhysicalVolumeModel: Added drawn volume path
+  capability.
+- visXXX-V08-00-00: Uses drawn volume path.  Needs modeling-V08-00-01
+  and visman-V08-00-04.
+- 3 co-working tags due to removal of fModified:
+  o visman-V08-00-04: Removed fModified plus minor improvements.
+  o opengl-V08-00-01: Removed fModified plus tidying.
+  o openinventor-V08-00-00: Removed fModified.
+
+----------------------------------------------------------------------
+The tags below since Release 8.0 were collected in geant4-08-00-ref-01
+and geant4-08-00-ref-02.
+
+23rd January 2006  John Allison
+- DAWN-V08-00-00: Rewind output file in ClearView.  Avoids duplicate
+  geometries in output file.
+- VRML-V08-00-00: As above.
+
+11th January 2006  John Allison
+- vistest-V08-00-00: Added twisted solids and improved Perspective example.
+- visman-V08-00-02: Minor improvements.
+- raytracer-V08-00-00: Reorganisation (needs visman-V08-00-02).
+- opengl-V08-00-00: Improved efficiency; made G4OpenGLXmViewerMessenger smart.
+- modeling-V08-00-00: Changed last remaining G4Transform3D::Identity to
+  G4Transform3D().
+
+9th January 2006  John Allison
+- visman-V08-00-00: geant4-08-00-ref-00 + reversal of change of 22nd
+  November 2005: fMarkForClearingTransientStore(true) initially now.
+- visman-V08-00-01: Improved /vis/scene/notifyHandlers, improved warning
+  messages and some bug fixes, including visman-V08-00-00.
+
+----------------------------------------------
+4th December 2005  Joseph Perl (vis-V07-01-10)
+- Global tag for Geant4 release 8.0
+- Corresponds to the following subdirectory tags:
+- externals: geant4-07-01-ref-05
+- FukuiRenderer: geant4-07-01-ref-05
+- HepRep: geant4-07-01-ref-05
+- management: visman-V07-01-10
+- modeling: modeling-V07-01-07
+- OpenGL: opengl-V07-01-09
+- OpenInventor: openinventor-V07-01-04
+- RayTracer: raytracer-V07-01-08
+- test: vistest-V07-01-04
+- Tree: vistree-V07-01-01
+- VRML: geant4-07-01-ref-05
+- XXX: visXXX-V07-01-02
+
+29th November 2005  Jane Tinslay (vis-V07-01-09)
+- Make G4VisManager::RegisterModelFactories() non-pure for 
+  backwards compatibility.
+- Add information message to G4VisManager::DispatchToModel
+  when default trajectory model is used.
+- Removed names of unused paramaters to stop compiler warnings:
+  G4VModelCommand.hh, G4ModelCommandsDrawByCharge.cc,
+  G4ModelCommandsDrawByParticleID.cc, G4VRTScanner.hh
+
+25th November 2005  Joseph Perl (vis-V07-01-08)
+- Global tag for Geant4 release 8.0
+- Corresponds to the following subdirectory tags:
+- externals: geant4-07-01-ref-05
+- FukuiRenderer: geant4-07-01-ref-05
+- HepRep: geant4-07-01-ref-05
+- management: visman-V07-01-09
+- modeling: modeling-V07-01-05
+- OpenGL: opengl-V07-01-09
+- OpenInventor: openinventor-V07-01-03
+- RayTracer: raytracer-V07-01-06
+- test: vistest-V07-01-04
+- Tree: vistree-V07-01-01
+- VRML: geant4-07-01-ref-05
+- XXX: visXXX-V07-01-02
+
+22nd November 2005  John Allison
+- vistest-V07-01-04: Added G4Tet and PerspectiveVisAction. Refined G4Polyhedra.
+- opengl-V07-01-08: Added G4OpenGLXmViewerMessenger. Corrected text position.
+- vistree-V07-01-01: Refined guidance and printing.
+- visXXX-V07-01-02: Simplified guidance.
+- modeling-V07-01-03: Implemented radial replicas for G4Tubs.
+
+18th November 2005  John Allison
+- raytracer-V07-01-06: merged developments to the head, including RayTracerX.
+
+18th November 2005  Joseph Perl  (vis-V07-01-07)
+- Minor modification of geant4-07-01-ref-05 to facilitate acceptance
+  of greps-V07-01-09 and tracking tracking-V07-01-02.  As with
+  vis-V07-01-06, it should subsequently simply be ignored.
+
+15th November 2005  Guy Barrand
+- openinventor-V07-01-03: Background, scaling and window positioning.  Also
+  reading and wroting of .iv files.
+
+14th November 2005  John Allison (vis-V07-01-06)
+- Minor modification of vis-V07-01-03 + vis-HepRep-V07-01-04 (to avoid
+  warnings on Sun), i.e., it excludes all development since then. This
+  tag is purely to facilitate acceptance of greps-V07-01-09.  To
+  achieve this, the modification was made on a branch -
+  vis-V07-01-03-branch - of just one file, namely G4VisManager.hh.
+  This should subsequently simply be ignored.
+
+13th November 2005  John Allison
+- visman-V07-01-08: Added XGeometryString and background opacity parameter.
+- opengl-V07-01-07: Implemented window placing (XGeometryString) in OGL*X.
+
+24th October 2005  John Allison
+- modeling-V07-01-02: Added trajectory models.
+- visman-V07-01-07: Added methods for managing trajectory models.
+
+20th October 2005  Joseph Perl (vis-V07-01-05)
+- New Global Vis Tag.
+- Includes head of everything except RayTracer and OpenInventor.
+- Requires geant4-07-01-ref-03 plus the following:
+- graphics_reps: greps-V07-01-06
+- intercoms: intercoms-V07-01-01
+- event: event-V07-01-0
+- run: run-V07-01-02
+
+13th October 2005  John Allison (vis-V07-01-04)
+- Implemented non-uniform scaling in management and OpenGL.
+- Implemented arbitrary background in management, OpenGL and RayTracer.
+- Migrated to <sstream>.
+- The above consists of:
+  o vistest-V07-01-03: Migrated to <sstream> plus minor changes.
+  o DAWN-V07-01-00: Migrated to <sstream>.
+  o vis-HepRep-V07-01-03: Migrated to <sstream>.
+  o opengl-V07-01-06: Migrated to <sstream>, non-uniform scaling, any
+    background.
+  o vistree-V07-01-00: Migrated to <sstream>, fixed bug in mass calculations.
+  o visXXX-V07-01-01: Migrated to <sstream>.
+  o modeling-V07-01-01: Migrated to <sstream>.
+  o visman-V07-01-05: Migrated to <sstream>, non-uniform scaling, any
+    background.
+
+12th October 2005  John Allison (vis-V07-01-03)
+- G4VisCommandsViewer.cc: Trapped zero viewer pointer in /vis/viewer/update
+  (bug found by system test of vis-V07-01-02).
+
+2nd Oct 2005  Joseph Perl (vis-V07-01-02)
+  Same as vis-V07-01-01 but with earlier raytracer tag:
+  raytracer-V07-01-02
+
+30th Sep 2005  Joseph Perl (vis-V07-01-01)
+  New global tag for Vis.  Corresponds to vis-V07-01-00 plus:
+  vistest-V07-01-02
+  visman-V07-01-04
+  raytracer-V07-01-03
+  modeling-V07-01-00
+  opengl-V07-01-05
+  openinventor-V07-01-02
+  visXXX-V07-01-00
+  vis-HepRep-V07-01-01
+
+30th September 2005  Joseph Perl (raytracer-V07-01-03)
+New tag to include change Makoto made an hour after V07-01-02 was tagged.
+Change seems to just involve passing pWorld to material list where no argument was passed in previous version.
+
+29th September 2005  John Allison  (opengl-V07-01-05)
+- Added G4OpenGLViewerDataStore to facilitate access of viewer data by
+  scene handler.
+- Re-implemented transparency button in OpenGLXm.
+
+New tags to be included 16th Sep 2005 (JA):
+  o visman-V07-01-03:
+    + Issue "/tracking/storeTrajectory 1" on /vis/scene/add/trajectories.
+    + Warning: Attempt to add volume to a scene already containing the world.
+    + Error: Logical volume model must be only volume model in scene.
+  o visman-V07-01-04: Simplified use of ConcreteInstance..
+  o raytracer-V07-01-02: Bug fix (black holes).
+  o vistest-V07-01-02: Added a G4AttValue with time.
+
+To be included:
+  o visman-V07-01-01: Introduced (optional) second pass over scene.
+  o visman-V07-01-02: Added /vis/viewer/set/whiteBackground.
+                      Added RayTracerX to G4VisExecutive.
+  o modeling-V07-01-00: Fixed (non-)culling of transparent volumes.
+  o opengl-V07-01-01: Half-way implementation of transparency.
+  o opengl-V07-01-02: "Better algorithm" for transparency.
+  o opengl-V07-01-03: Bug fix.
+  o opengl-V07-01-04: Fixed hidden line removal.
+  o vis-HepRep-V07-01-00 (4 August 2005 Mark Donszelmann)
+  o openinventor-V07-01-01 (1st August 2005  Gabriele Cosmo)
+  o openinventor-V07-01-02: Corrected treatment of edgeflags.
+  o raytracer-V07-01-01: Protected RayTracerX by G4VIS macro.
+  o visXXX-V07-01-00: Improved guidance for rendering polyhedron objects.
+  o vistest-V07-01-01: RayTracerX instantiation removed - now in
+                       G4VisExecutive.
+
+20th July 2005  John Allison (vis-V07-01-00)
+- opengl-V07-01-00: Introduced smooth shading.  Also window size hints for Xm.
+- openinventor-V07-01-00: Changed Geant4_SoPolyhedron to construct
+    from G4Polyhedron.  Functionality unchanged.
+- visman-V07-01-00: Protected new viewer pointer.
+- vistest-V07-01-00
+- Removed top level README files.  (All wisdom now transferred
+    properly to User Guides.)
+
+17th July 2005  John Allison
+- raytracer-V07-01-00: Introduced RayTracerX.
+
+7th June 2005  John Allison (vis-V07-00-19)
+- visXXX-V07-00-00: Fixed compiler warnings.
+- visman-V07-00-02: bug fix.
+- modeling-V07-00-02: bug fix.
+- Incorporates vis-gmk-V07-00-00 - a fix for addition of zlib to
+  SUBLIBS and SUBDIRS (Gabriele)
+
+2nd June 2005  Joseph Perl (vis-V07-00-18)
+- Candidate tag for release.
+- Includes Mark's additional changes for HepRep2.
+- Includes Mark's fix for gcc-4.0 compilation.
+
+2nd June 2005  Joseph Perl (vis-V07-00-17)
+- Candidate tag for release.  May or may not be final.
+- Undid Gabriele's fix to G4HepRepFileSceneHandler.cc.
+
+2nd June 2005  John Allison
+- Removed scene handler count and made small cosmetic improvements.
+
+2nd June 2005  Joseph Perl (vis-V07-00-16)
+- Incorporate improvements to HepRepFile and HepRepXML
+
+30th May 2005  John Allison  (vis-V07-00-15)
+- opengl-V07-00-03: Fixed compilation problem in OpenGL on SUN.
+- HepRepFile: Fixed bug introduced in ClearTransientStore. (Joseph Perl)
+
+27th May 2005  John Allison
+- DAWN-V07-00-00, VRML-V07-00-00:
+    Fixed bug introduced in ClearTransientStore.
+- openinventor-V07-00-00 and 01:
+    fixes for CLHEP and marker sizes.
+- vis-HepRep-V07-00-01 and vis-zlib-V07-00-00  (Mark Donszelmann)
+    Migration to G4LIB_BUILD_ZLIB and some developments.
+- management:
+  o Reduced text size of scale annotation to 12 pixels.
+  o Fixed default values in /vis/scene/add/text.
+
+12th May 2005  John Allison
+- Moved zlib to externals/zlib.
+
+6th May 2005  John Allison  (vis-V07-00-14)
+- OpenGL: fixed bug (views not refreshed - opengl-V07-00-02).
+- Improved ASSCIITree guidance.
+- G4VisExecutive: Replaced printing of available graphics systems.
+  Now corresponds to behaviour of most old examples vis managers.
+- Fixed some pedantic warnings from gcc 4.
+- G4PhysicalVolumeModel: SetCopyNo of replicas and paramaterised
+  volumes (modeling-V07-00-00).
+
+5th May 2005  John Allison
+- Introduced zlib directory.
+
+22nd April 2005  John Allison
+- OpenGL: Implemented text for X-Windows viewers (opengl-V07-00-00/1).
+
+10th April 2005  John Allison  (visman-V07-00-00)
+- G4VisCommandsSceneAdd.cc: 2nd attempt to fix access to fpVisManager
+  from nested class for SUN.
+
+16th March 2005  John Allison  (vis-V07-00-13)
+- G4VisCommandsSceneAdd.cc: fixed access to fpVisManager from nested class.
+- For gcc 2.95.2: Fixed G4String return for viewer commands.
+- Added constructor and virtual destructor to G4VUserVisAction.
+
+15th March 2005  John Allison  (vis-V07-00-12)
+- Added return type G4int to G4ViewParameters::SetNoOfSides and
+  G4ModelingParameters::SetNoOfSides.  They return no. of sides, i.e.,
+  sides per circle in polyhedron contruction, that are actually set;
+  there is a lower limit of 12.
+- G4PhysicalVolumeModel: bug fix: no. of rotation steps correctly applied.
+
+10th March 2005  John Allison  (vis-V07-00-11)
+- Reviewed all vis commands.  Improved guidance, simplified and
+  rationalised the commands.
+
+9th March 2005  John Allison
+- Removed "remove" and "edit" commands.
+- G4VisManager: removed "Delete" methods. (Removing or deleting an
+  existing scene, scene handler or viewer is very messy and not
+  necessary.  When a user creates a new one, he/she may leave the old
+  one around without harm.  It may be left unused or selected again later
+  if the user wants.)
+- Removed automatic parameter candidate specification for commands
+  that take an argument that is a scene, scene handler or viewer
+  name - it is checked in SetNewValue methods.  (The code was just
+  too complicated and, anyway, the result hindered, rather than
+  helped the user, because it restricted the parameter values and
+  mis-typing gave obscure messages.  Now the messages are clearer and,
+  as the guidance points out, the list of possible names can be
+  obtained with a "list" command.)
+- Made "list" commands flag current items.
+- Improved guidance for /vis/scene commands.  Still to do (groan!):
+    /vis/scene/add
+    /vis/sceneHandler
+    /vis/viewer
+
+9th March 2005  John Allison  (vis-V07-00-10, needs greps-V07-00-01)
+- Refined logo and scale.
+- Improved physical volume clipping.
+- G4VisManager: Added default G4Transform3D::Identity to
+  objectTransformation argument in Draw methods.
+
+4th March 2005  John Allison  (vis-V07-00-09)
+- Added first implementation of cutaway - a clipping box for physical
+  volume tree:
+    vis/scene/add/volume ! ! ! box km 0 1 0 1 0 1
+  (Does not seem properly to clip volumes wholly inside clipping volume.)
+
+3rd March 2005  John Allison  (vis-V07-00-08)
+- Introduced /vis/scene/add/logo.
+- Added Set methods to G4VModel.
+- Added argument to G4CallbackModel::operator()(const G4Transform3D&) so that
+  the model could implement a given transformation.  Provided default for
+  G4VUserVisAction::(const G4Transform3D& = G4Transform3D::Identity).
+- Improved guidance for:
+    compound commands
+    ASCIITree commands
+- Used std::istrstream::istrstream(std::string) throughout.
+
+23rd February 2005  John Allison  (vis-V07-00-07)
+- Protected scene handlers for the case of the drawing of solids NOT
+  from a physical volume tree:
+    G4FRSceneFunc.icc
+    G4OpenGLSceneHandler.cc
+    G4OpenGLStoredSceneHandler.cc
+    G4ASCIITreeSceneHandler.cc
+    G4GAGTreeSceneHandler.cc
+- Fixed a problem with ClearTransientStore.  ClearTransientStore
+  should restrict itself to its job.  In the following files,
+  ClearTransientStore also redraws the view.  In other places, a draw
+  command often follows, so it is not needed here.  In fact it can
+  cause a double recursive descent into DrawView, so the existing code
+  has been commented out (JA - 23/Jan/05):
+    G4FRSceneFunc.icc
+    G4HepRepFileSceneHandler.cc
+    G4OpenGLImmediateSceneHandler.cc
+    G4OpenGLStoredSceneHandler.cc
+    G4VRML1SceneHandlerFunc.icc
+    G4VRML2SceneHandlerFunc.icc
+    G4XXXSceneHandler.cc
+- Removed (commented out) some code that forced extra kernel visits,
+  purportedly to overcome a problem in OpenGLStored methods.  Let's
+  fix OpenGL if necessary:
+    G4VSceneHandler.cc
+    G4VViewer.cc
+- Commented out SetView and ClearView in /vis/viewer/refresh:
+    G4VisCommandsViewer.cc
+- Changed signature of G4VViewer::SetNeedKernelVisit(G4bool) for compatibility.
+
+19th February 2005  John Allison  (vis-V07-00-06 with greps-V07-00-00)
+- Added G4VUserVisAction and G4CallbackModel.
+- Implemented /vis/scene/add/userAction.
+- Fixed bug in /vis/viewer/update (check existence of scene handler and scene).
+
+15th February 2005  John Allison  (vis-V07-00-05)
+- Introduced drawing of readout geometry for logical volumes.
+- For drawing of logical volumes, introduced boolean flags to control 
+  drawing of:
+    o boolean components (if any)
+    o voxels (if any) (note: voxels are not created until start of run)
+    o readout geometry (if any)
+- Augmented commands /vis/specify and /vis/scene/add/logicalVolume to use
+  above flags.
+- G4ASCIITree: Added printing of names of sensitive detector (if any) and
+  readout geometry (if any).
+
+15th February 2005  John Allison  (vis-V07-00-04)
+- Updated READMEs for G4VisExecutive.  Removed references to OPACS.
+
+9th February 2005  John Allison  (vis-V07-00-03)
+- Migration from AddThis to AddSolid and AddCompound: fixed previously
+  missed FukuiRendererSceneHander.
+
+4th February 2005  John Allison  (vis-V07-00-02)
+- Introduced G4VisExecutive.  MyVisManager deprecated.
+
+27th January 2005  John Allison  (vis-V07-00-01, needs intercoms-V07-00-00)
+- Migration from AddThis to AddSolid and AddCompound.
+- AddSolid: Methods for adding solids to the scene handler.  They
+  must always be called in the triplet PreAddSolid, AddSolid and
+  PostAddSolid.  The transformation and visualization attributes
+  must be set by the call to PreAddSolid.  A possible default
+  implementation is to request the solid to provide a G4Polyhedron
+  or similar primitive - see, for example, G4VSceneHandler.
+- AddCompound: Methods for adding "compound" GEANT4 objects to the scene
+  handler.  These methods may either (a) invoke "user code" that
+  uses the "user interface", G4VVisManager (see, for example,
+  G4VSceneHandler in the Visualization Category, which for
+  trajectories uses G4VTrajectory::DrawTrajectory, via
+  G4TrajectoriesModel in the Modeling Category) or (b) invoke
+  AddPrimitives below (between calls to Begin/EndPrimitives) or (c)
+  use graphics-system-specific code or (d) any combination of the
+  above.
+
+26th January 2005  John Allison  (vis-V07-00-00)
+- G4VisManager:: removed optional argument
+  const G4Transform3D& objectTransformation = G4Transform3D::Identity
+  from Draw methods for a hit and trajectory.
+- Trapped illegal nesting of Begin/EndPrimitives.
+- Added fpCurrentMaterial to G4VSceneHandler and relevant derived
+  classes and models for work with G4PhysicalVolumeModel via
+  EstablishSpecials.  So now, the material is also available (in addition
+  to current depth, logical and physical volum) during drawing of geometry
+  items.
+- Changed ASCIITree to use G4VSolid::GetCubicVolume and
+  G4LogicalVolume::GetMass.
+- Changed G4PhysicalVolumeMassScene to use G4VSolid::GetCubicVolume.
+- Improved guidance for /vis/viewer/set/hiddenMarker.
+- G4VisCommandsViewerSet: made Up and Viewpoint vectors unit for safety.
+- Some additions to test area.
+
+10th December 2004 Gabriele Cosmo (vis-V06-02-09)
+- Replaced M_PI with CLHEP's pi.
+
+7th December 2004 Joseph Perl (vis-V06-02-08)
+- Tagged right after migration to cmath
+- All occurences of include <math.h> have now become include <cmath>.
+- All math functions are now prefaced with std::
+
+7th December 2004 Joseph Perl (vis-V06-02-07)
+- Tagged right before migration to cmath
+
+26th November 2004 Joseph Perl (vis-V06-02-06)
+- Tagged for release 7.0.
+- Made from vis-V06-02-05
+- plus opengl-V06-02-07 by John Allison
+- plus vis-HepRep-V06-02-02 by Mark Donszelmann
+- plus openinventor-V07-00-00 by Guy Barrand
+
+18th November 2004  John Allison
+- Included opengl-V06-02-07.
+
+11th November 2004  John Allison  (vis-V06-02-05)
+- Made use of smart method GetPolyhedron for solids.  This greatly
+  speeds 2nd and subsequent drawings when kernel access is required.
+- Rationalised use of EstablishSpecials: functionality moved to base class.
+- Removed use of obsolete G4Polymarker::line.
+
+22nd September 2004  John Allison  (vis-V06-02-04)
+- Moved Doxyfile to management.  doxygen output to tmp area.
+- modeling-V06-02-01 - small fixes.
+- vistree-V06-02-01 - small fixes.
+- opengl-V06-02-06 - Trap non-regular polyhedra and other small changes.
+- DAWN-V06-02-00 - Improve diagnostic on trapping non-regular polyhedra.
+- vistest-V06-02-02: refined rotated tube test.
+
+13th September 2004  John Allison  (vis-V06-02-03)
+- vistree-V06-02-00: Improved ASCIITree:
+  verbosity >= 3: prints volume, density of all volumes in hierarchy.
+  verbosity >= 4: calculates the mass of the complete geometry tree taking
+    into account daughters up to the depth specified for each physical
+    volume in the current scene.  Culling is ignored so that all volumes
+    are processed.  The calculation is quite tricky, since it involves
+    subtracting the mass of that part of the mother that is occupied by
+    each daughter and then adding the mass of the daughter, and so on
+    down the heirarchy.  Uses G4PhysicalVolumeMassScene - see below.
+  Added option to write to file (/vis/ASCIITree/set/outFile).
+- modeling-V06-02-00: Added G4PhysicalVolumeMassScene and improvements
+  to G4PhysicalVolumeModel.  See modeling/History for more details.
+- Removed obsolete file: G4VisToOldVisCommands.hh
+- Corrected mistake in /vis/viewer/set/*Vector commands.
+- Augmented ParameterisedBox and rotated a tracker tube in test directory.
+- Brought README.built_in_commands up to date for Geant4 6.2.  Removed all
+  references to old commands.'
+
+3rd August 2004  John Allison
+- Rationalised vis command code (uses G4UIcommand static conversion
+  functions where possible).
+- Removed G4ViewParameters::DrawingStyle GetDrawingStyle (const
+  G4Visible&).  Instead, developer has to:
+    // Get vis attributes - pick up defaults if none.
+    const G4VisAttributes* pVA =
+      fpViewer -> GetApplicableVisAttributes (v.GetVisAttributes ());
+  where v is the visible object (polyline, circle, polyhedron, etc.), and:
+    // Get view parameters that the user can force through the vis
+    // attributes, thereby over-riding the current view parameter.
+    G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+    G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+  Most developers do this anyway, so the removed routine was redundant
+  and resulting code is more efficient and transparent.  To get
+  colour, the developer can pick up directly from the vis attrributes,
+  pVA, obtained as above:
+    const G4Colour& c = pVA -> GetColour ();
+  or use a slightly less efficient method:
+    const G4Colour& c = GetColour (v);
+  where v is the visible object.
+  Note that for text, the developer must use a different procedure,
+  since the default text colour is determined by the default text vis
+  attributes, which may be specified independent of default vis
+  attributes of other types of visible objects.  A function,
+  GetTextColour, is provided and the recommended use is:
+    const G4Colour& c = GetTextColour (text);  // Picks up default if none.
+- Rationalised use of vis attributes in OpenGL and XXX.
+
+28th July 2004  John Allison  (vis-V06-02-02 with greps-V06-02-00)
+- Implemented force auxiliary edge visible feature of G4VisAttributes.
+- Included openinventor-V06-02-00 (minor revision - Guy Barrand).
+
+23rd July 2004  John Allison
+- Added auxiliary edge visible flag to G4ViewParameters and a new
+  command, /vis/viewer/set/auxiliaryEdge.  (Auxiliary edges are not
+  genuine edges of the volume.  They may be in a curved surface made
+  out of polygons, for example, or in plane surface of complicated
+  shape that has to be broken down into simpler polygons.
+  HepPolyhedron breaks all surfaces into triangles or quadrilaterals.
+  There will be auxiliary edges for any volumes with a curved surface,
+  such as a tube or a sphere, or a volume resulting from a Boolean
+  operation.  Normally, they are not shown, but sometimes it is useful
+  to see them.  In particular, a sphere, because it has no egdes, will
+  not be seen in wireframe mode in some graphics systems unless this
+  flag is turned on.)
+
+16th July 2004  John Allison
+- Refined forced wireframe algorithm - *always* force wireframe even
+  if hidden line removal is specified.
+- opengl-V06-02-04.
+
+15th July 2004  John Allison
+- Small improvement to G4XXX (sample graphics system).
+
+14th July 2004  John Allison  (vis-V06-02-01)
+- Removed deprecated commands:
+    /vis/viewer/show               (use /vis/viewer/update)
+    /vis/viewer/lightsThetaPhi     (use /vis/viewer/set/lightsThetaPhi)
+    /vis/viewer/lightsVector       (use /vis/viewer/set/lightsVector)
+    /vis/viewer/viewpointThetaPhi  (use /vis/viewer/set/viewpointThetaPhi)
+    /vis/viewer/viewpointVector    (use /vis/viewer/set/viewpointVector)
+  (See geant4/source/visualization/README.built_in_commands for list
+  of current commands.)
+- Tidied guidance for /vis/viewer/set.
+- Included opengl-V06-02-03 (cosmetic).
+
+14th July 2004  John Allison  (vis-V06-02-00)
+- opengl-V06-02-02 and vistest-V06-02-01:
+  Hidden line *and/or* hidden surface removal now work for OGL*X and OGL*Xm.
+
+1st July 2004  John Allison
+- Correction to guidance of /vis/viewer/set/hiddenEdge.
+- Small improvement to README of /vis/scene/add/axes.
+- vistest-V06-02-00.
+- opengl-V06-02-00.
+- visman-V06-02-00: Fix for porting on gcc-3.4.0: made ProcessView()
+  public, since used as private friend (Gabriele Cosmo).
+
+9th June 2004  Gabriele Cosmo  (vis-V06-01-03)
+- Adopt G4DLLIMPORT/G4DLLEXPORT technique to handle extern simbols for
+  allowing support of DLLs on Windows.
+- Minor correction in modeling/GNUmakefile for GLOBLIBS definition.
+- Coworks with "global-V06-01-02b".
+
+7th June 2004  Gabriele Cosmo  (vis-V06-01-02)
+- Includes "vis-HepRep-V06-01-04".
+- Export extern symbols for allowing support of DLLs on Windows.
+  Modified files: G4RayTrajectory.hh, G4RayTrajectoryPoint.hh.
+- GNUmakefiles: added definition of GLOBLIBS for DLLs support on Windows.
+- Coworks with "global-V06-01-02a".
+
+9th April 2004  John Allison  (vis-V06-01-01 + interfaces-V06-01-00)
+- Tagged OpenGL as below.  Joint with interfaces-V06-01-00.
+
+7th April 2004  Guy Barrand
+- visualization/OpenGL/* : use the G4OpenGL.hh file.
+- Added : visualization/OpenGL/include/G4OpenGL.hh to encapsulate
+  the include of gl/gl.h and gl/glu.h that may be platform dependant.
+  It permits to rm some #ifdef WIN32 spread in the code. It opens also
+  the way to the usage of the Apple OpenGL on a Mac.
+
+14 March 2004 Joseph Perl (vis-V06-00-01)
+- HepRepFile handle duplicate ShowView.
+- HepRepFile improve layering and hierarchy for hits.
+
+17th February 2004  John Allison  (opengl-V06-00-00)
+- Fixed bug #581: wrong order of statements in
+  G4OpenGLXViewer::~G4OpenGLXViewer (see bug report).
+
+1st December 2003  John Allison
+- Added checks and minor improvment of behaviour at end of event and run:
+  o G4VisManager::EndOfRun: added check on MarkForClearingTransientStore.
+  o G4VisCommandsScene.cc: For "/vis/scene/endOf[Event|Run]Action refresh",
+    SetMarkForClearingTransientStore(true).
+
+27th November 2003  John Allison  (vis-V05-02-06)
+- Added /vis/scene/endOfRunAction.
+- Includes vis-HepRep-V05-02-08.
+- G4VisManager: Removed PrintAllGraphicsSystems and
+  PrintInstalledGraphicsSystems.  They are difficult to maintain and
+  are anyway not used.  (There remains PrintAvailableGraphicsSystems,
+  which is much used, and iterates over instantiated graphics systems
+  and needs no maintenance.)
+
+20th November 2003  John Allison  (vis-V05-02-05)
+- Re-submitted.  Includes vis-HepRep-05-02-07: fixes compiler issues and
+  other minor fixes.
+
+14th November 2003  John Allison  (vis-V05-02-04)
+- Includes vis-HepRep-05-02-03: new HepRep XML driver for HepRep Version 2.
+- Bug fix in G4VisManager::EndOfEvent.
+
+12th November 2003  John Allison
+- Bug in /vis/scene/add/volume: requestedDepthOfDescent now correctly
+  propagated to "world" volume.
+- modeling-V05-02-02: G4PhysicalVolumeModel: CalculateExtent always
+  searches complete hierarchy.
+- Change initialisation of G4VSceneHandler so that there is always a
+  clear on first drawing  - fMarkForClearingTransientStore(true).
+- Removed redundant code from G4VisManager::::EndOfRun.
+
+6th November 2003  John Allison  (vis-V05-02-03)
+- management:
+  o G4VisManager: improved handling of auto refresh at end of event and run.
+  o G4VisCommandsScene: improved endOfEventAction and improved guidance.
+  o GNUmakefile: rationalised.
+- GNUmakefile: removed G4LIBDIR and G4TMPDIR.
+- RayTracer/GNUmakefile: rationalised (raytracer-V05-02-04).
+- Tree: improved printing.
+- G4VRML2SceneHandlerFunc: changed const char* pv_name to G4String pv_name.
+- G4XXXViewer: improved comments.
+- modeling: GNUmakefile: rationalised (modeling-V05-02-01).
+- test: changed MyPhysicsList to follow kernel changes.
+
+4th November 2003  Gabriele Cosmo  (vis-V05-02-02)
+- Includes removal of OPACS module.
+- Includes "modeling-V05-02-00".
+
+17th October 2003  Guy Barrand
+- OPACS being (for long) deprecated, remove OPACS related things
+  in Geant4 repository.
+
+4th October 2003  Gabriele Cosmo  (vis-V05-02-01)
+- Modified GNUmakefiles:
+  o added dependency to new module "geometry/navigation".
+  o replaced "digits+hits" with "digits_hits".
+- Coworks with "geometry-V05-02-00" and "digits_hits-V05-02-00".
+
+22nd September 2003  John Allison  (vis-V05-02-00, greps-V05-02-00)
+- Incorporates raytracer-V05-02-01 (needs greps-V05-02-00) - see
+  RayTracer/History:
+  o Introduced G4VRTScanner.
+  o Added /vis/rayTracer/backgroundColour.
+- Introduced Doxygen documentation for management, OpenGL and test.
+- Improved guidance for /vis/scene/notifyHandlers.
+- OpenGL: Cosmetic change to regularise names.
+
+2nd September 2003  John Allison
+- Fixed pedantic warnings etc. in test suite - see test/History.
+
+2nd June 2003  John Allison  (vis-V05-01-01)
+- Small fix for pedantic warnings in RayTracer.
+
+30th May 2003  John Allison  (vis-V05-01-00 - does not include HepRep below)
+- Improved README.built_in_commands.  Removed unlikely-to-be-implemented
+  commands.
+- Eliminated pedantic warnings.
+
+28th February 2003  Joseph Perl
+- Minor Fix to HepRep - see History file.
+
+20th January 2003  John Allison
+- Changed "/vis/scene/add/trajectories [<drawing-mode>]" so that if
+  the command is issued more than once on any given scene, the last
+  command takes effect, i.e., so that the last value of drawing-mode
+  takes effect.
+
+17th February 2003 Satoshi Tanaka (vis-V05-00-01)
+- A Small bug fixing of VRML2 driver 
+ (Explicit cast from G4String to char* in G4VRML2SceneHandlerFunc.icc).
+
+24th January 2003  Joseph Perl
+- Fixes to HepRep - see History file.
+
+20th January 2003  John Allison  (vis-V05-00-00, co-works intercoms-V05-00-00)
+- Incorporated openinventor-V05-00-00: Removed erroneous additional
+  transformation.
+- Added G4VisManager::Draw methods for hits and trajectories.
+
+11th December 2002  John Allison  (vis-V04-01-10)
+- Fix for SUN-CC warnings: AddThis hides the virtual function...
+- Fix memory leak in RayTracer.
+- Fixed /vis/scene/add/trajectories command.
+- Some fixes in HepRep.
+
+4th December 2002  Makoto Asai (vis-V04-01-09)
+- Migration to new G4ApplicationState
+
+27th November 2002  John Allison  (vis-V04-01-08)
+- Fixes to HepRep - see History file.
+- Added RegisterGraphicsSystem (new G4HepRep) in MyVisManager.cc.
+- Fix (removal) of ambiguous G4VVisCommand::GetNewDoubleValue.
+- Added /vis/viewer/set/globalMarkerScale.
+- Improved algorithm of CompareForKernelVisit on OpenGL and OpenInventor.
+
+21st November 2002  Gabriele Cosmo  (vis-V04-01-07)
+- Corrections to HepRep module to allow porting on egcs compiler
+  (M.Donszelmann).
+- Patched access to static data in G4VisCommandsSceneAdd.cc, G4VisManager.cc
+  and G4FlavoredParallelWorldModel.cc to allow porting on Windows DLLs.
+  It requires co-working with tags "greps-V04-01-04" and "intercoms-V04-01-02".
+
+15th November 2002  Mark Donszelmann  (vis-V04-01-06)
+- HepRep2 driver implemented.
+
+11th November 2002  John Allison  (vis-V04-01-05)
+- Corrected inclusion of G4OpenGLXViewer #ifdef X_DRIVER for Windows
+  and other small changes in OpenGL (opengl-V04-01-02).
+- Added integer argument to /vis/scene/add/trajectories [drawing-mode].
+  drawing-mode is passed to DrawTrajectory.  See also modeling-V04-00-00.
+- Fixed bug in G4VisManager wich lead to zero G4VModel pointer.
+- Improved hamdling of models.
+- Corrected G4RayTracer.cc devide-by-zero (raytracer-V04-00-01).
+- VRML: bug fixing for marker size (*.icc files) (VRML-V04-01-00).
+- Samll improvements to README.built_in_commands.
+- Improved sample driver XXX.
+
+1st November 2002  John Allison (vis-V04-01-04 with...)
+geant4/source/tracking       tracking-V04-01-03
+geant4/source/intercoms      intercoms-V04-01-00
+geant4/source/graphics_reps  greps-V04-01-01
+geant4/source/digits+hits    digits+hits-V04-01-01
+
+Oct 28, 2002, J.Allison  (vis-traj03, co-works with...
+geant4/source/tracking       traj03 (head as of Tue Oct 29 15:42:14 UTC 2002)
+geant4/source/intercoms      intercoms-V04-01-00 (ditto)
+geant4/source/graphics_reps  greps-V04-01-01 (ditto)
+geant4/source/digits+hits    hits-traj03 (*not* the head)
+- Changed G4XXXSceneHandler.cc for map of G4AttDefs, and improved.
+
+17th October 2002  John Allison (vis-V04-01-03 with...)
+- Coworking tags are:
+    geant4/source/tracking       traj02
+    geant4/source/intercoms      intercoms-V04-00-04
+    geant4/source/graphics_reps  greps-V04-01-00
+    geant4/source/digits+hits    hits-traj02
+- More changes for AddThis(const G4VTrajectory&) and (const G4VHit&).
+- Minor corrections to warning messages, etc.
+- Improved end of run behaviour for non-post-processing graphics
+  systems by changing false to true in G4VisManager::EndOfRun
+  fpSceneHandler->SetMarkForClearingTransientStore(true);
+- Further corrections/improvements in OpenGLWin32 - not yet complete.
+
+17th October 2002  John Allison (vis-V04-01-02 with intercoms-V04-01-00)
+- Added two new pure virtual functions to G4VGraphicsScene:
+    AddThis(const G4VTrajectory&)
+    AddThis(const G4VHit&)
+
+16th October 2002  John Allison  (vis-traj01 co-works with tracking tag traj01)
+- Tag for changes in G4VTrajectory, etc. (raytracer-V04-00-00).
+
+16th October 2002  John Allison  (vis-V04-01-01)
+- Fix for WIN32.  Now compiles but viewer not implemented.  (opengl-V04-01-01)
+- Small improvement to README.built_in_commands.
+
+1st Sept 2002  Satoshi Tanaka  (vis-V04-01-00)
+- Precision control of g4_XX.prim files generated by 
+  the DAWNFILE/DAWN-Network drivers. 
+
+   Example:
+     setenv  G4DAWNFILE_PRECISION   9
+
+  The precision number is used as:
+
+      sprintf( string, "%*.*g", (precision+8), precision, value)
+
+  The default precision is also changed from 6 to 9.
+
+24th June 2002  John Allison
+- Further cosmetic changes in G4OpenGL for DEC compiler (opengl-V04-01-00).
+
+24th June 2002  Gabriele Cosmo  (vis-V04-00-10)
+- Exclude latest changes to OpenGL driver (opengl-V04-00-03), causing compilation
+  errors on some platforms (DEC-cxx).
+
+23th June 2002  Satshi Tanaka  (vis-V04-00-09)
+- Bug fixes in G4VRMLXFileSceneHandlerFunc.icc
+- Protection of VRML-Newtork drivers for Windows platform.
+  (The compilation is skipped in the Windows platform.)
+
+19th June 2002  John Allison  (vis-V04-00-08)
+- Cosmetic changes in G4VRML2FileSceneHandler.cc and G4VRML2SceneHandler.cc
+  (Gabriele)
+
+10th June 2002  John Allison
+- Cosmetic changes for SUN-CC in G4OpenGLXmConvenienceRoutines.cc
+  (opengl-V04-00-03).
+- Improvement to /vis/scene/add/logicalVolume guidance.
+
+6th June 2002  John Allison
+- Cosmetic changes for GNU compiler in G4OpenGLXViewer.cc (opengl-V04-00-02).
+
+8th May 2002  John Allison (vis-V04-00-07)
+- Minor changes to warning messages and README.built_in_commands.
+- Added test fro G4EllipticalTube to test/src/MyDetectorConstruction.cc.
+
+1st May 2002  John Allison (vis-V04-00-06)
+- Deprecated /vis/viewer/set/autoRefresh.
+
+26th April 2002  Makoto Asai (vis-V04-00-05)
+- Corresponds to the changes in intercoms-V04-00-00
+- Affected files :
+   G4VisManager.cc G4VisCommandsViewer.cc G4VisCommandsCompound.cc
+
+22nd April 2002  John Allison (vis-V04-00-04)
+- Prevent copying of autoRefresh status with /vis/viewer/set/all command.
+- Corrected out of date advice about /vis/set/culling, etc.
+- Workaround for pseudo-parallel/orthogonal projection in Ray Tracer.
+
+28th February 2002  John Allison (vis-V04-00-03)
+- Updated OpenGL to compile (but not run) on Windows (opengl-V04-00-01).
+- Removed redundant code in GNUmakefiles in OPACS, OpenGL, OpenInventor, VRML.
+- Improved README.adding_graphics_system.
+
+23rd February 2002  John Allison (vis-V04-00-02)
+- Bug fix in modeling, which was causing nested calls to Begin/EndPrimitives.
+
+4th February 2002  Joseph Perl  (vis-V04-00-01)
+- HepRep: Check for missing hierarchy layers in HepRepXMLWriter.
+  (Not strictly needed since have a culled layer check in SceneHandler,
+  but may be useful in other applications of HepRepXMLWriter).
+
+3rd February 2002  Joseph Perl
+- HepRep: Detect transient data by testing for
+  !fpCurrentPV || fReadyForTransients
+  rather than just fReadyForTransients
+
+1st February 2002  Joseph Perl
+- Improvements to HepRep:
+- Defer file opening until first real HepRepType is to be written.
+- Moved HepRep code from AddThis to AddPrimitive.
+- Add additional levels to hierarchy if any appear to have been
+  removed by culling.
+- Add visibility attribute.
+
+29th January 2002  Joseph Perl
+- Relocate HepRep file-opening logic to constructor and ShowView
+  (had been in SetView).
+
+28th January 2002  vis-V03-02-23 Joseph Perl
+- Improvements to HepRep:
+- Produce hierarchical output rather than flat HepRepType structure.
+- Handle trajectories as well as detector geometry.
+- Output files now named G4Data<n>.heprep where n increments with each open.
+
+14th January 2002  vis-V03-02-22 Joseph Perl
+- Corrected handling for already open file in HepRepXMLWriter.
+
+01th December 2001 vis-V03-02-21 Satoshi Tanaka
+- Code refinements in FukuiRenderer/ directory:
+  * Noisy warnings for Linux-g++ are suppressed.
+    (%lg ==> %g etc)
+  * G4FRSceneFunc.icc is moved from /src to /include
+
+29th November 2001  John Allison
+- Fixed some pedantic warnings and a bug thrown up by such in OpenGL.
+
+28th November 2001  Gabriele Cosmo (visman-V03-02-00 in management only).
+- Fixed pointer initialisation for porting on VC++ in G4VisCommandsSceneAdd.cc.
+
+21st November 2001  John Allison  (vis-V03-02-20)
+- Fixed G4std bug in G4HepRepFileSceneHandler.hh.
+- Fixed "hides the virtual function" warnings from G4HepRepFileSceneHandler.
+- Change to comments in G4XXXSceneHandler.hh.
+
+19th November 2001  John Allison  (vis-V03-02-19 needs config-V03-02-09+)
+- Cosmetic changes to HepRep.
+
+16th November 2001  John Allison
+- Added G4XXXDEBUG to XXX dummy system.
+
+14th November 2001  John Allison
+- Fixed bug in G4VisManager::EndOfEvent.
+- Moved code from G4VisManagerRegisterMessengers.cc to G4VisManager.cc and
+  removed G4VisManagerRegisterMessengers.cc.
+
+14th November 2001  Guy Barrand
+- OpenInventor : move HEPVis/SoWindow under vis/OpenInventor/G4SoWindow
+  to prepare HEPVis/6.0. (HEPVis/SoWindow will disappear from HEPVis/6.0).
+
+14th November 2001  John Allison
+- Added README.built_in_commands.
+
+13th November 2001  Satoshi Tanaka
+- visualization/README file is updated, adding minimal description
+  on the HepRepFile driver. 
+
+12th November 2001  John Allison  (vis-V03-02-18 needs config-V03-02-09)
+- Fixed some warnings and one error from gcc-2.95.2.
+- HepRep Type names now come from Physical Volume names (Joseph Perl).
+- Added many HepRep Attributes for other volume properties (Joseph Perl).
+
+13th Nov 2001 (JST)  Hajime Yoshida and Minamimoto (vis-V03-02-17)
+- Updation of G4RTJpegMaker.cc for Windows platform (raytracer-V03-02-01). 
+
+7th November 2001  John Allison  (vis-V03-02-16 needs config-V03-02-09)
+- Corrected compilation error.
+
+6th November 2001  John Allison  (vis-V03-02-15 needs config-V03-02-09)
+- Added /vis/viewer/flush = refresh + update.
+- Moved /vis/viewer/lights and viewpoint to /vis/viewer/set.
+- Added /vis/viewer/set/upThetaPhi and upVector.
+- Added refresh|flush option to /vis/scene/notifyHandlers.
+- Moved HepRepFile classes to HepRep/ directory and removed HepRep classes
+  therein.
+
+1st October 2001  Joseph Perl
+- Added first version of pure C++ HepRep driver, HepRepFile.
+  See HepRep/README for details.
+
+10th September 2001  John Allison  (needs greps-V03-02-04)
+- (Non-standard tag JA-RAEOE.) 
+
+10th September 2001  John Allison  (not tagged but needs greps-V03-02-04)
+- Added BeginOfRun, BeginOfEvent and EndOfRun to G4VisManager, invoked via
+  G4VisStateDependent.
+- Improved handling of refresh-at-end-of-event.  All scene handlers need to
+  implement ClearTransientStore and ensure rebuilding of permanent store if
+  necessary.
+- Auto-refresh (notifyHandlers) after attaching scene.
+- Changed default colour of scale to red and fixed a couple of small bugs in
+  the implementation of AddPrimitive(G4Scale).
+- Improved verbosity guidance.
+- Improved /vis/scene/add/scale guidance (needs greps-V03-02-04).
+- Removed /vis/viewer/refresh from compound commands.
+- Capitalised 'R' in /vis/viewer/set/autoRefresh.
+
+29th August 2001  John Allison/Joseph Perl  (vis-V03-02-14)
+- Needs config-V03-02-06.
+- First developers release of HepRep graphics driver.
+
+24th August 2001  Joseph Perl  (vis-V03-02-13-00)
+- First inclusion of HepRep graphics driver.
+
+24th August 2001  John Allison  (vis-V03-02-13)
+- Fixed bugs in G4VisManager::GeometryHasChanged.
+- Separated out G4Scene::CalculateExtent.
+- Improved robustness and timeliness of invocation of some commands.
+- Improved READMEs.
+- Reduced warnings from OpenGL - see OpenGL/History.
+- Cosmetic changes to test.
+- Added explicit invocation of base class methods to avoid warnings about
+  hiding of base class methods.
+
+17th August 2001  John Allison  (vis-V03-02-12)
+- Coworks with greps-V03-02-02 and intercoms-V03-02-04.
+- Added G4VisManager::Draw(const G4Scale&,...  Needs intercoms-V03-02-04.
+- Added template graphics system XXX.
+- Improved verbosity guidance.
+
+14th August 2001  John Allison  (vis-V03-02-11)
+- Coworks with greps-V03-02-02 and intercoms-V03-02-03.
+- Moved default value G4Transform3D::Identity of argument from
+  G4VSceneHandler::BeginPrimitives to
+  G4VGraphicsScene::BeginPrimitives.  Needs intercoms-V03-02-03.
+- Fixed bug in G4VSceneHandler::AddPrimitive(const G4Scale&).  Needs
+  greps-V03-02-02.
+- Added sceneHandler.Begin/EndPrimitives messages to models (long
+  standing bug!).
+- Removed "dummy" graphics systems in G4VisManager.cc.
+- Improved robustness of some commands, particularly
+  /vis/scene/notifyHandlers.
+- Improved support for multiple viewers (but see OpenGL/History).
+
+11th August 2001  John Allison  (vis-V03-02-10-01)
+- Implemented /vis/scene/endOfEventAction.
+
+9th August 2001  John Allison  (vis-V03-02-10-00)
+- Note: non-standard tag to indicate internal use only.
+- Added /vis/scene/create at start of compound command /vis/open to avoid
+  warnings.
+- Removed G4ModelingParameters::hierarchy.  It is no longer used.  The
+  textual or graphical representation of the geometry hierarchy is now
+  done in G4xxxTree classes in visua;ization/Tree.
+- Removed /vis/scene/notifyHandlers from
+  G4VVisCommandScene::UpdateVisManagerScene - too much updating going on.
+  It was leading to recursive refreshing/updating.
+- Implemented auto-refresh at end of event.  (See also OpenGL/History.)
+  Introduced G4VSceneHandler::Get/SetMarkForClearingTransientStore for
+  postponed (lazy) clearing of transients (e.g., trajectories) from store
+  (graphical database) and view.  The mark is set at the end of
+  G4VisManager::EndOfEvent and the actual clearing is done in:
+    void G4VisManager::ClearTransientStoreIfMarked(){
+      // Assumes valid view.
+      if (fpSceneHandler->GetMarkForClearingTransientStore()) {
+        fpSceneHandler->SetMarkForClearingTransientStore(false);
+        fpSceneHandler->ClearTransientStore();
+      }
+    }
+  which is called at the start of each G4VisManager::Draw and the beginning
+  of G4VisManager::EndOfEvent.  Thus the picture stays from the end of all
+  drawing for the event until the first drawing of the next event.
+    
+5th August 2001  John Allison
+- Small refinements to printing under new verbosity control.
+
+4th August 2001  John Allison  (vis-V03-02-10)
+- Re-implemented verbosity control.  Output statements wherever possible
+  are controlled by the verbosity in a simple graded message scheme:
+    enum Verbosity {
+      quiet,         // Nothing is printed.
+      startup,       // Startup and endup messages are printed...
+      errors,        // ...and errors...
+      warnings,      // ...and warnings...
+      confirmations, // ...and confirming messages...
+      parameters,    // ...and parameters of scenes and views...
+      all            // ...and everything available.
+    };
+  Note that the G4VisManager member object name and type have changed:
+    Verbosity             fVerbosity;  // New.
+    const G4int           fVerbose;
+    // fVerbose is kept for backwards compatibility for some user
+    // examples.  (It is used in the derived user vis managers to print
+    // available graphics systems.)  It is initialised to 1 in the
+    // constructor and cannot be changed.
+
+3rd August 2001  John Allison
+- Added README.quick, a quick installation guide.
+
+30th July 2001  John Allison  (vis-V03-02-09)
+- Eliminated view parameters from G4VisManager.  Now, each view maintains its
+  own parameters.  Can be copied from one view to another with:
+    /vis/viewer/set/all <from-viewer-name>
+    Copies view parameters from from-viewer to current viewer.
+    Affects current viewer.
+- Removed redundant methods from G4VisManager, mostly to do with old-style
+  commands.
+
+27th July 2001  John Allison  (vis-V03-02-08)
+- Needs config-V03-02-01.
+- Introduced environment variable G4VIS_NONE that, if set, no visualization
+  drivers are built and no vis libraries are built, not even
+  libG4vis_management.  (libG4modeling is still built.)  The C-pre-processor
+  variables G4VIS_BUILD and G4VIS_USE are *not* set.
+- Removed the need to specify environment variables for visualization drivers
+  which do not need external packages or libraries, namely :
+      G4VIS_BUILD_DAWNFILE_DRIVER
+      G4VIS_BUILD_RAYTRACER_DRIVER
+      G4VIS_BUILD_VRMLFILE_DRIVER
+      G4VIS_BUILD_ASCIITREE_DRIVER
+      G4VIS_BUILD_GAGTREE_DRIVER
+    with associated G4VIS_USE environment variables:
+      G4VIS_USE_DAWNFILE
+      G4VIS_USE_RAYTRACER
+      G4VIS_USE_VRMLFILE
+      G4VIS_USE_ASCIITREE
+      G4VIS_USE_GAGTREE
+  For backwards compatibility, unless G4VIS_NONE is set, the corresponding
+  C-pre-processor variables are automatically set.  Also, the C-pre-processor
+  variables G4VIS_BUILD and G4VIS_USE are set.
+- As before, environment variables for other drivers still need positive
+  setting of their G4VIS_BUILD and G4VIS_USE environment variables.  In this
+  category are:
+      G4VIS_BUILD_DAWN_DRIVER
+      G4VIS_BUILD_OPACS_DRIVER
+      G4VIS_BUILD_OPENGLX_DRIVER
+      G4VIS_BUILD_OPENGLWIN32_DRIVER
+      G4VIS_BUILD_OPENGLXM_DRIVER
+      G4VIS_BUILD_OIX_DRIVER
+      G4VIS_BUILD_OIWIN32_DRIVER
+      G4VIS_BUILD_VRML_DRIVER
+    with associated G4VIS_USE environment variables:
+      G4VIS_USE_DAWN
+      G4VIS_USE_OPACS
+      G4VIS_USE_OPENGLX
+      G4VIS_USE_OPENGLWIN32
+      G4VIS_USE_OPENGLXM
+      G4VIS_USE_OIX
+      G4VIS_USE_OIWIN32
+      G4VIS_USE_VRML
+  In this case G4VIS_NONE must *not* be set.
+- Fixed unchecked pointer in G4VSceneHandler::ClearStore().
+
+25th July 2001  John Allison  (vis-V03-02-07)
+- Improved access to models (modeling-V03-02-03).
+- Made G4VSceneHandler::fpModel non-const G4VModel* for convenience.
+- Improved checks and warning messages in /vis/scene/add/scale.
+
+24th July 2001  John Allison  (vis-V03-02-06)
+- Needs greps-V03-02-01 for small interface change to G4Scale.
+- Includes modeling-V03-02-02.
+- Force rebuild of graphics "stores" (graphical databases) and, if
+  auto-refresh is true, refresh of all views
+  (/vis/scene/notifyHandlers) after an addition to scene.
+- Improvements to /vis/scene/add/scale:
+  o Added colour.
+  o Assigned a genuine extent.
+
+23rd July 2001  John Allison  (vis-V03-02-05 is non existent - sorry!!!)
+- Improved /vis/scene/add/scale.
+- Improved auto-refreshing.
+
+21st July 2001  John Allison  (vis-V03-02-04)
+- Added /vis/scene/add/scale.  Needs greps-V03-02-00 and intercoms-V03-02-02.
+
+19th July 2001  Satoshi Tanaka  (vis-V03-02-03)
+- Modification of G4DAWNFILEViewer.cc
+- PostScript command "showpage" is always added to g4_XX.eps
+  so that it is printable. (It can also be inserted into
+  LaTeX documents.
+
+18th July 2001  John Allison  (vis-V03-02-02)
+- Ensured rotation and translation of replica is restored (modeling-V03-02-00)
+  (fixes crashes in replica tracking).
+
+14th July 2001  John Allison  (vis-V03-02-01)
+- Included raytracer-V03-02-00 (minor cosmetics).
+- Minor changes in G4OpenGLXViewer.cc to eliminate pedantic ISO C++ warnings.
+- Merged vis-V03-02-patch01 (below) to head.
+- Included new disclaimer.
+
+14th July 2001  John Allison (vis-V03-02-patch01 in branch geant4-03-02-branch)
+- Fixed crash in optimised mode: added Initialise() to viewers so
+  that windows are opened after viewers are fully constructed.
+
+10th July 2001  John Allison  (vis-V03-02-00)
+- Removed old-style commands.
+- Removed maintenance of G4VisManager's G4ViewParameters object (this
+  will be removed soon).
+- Merged vis-V03-02-patch00 (below) to head.
+
+10th July  John Allison  (vis-V03-02-patch00 in branch geant4-03-02-branch)
+- Corrected mistake which could cause crash if user specified a non-
+  existent scene handler in /vis/sceneHandler/remove.
+
+19th June 2001  Satoshi Tanaka (vis-V03-01-07)
+-OS dependence is removed from the DAWN-network driver.
+ * gethostname() removed
+ * G4SocketConfig.hh and G4SocketMacro.hh are removed.
+- Now "setenv G4DAWN_HOST_NAME hostname" is mandatory to use 
+  the DAWN-network driver.
+
+15th June 2001  John Allison
+- Added GAGTree to G4VisManager.cc, MyVisManager.cc.  Need corresponding
+  changes in config.
+
+15th June 2001  John Allison (vis-V03-01-06)
+- Added 2nd template argument (less) to sets in G4ASCIITreeSceneHandler and
+  G4GAGTreeSceneHandler.
+
+15th June 2001  Satoshi Tanaka (vis-V03-01-05)
+- The  first committing of GAGTree driver.
+- Other files in ./Tree/ are the same as vis-V03-01-04.
+
+5th June 2001  John Allison (vis-V03-01-04)
+- Moved re-useable code from G4ASCIITree to G4VTree.
+- Made sure all pointers in G4VisManager are initialised on construction.
+
+4th June 2001  John Allison
+- G4ASCIITree: Added logical volume name and solid name and type under
+  verbosity control.
+- G4ASCIITree: Forced culling off so that all volumes are seen, even if
+  "invisible".
+
+29th May 2001  John Allison
+- Small clean up in test directory.
+
+25th May 2001  John Allison
+- Bug fix in G4ASCIITree.cc: initialise fVerbosity(0).
+
+24th May 2001  John Allison  (vis-V03-01-03)
+- Added missing files G4ASCIITreeMessenger.hh/cc.
+- Bug fix in G4ASCIITreeMessenger.cc: currentAsDefault = true.
+- Drivers in alphabetical order in MyVisManager.cc.
+
+23rd May 2001  John Allison
+- Eliminated Linux pedantic warnings, except FukuiRenderer, VRML and OPACS.
+
+22nd May 2001  John Allison
+- Refined ASCIITree.
+
+21st May 2001  John Allison (vis-V03-01-02)
+- Minor bug corrections (mostly to fix things that used to work with the
+  old /vis~/ commands but ceased to work with the new /vis/commands:
+  o If a scene is empty at drawing time, the "world" is added.
+  o Window size hint now works for OpenGL.
+- Fixed some minor warnings for strict C++ (size_t, etc.).
+
+18th May 2001 John Allison
+- Removed unnecessary virtual inheritance of G4VViewer in G4RayTracerViewer.
+- Introduced verbosity to ASCIITree.
+- Proper deletion of directories in G4VisManagerRegisterMessengers.
+
+15th May 2001 John Allison
+- Fixed bug in name of /vis/viewer/set/sectionPlane command.
+
+3rd May 2001 John Allison (vis-V03-01-01)
+- Changes for greps-V03-01-01 (elimination of RW).
+- Improvements in /vis/scene/add/volume.
+- Added /vis/drawTree.
+
+10th April 2001  John Allison (vis-V03-01-00)
+- Added two new commands:
+    /vis/scene/add/text
+    /vis/scene/add/axes
+- Added first version of ASCIITree to dump geometry hierarchy to
+  standard output as ASCII stream.
+  This requires two new environment variables:
+    G4VIS_BUILD_ASCIITREE_DRIVER
+    G4VIS_USE_ASCIITREE
+  and config-V03-01-00.
+
+2nd April 2001  John Allison
+- Tidied OpenGL (opengl-V03-00-01) - see OpenGL/History.
+
+2nd April 2001  John Allison  (vis-V03-00-09)
+- Fixed some warnings from DEC cxx.
+
+15th March 2001  John Allison  (vis-V03-00-08)
+- Changed rotation of phi-replicas in G4PhysicalVolumeModel.cc to
+  ensure correspondence with rule that phi=0 bisects the replica.
+  WARNING: Prior to this fix the graphics did NOT correspond to the
+  replica navigation.  If you have been relying on the graphics to
+  position daughter volumes in a phi-replica, navigation will have
+  been incorrect, possibly without causing a crash.  The above fix
+  will change the apparent position as shown by the graphics and you
+  will have to correct the positioning of daughters.  Make sure the
+  diaghters are all properly enclosed within the replica.  Graphics
+  and navigation now correspond,
+
+7th March 2001  John Allison  (vis-V03-00-07)
+- Cosmetic corrections for ISO compliance.
+
+23rd February 2001  John Allison  (vis-V03-00-06)
+- Removed all references to RogueWave.
+
+4th February 2001  John Allison  (vis-V03-00-05)
+- Reverted to /vis/viewer commands updating vis manager's view parameters.
+  Otherwise this can have a big effect on users if old commands are still
+  being used.  Let's schedule this change for the next version of Geant4.
+- Added the following new commands:
+  /vis/enable [true|false]
+  /vis/disable
+  /vis/verbose [<verbosity-integer>]
+  /vis/viewer/set/lineSegmentsPerCircle  [<number-of-sides-per-circle>]
+  /vis/viewer/set/sectionPlane ...
+  Only /vis/scene/add/text and /vis/scene/add/axes to go!!!
+
+4th February 2001  John Allison  (vis-V03-00-04)
+- /vis/viewer commands no longer update vis manager's view parameters.
+- Most /vis~/ copmmands give DEPRECATED warning, except:
+  /vis~/draw/axes
+  /vis~/draw/text
+  /vis~/set/section_plane
+  /vis~/set/sides
+  /vis~/set/verbose
+  which have still to be re-implemented.  All /vis~/ commands are still
+  available through /vis/ for the time being.  (Window size hint no longer
+   works.)
+- Added "auto refresh" to view parameters.
+- Added "default" view parameters to viewers.
+- Made OpenGL viewers "auto refresh" by default.
+- Added:
+  /vis/viewer/set/autoRefresh
+  /vis/viewer/set/projection
+- Added compound command:
+  /vis/drawView [<theta-deg>] [<phi-deg>]
+                [<pan-right>] [<pan-up>] [<pan-unit>]
+                [<zoom-factor>]
+                [<dolly>] [<dolly-unit>]
+
+4th February 2001  John Allison  (vis-V03-00-03)
+- Added several new vis commands:
+  /vis/viewer/dolly
+  /vis/viewer/dollyTo
+  /vis/viewer/lightsThetaPhi
+  /vis/viewer/lightsVector
+  /vis/viewer/pan
+  /vis/viewer/panTo
+  /vis/viewer/viewpointThetaPhi
+  /vis/viewer/viewpointVector
+  /vis/viewer/zoom
+  /vis/viewer/zoomTo
+  /vis/viewer/set/hiddenMarker
+  /vis/viewer/set/lightsMove
+
+3rd February 2001  John Allison  (vis-V03-00-02)
+- Tidied for CodeWizard.  Small changes to many files in management, modeling
+  and OpenGL.
+
+1st February 2001  John Allison  (vis-V03-00-01)
+- Fixed cause of crash when setting viewpoint before creating scene (Bug #157).
+  Solution: SetView no longer called when view parameters are changed.  In
+  any case it's called just before drawing, whixh is the right place.
+- Fixed /vis/set/sides problem (Satoshi Tanaka) (Bug #204).
+  Solution: Update view's view parameters in /vis/set/sides - had somehow
+  been overlooked.
+
+25th January 2001  John Allison
+- Added protection against empty G4Polyhedron objects.
+   FukuiRenderer/src/G4FRSceneFunc.icc
+   OPACS/src/G4GoSceneHandler.cc
+   OpenGL/src/G4OpenGLSceneHandler.cc
+   OpenInventor/src/G4OpenInventorSceneHandler.cc
+   VRML/src/G4VRML1SceneHandlerFunc.icc
+   VRML/src/G4VRML2SceneHandlerFunc.icc
+
+25th January 2001  John Allison  (opengl-V03-00-00)
+- Fixed Bug #120.  Implemented running re-calculation of up-vector in
+  the case of "object rotation" (lights move with camera) to prevent
+  "flipping" of view when camera passes through up-vector.  Note that
+  the default is "camera rotation" (lights do not move with camera,
+  i.e., remain fixed relative to object) so the default is that this
+  "flipping" can happen.  To set "object rotation" (lights move with
+  camera) use /vis/lights/move_with_camera true (soon to be
+  /vis/viewer/set/lights move-with-camera) or click "Object" radio
+  button on Rotation Panel in OpenGLXm mode.
+- Changed some objects to references for efficiency.  E.g.:
+  const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
+
+18th January 2001  John Allison
+- Corrected G4PhysicalVolumeModel.  This corrects a bug whereby the
+  requested drawing of a physical volume and its decendants starting
+  at a depth greater than 2 was incorrectly positioned on the screen.
+- /vis/scene/include commands withdrawn - use equivalent commands
+  /vis/scene/add.
+- OpenGL: cosmetic and minor performance improvements.
+
+16th January 2001  John Allison  (vis-03-00-00)
+- All vis commands "available" in all G4 states.
+- Other small cosmetic changes to commands.
+- OpenGL: square and circle markers correctly rendered.
+  Note: subsequent rotations in stored mode also rotate these markers.
+- Some small changes to test  - see test/History.
+
+2nd November 2000  Gunter Folger  (vis-V02-00-02)
+- Added targets includes and clean_libs to visualization/GNUmakefile.
+
+18th October 2000  John Allison  (vis-V02-00-01)
+- G4PhysicalVolumeModel: protected against volumes without material.
+- Removed /vis/viewer/update from compound commands /vis/drawVolume
+  and /vis/specify.
+- Updated comments in G4VisManagerRegisterMessengers.cc.
+
+19th August 2000  John Allison  (vis-V02-00-00)
+- Fixed bug in /vis/lights/direction - now does not refresh view.
+- Corrected "scene" where it should read "scene handler" in some
+  comments and output statements.
+
+3rd July 2000  John Allison
+- Explicitly initialised all data members of G4ViewParameters in constructor.
+
+9th June 2000  John Allison  (vis-V01-01-06)
+- Tagged for system testing.
+
+8th June 2000  Guy Barrand
+- OPACS/src/G4GoSceneHandler.cc : correct polyhedron 
+  wire-frame in order to remove some edges. Now the
+  rendering is the same than for OpenGL driver.
+   This was requested for long by ALICE, and had been
+  requested for ATLAS by Gaston Parrour recently.
+
+7th June 2000  John Allison
+- /vis/viewer/update preferred, synonym /vis/viewer/show deprecated.
+
+7th June 2000  Makoto Asai
+- Fix the flip view of RayTracer.
+
+2nd June May 2000  John Allison
+- Forced /control/verbose 2 for compound commands.
+
+20th May 2000  John Allison
+- Bug fix in G4PhysicalVolumeModel for replicas (Guy Barrand).
+
+26 May 2000  Guy Barrand
+- management/src/G4VisCommandsScene.
+  Protect against a null pointer for aScene in NotifyHandlers::SetNewValue.
+- OPACS/src/G4WoViewer.cc :
+  Change camera name checking so that a viewer created
+  by the GUI (Wo) could be hooked.
+- OPACS/src/G4GoSceneHandler.cc :
+  Change circle rendering.
+- OpenInventor/G4OpenInventorSceneHandler : protect against null pointers.
+
+22nd May 2000  John Allison  (vis-V01-01-05)
+- Many bug fixes from in OpenGL (opengl-V01-01-00) - see OpenGL/History.  Main
+  features:
+  o workaround for bug in Mesa which slowed OpenGLXm (Guy Barrand).
+  o multiple OpenGLXm windows no longer cause crash on exit (Guy).
+- modeling-V01-01-00: Added G4VTreeGraphicsScene (DTREE).
+- G4Scene::IsEmpty if empty of RunDurationModels - VisManager adds world in
+  this case.
+
+18th/19th May 2000  John Allison
+- Introduced some /vis/viewer/set commands.
+- /vis/scene/include/trajectories changed to /vis/scene/add/trajectories.
+  Similarly hits.  (Old commands kept but deprecated.)
+- G4ViewParameters.cc: bug fix in density culling printing.
+- G4VisCommandsSceneHandler.cc: bug fix in /vis/sceneHandler/create.
+- G4VisManagerRegisterMessengers.cc: improved comments.
+
+18th May 2000  John Allison  vis-V01-01-04
+- Included DAWN-V01-01-04: Automatic filename incrementation is made default.
+
+15th May 2000  John Allison
+- Added compound commands /vis/open, /vis/drawVolume and /vis/specify.
+- /vis/viewer/reset now resets *all* view parameters.
+- Fixed double application of transformation in /vis/scene/add/volume.
+- Fixed verbosity parameter in /vis/scene/list.
+- Made G4BoundingSphereScene::PreAddThis non-inline.
+
+13th May 2000  John Allison
+- Redefined current target point to be *relative* to standard target point.
+  (No longer necessary to initialize current target point in G4VViewer
+  constructor.  The fix of 4th May is reversed.)
+
+11th May 2000  Satoshi Tanaka vis-V01-01-03
+- In G4DAWNFILEViewer.cc, 
+  <       strcpy( fPSViewer, "ghostview" );
+  ---
+  > //    strcpy( fPSViewer, "ghostview" );
+  >       strcpy( fPSViewer, "gv" );
+
+
+4th May 2000  John Allison
+- Tidied comments in G4VisManagerRegisterMessengers.cc.
+- Initialize current target point in G4VViewer constructor.
+- Re-implemented /vis/viewer/reset to change view parameters of
+  viewer directly.
+
+2nd May 2000  John Allison  vis-V01-01-02
+- Added /vis/viewer/reset.
+- G4VSceneHandler, G4VViewer, G4OpenGLXmMainMenubarCallbacks: corrected
+  some name anomolies - "scene" was still being used in places where it
+  meant "scene handler".
+- G4VViewer: added GetShortName(), corrected SetName(...).
+- G4ViewParameters.hh: improved class description.
+- G4VisManager: added ViewerShortName(...) and GetViewer(...) utilities.
+- G4RayTracer: set out-of-world ray to black.
+- G4RayTracerViewer: corrected trapping of orthogonal projection.
+- Some minor enhancements to tests.
+
+27th April 2000  Gabriele Cosmo
+- Removed unnecessary #include "G4Transform.hh" from VRML.  (Since
+  geometry-V01-01-02 G4Transform.hh no longer exists.)  
+
+27th April 2000  John Allison
+- Updated README file.
+
+12th April 2000  John Allison  vis-V01-01-01
+- Made G4PhysicalVolumeModel::DescribeSolid virtual.
+- G4PhysicalVolumeModel::DescribeSolid no longer deals with composite
+  solids - now programmed into CompositeSolid::CreatePolyhedron, where
+  CompositeSolid means G4IntersectionSolid, G4SubtractionSolid and
+  G4UnionSolid.
+- G4PhysicalVolumeModel::DescribeSolid no longer deals with displaced
+  solids - now programmed into G4DisplacedSolid::CreatePolyhedron.
+- Added G4LogicalVolumeModel::DescribeSolid, which explicitly adds
+  components of composite solids as white forced-wireframe objects.
+- Removed unnecessary #includes from G4VSceneHandler.hh which required
+  consequent inclusion in many other scene handlers and viewers.
+
+7th April 2000  John Allison  vis-V01-01-00
+- Modified GNUmakefiles for restructured geometry.
+
+29th February 2000  John Allison  vis-V01-00-06
+- Changed `char*' to `const char*' in G4FRClientServer::Err(...).
+
+28th February 2000  John Allison
+- Cosmetic improvements to G4RayTracerSceneHandler.hh and G4RayTracerViewer.hh.
+
+24th February 2000  John Allison
+- Minor inmprovement of messages from /vis/viewer/refresh.
+- Cosmetic tidying in G4OpenGLViewer.cc.
+- Added protection for null viewer in G4RTSteppingAction.cc and
+  G4RayTrajectory.cc.
+- Corrected for zoom, etc., in G4RayTracerViewer.cc.
+
+23rd February 2000  John Allison
+- Added G4RayTracerSceneHandler and Viewer.
+- Some modifications to other RayTracer routines for vis compliance.
+- (Note: headAngle still not right - ray traced views are sometimes tipped.)
+
+23rd February 2000  John Allison  vis-V01-00-05
+- Includes raytracer-V01-00-01a which is original version plus fixes for
+  ISO compliance.
+
+21st February 2000  John Allison
+- /vis/viewer/refresh no longer invokes ShowView().
+- G4VViewer: introduced data member fShortName.
+- Added G4RTSteppingAction and G4RayTrajectory to list of G4VisManager's
+  friends.
+- Improved G4VisManager::CreateSceneHandler() and CreateViewer() and
+  handling of error in G4VisCommandSceneHandler::Create() and
+  G4VisCommandViewer::Create().
+- OpenGL: char* becomes const char*.  Small output text improvement.
+- test: some changes for Ray Tracer.  Boolean intersection instead of union.
+
+02 February 2000  Guy Barrand
+- OPACS/src/G4XoViewer.cc : change WaitForNotify signature to 
+  be able to compile with DEC-cxx 6.1.
+
+vis-V01-00-04 29th January 2000  Satoshi Tanaka
+- CVS tag is assigned to the Makoto's committing below.
+
+29th January 2000  Makoto Asai
+- Introduction of G4RayTracer (visualization/RayTracer/...)
+- Migration of G4RayTracer
+  affected files :
+    visualization/GNUmakefile
+    visualization/management/include/MyVisManager.cc
+    visualization/management/src/G4VisManager.cc
+  affected files in other directory :
+    config/G4VIS_BUILD.gmk
+    config/G4VIS_USE.gmk
+
+vis-V01-00-03  17th January 2000  John Allison
+- Added protection for no voxelisation in G4LogicalVolumeModel.cc.
+- Changed endl to G4endl in G4VisCommandsViewer.cc and G4GoSceneHandler.cc.
+
+14th January 2000  John Allison
+- Added protection for no viewer in G4VisCommandsViewer.cc.
+
+vis-V01-00-02  11th January 2000  John Allison
+- General handling of displaced solid (G4PhysicalVolumeModel).
+- Introduced /vis/viewer/show (/vis/viewer/update is synonym).
+- Improved printing in /vis/camera/reset.
+
+vis-V01-00-01  27th December 1999  Satoshi Tanaka
+- VRML-V01-00-00 27th December 1999  Satoshi Tanaka
+- G4endl ==> "\n" for fDest objects ... for ISO standard C++ compiler
+
+vis-V01-00-00  16th December 1999  John Allison
+- (Note: NOT FOR SYSTEM TESTING - this tag still has problems with
+   displaying logical volumes and text.)
+- Added /vis/viewer/refresh.
+- Rationalised command lists for keeping parameter lists up to date,
+  G4VVisCommand::sceneNameCommands, etc.
+- Added AddThis(const G4Polycone&), etc., to prevent hiding warnings.
+- Developments in test - see test/History.
+
+vis-V00-01-14a  7th December 1999  John Allison
+- Added `class' keyword in friend statement in G4VisStateDependent.hh
+  to keep HP happy.
+
+vis-V00-01-14  6th December 1999  John Allison
+- Invert rotation of boolean component in G4PhysicalVolumeModel.cc.
+
+vis-V00-01-13  Satoshi TANAKA  Dec 01, 1999
+- DAWN-V00-01-08
+- Removed implicit casting from the previous updation
+
+vis-V00-01-12  Satoshi TANAKA  Nov 30, 1999
+- DAWN-V00-01-06
+- Fixing improper definition of alpha1, alpha2
+
+vis-V00-01-11  29th November 1999  John Allison
+- Introduced helper class G4VisStateDependent to decouple G4VisManager from
+  G4StateManager, G4RunManager, etc.
+- Archived old directoris inside test subdirectory.
+
+vis-V00-01-10  25th November 1999  John Allison
+- Adapted relevant header files of modeling and management for
+  Software Reference Manual.
+
+vis-V00-01-09  23th November 1999  Satoshi Tanaka
+- Protection to ill-defined G4Trap in AddThis() 
+
+vis-V00-01-08  10th November 1999  John Allison
+- Added capability of viewing Boolean solids - coworks with geometry-V00-01-01.
+- Fixed bug in G4VViewer to maintain proper status of fNeedKernelVisit.
+- Added Boolean solids to test/src/MyDetectorConstruction.cc.
+- Added circle to represent end of step in test/src/MySteppingAction.cc.
+
+vis-V00-01-07  5th November  John Allison
+- Added /vis/viewer/update [<viewer-name>].
+- Some groundwork for /vis/scene/edit.
+- Added additional check in G4VisManager::IsValidView().
+- G4VSceneHandler::ClearStore() invokes fpViewer -> NeedKernelVisit().
+  (After a clear of the graphical database it is necessary to do this.
+  So if a derived class redefines, it must still invoke this base
+  class method.
+- G4Scene::AddRunDurationModel(), AddWorldIfEmpty(), AddEndOfEventModel():
+  avoid duplicate models and flag with G4bool return argument.
+- G4VisCommandsSceneAdd: respect the above G4bool return value.
+- G4Scene::AddRunDurationModel(): remove temporary workaround for old CLHEP
+  non-const problem.
+- Added 3rd template argument of map (to keep Sun CC 4.2 happy) in
+  G4OpenGLStoredSceneHandler.hh and G4OpenInventorSceneHandler.hh.
+- G4OpenGLStoredSceneHandler::ClearStore() and
+  G4OpenInventorSceneHandler::ClearStore() invoke base class function
+  G4VSceneHandler::ClearStore().
+
+VRML-V00-01-01 4th November 1999  Satoshi Tanaka
+- Introduction of VRMLBeginModeling() for new vis commands  
+- Updation and tagging of visualization/VRML/
+  and this History file 
+
+DAWN-V00-01-04  04th November 1999 Satoshi TANAKA  
+- Protection to AddPrimitive( G4NURBS )
+- Updation and tagging of visualization/FukuiRenderer/
+  and this History file
+
+DAWN-V00-01-03  02nd November 1999 Satoshi TANAKA
+- Updation and tagging of visualization/FukuiRenderer/
+  and this History file
+- Environmental variable G4DAWN_MULTI_WINDOW is	
+  renamed to G4DAWNFILE_MULTI_WINDOW for DAWN-file driver.
+  (G4DAWN_MULTI_WINDOW	still works for a while.)
+
+DAWN-V00-01-02  01st November 1999 Satoshi TANAKA
+- Updation and tagging of visualization/FukuiRenderer/
+  and this History file
+- Separation of BeginModeling() and FRBeginModeling().
+  Co-workable with /run/beamOn with the new vis commands.
+
+29 Oct 1999  Guy Barrand
+- Modify  G4Xo.cc to not load G4Xo.xrm resource file.
+  Resource must be grouped in some g4.xrm file.
+
+vis-V00-01-06  25th October 1999  John Allison
+- No longer update view parameters in /vis/scene/add/volume, etc.
+- Change G4RWTValHashDictionary to G4std::map in G4OpenGLStoredSceneHandler
+  and G4OpenInventorSceneHandler (needs global-V00-01-03).
+
+11 Oct 1999  Guy Barrand
+- G4GoSceneHandler.cc/G4GoSceneHandler::EndPrimitives : modify
+  the logic of setting the OMatrix for Go objects in order
+  to avoid the usage of the CLHEP/Rotation.getAngleAxis that
+  clearly has precision problem on some platforms (at least 
+  Linux and HP-UX).
+
+vis-V00-01-05  4th October 1999  John Allison
+- Implemented /vis/scene/add/logicalVolume.
+- Added G4LogicalVolumeModel.
+- Augmented G4PhysicalVolumeModel so G4LogicalVolumeModel could inherit.
+- Updated G4BoundingSphereScene and G4PhysicalVolumeSearchScene to
+  implement extra virtual functions in G4VSceneHandler interface.
+- Moved virtual destructor G4VModel::~G4VModel to non-inline implementation.
+- Tidied G4VSceneHandler.
+
+vis-V00-01-04 30 Sep 1999  Satoshi Tanaka
+- RW/STL dependence was removed from VRML 1.0 driver
+
+15 Sep 1999  Guy Barrand
+- Modify  G4OpenGLStoredSceneHandler.cc to compile on Linux-g++ with STL.
+
+vis-V00-01-03  27th August  John Allison
+- Modified GNUmakefile to prevent building of global libraries.
+
+vis-V00-01-02  27th August  John Allison
+- Eliminate residual references to G4Ray.
+- Improved some informational printing in G4VisManager::IsValidView.
+- G4Vis
+Manager::SetCurrentGraphicsSystem no longer gives spurious warnings.
+- Improved README (change `gmake global' to plain `gmake').
+
+vis-V00-01-01 26th August Satoshi TANAKA
+- Protection for invalid calling of BeginModeling
+- .DAWN.history ==> .DAWN_1.history 
+   **** It means DAWN version 3.80a or  after is  required ***
+
+vis-V00-01-00  24th August Satoshi TANAKA
+- Improved README.
+
+vis-01-00-15a  3rd July 1999  John Allison
+- Improved README (Guy).
+- Corrected a fprintf statement in G4OpenGLXViewer::spewWireframeEPS.
+
+vis-01-00-15  29th June 1999  John Allison
+- Moved #include <rw/tvhdict.h> from G4OpenGLSceneHandler.hh to .cc.
+- Corrected #ifdef G4VIS_BUILD_OPENGL_DRIVER in G4OpenGLXViewer.hh.
+
+vis-01-00-14  19th June 1999  John Allison
+- Removed references to G4Ray from GNUmakefile.
+- Archived (cvs removed) all G4Ray files.
+- Cosmetic change to an output statement in G4VisToOldVisCommands.cc/
+
+vis-01-00-13  1st June 1999  John Allison
+- Updated README for May Release (Satoshi, John).
+- Removed G4Ray from tag.
+
+31 Mai 1999  Guy Barrand
+- G4XoViewer : remove enabling/disabling XoCamera popup menu logic. 
+  In some situation (N03) we were loosing the XoCamera popup menu. 
+- G4XoViewer : correct ClearStore, ClearTransientStore.
+
+vis-01-00-12a  26th May 1999  John Allison
+- G4TrajectoriesModel.cc: (*TC) [iT] -> DrawTrajectory ();
+
+vis-01-00-12  25th May 1999  John Allison
+- Moved global operator != to member function.
+- Updated OPACS to handle "ClearTransientStore" (Guy).
+
+vis-01-00-11  12th May 1999  Guy Barrand
+- G4VSceneHandler : ClearTransientStore.
+- G4VisCommandsSceneHandler : protect against a null pointer.
+- OpenInventor : use HEPVis/SoWindow to create windows (needed 
+  on NT). Implement the a "transient scene graph" for "event"
+  things. Use fXxx convention for fields.
+- G4TrajectoriesModeling : do not draw a "marker" at each step by default. 
+
+vis-01-00-10  10th May 1999  John Allison
+- Acted upon Code Wizard reports.  Mainly made destructors virtual.
+
+vis-01-00-09  28th April 1999  John Allison
+- Changes for UserAction classes.
+
+vis-01-00-08  John Allison
+- Changes by Paulo Mora de Freitas for decoupling vis from parameterisation.
+
+18th April 1999  John Allison
+- Added "defined" after || in VRML1(1)(File).hh.  (Some preprocessors
+  give an error without it.)
+
+vis-01-00-07  15th April 1999  John Allison
+- Replaced visualization/test/GNUmakefile by a simple one using binmake.gmk.
+- Added CPPFLAGS += -I$(G4BASE)/intercoms/include to some GNUmakefiles ready
+    for the move of G4VGraphicsScene to intercoms.
+
+vis-01-00-06  29th March 1999  John Allison
+- Platform dependency fix in G4VisCommandsScene.cc.
+
+vis-01-00-05  7th February 1999  John Allison
+- management: - Added /vis/scene/notifyHandlers.
+              - Added virtual functions AddThis (const G4Polycone and
+                G4Polyhedra to G4VSceneHandler
+              - Moved some code from G4VisManager to G4Scene::AddWorldIfEmpty.
+              - Various refinements and bug fixes.
+- modeling: Augmented G4PhysicalVolumeSearchScene and G4BoundingSphereScene
+            See modeling/History.
+- OpenGL: - Corrected edgeCount check for triangles in
+            G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron&).
+          - Added (long unsigned int) cast in G4OpenGLXmRotationCallbacks.cc.
+          - Added SetView and ShowView to G4OpenGLXViewer:
+              // To force change of context...
+              void G4OpenGLXViewer::SetView () {
+                glXMakeCurrent (dpy, win, cx);
+                G4OpenGLViewer::SetView ();  
+              }
+              // Hopefully to get better flushing in DEC OpenGL...
+              void G4OpenGLXViewer::ShowView () {
+                glXWaitGL ();
+                glFlush ();
+              }
+
+
+vis-01-00-04 11th January 1999  John Allison
+- Completed change of names from scene to sceneHandler, view to viewer.
+- Vis manager and scene handlers now keep pointer to scene, rather than a copy.
+- G4SceneList now a simple G4RWTPtrOrderedVector.
+- /vis/camera/reset now resets viewpoint direction and up vector.
+
+vis-01-00-03 10th January 1999  John Allison
+- Added flags for viewing geom, hits, digis to G4ModelingParameters.
+
+vis-01-00-02  9th January 1999  John Allison
+- Changed Scene to SceneHandler, View to Viewer.
+
+vis-01-00-01  6th January 1999  John Allison
+- Made G4VisManager::GetInstance() private to prevent inadvertent misuse.
+- Removed #include GNU_GCC - no longer necessary for egcs.
+- Continued developing the new commands.
+
+vis-00-04-04  16th December 1998  John Allison
+- test/GNUmakefile for Linux-g++
+- test/test19.cc - removed g4templates.hh
+- OpenGL - reverted to 100%.
+
+vis-00-04-03  9th December 1998  John Allison
+- Made /vis/ commands from /vis~/.  The idea is to maintain backwards
+  compatibility while allowing us to "deprecate" the old commands over
+  a period of time.  Some of these /vis/ commands respond with "superceded",
+  i.e., superceded by new commands, but still available in /vis~/.
+- OpenGL viewing volume increased by 20% to prevent corners being clipped.
+
+- 08/12/98 : G.Barrand : OpenInventor : due to 
+  huge load problems on various platforms, init only
+  the HEPVis things that are needed.
+
+vis-00-04-02  30th November 1998  Satoshi Tanaka
+- G4VRMLFILE_DEST_DIR for customising out file name - see VRML/History.
+
+29th November 1998
+- Added CPPFLAGS += -I....electromagnetic/utils/include to test/GNUmakefile.
+- Added fName to G4SceneData.
+
+vis-00-04-01  25th November 1998  John Allison.
+- G4Ray/GNUmakefile update for move of files in particles.
+- Added const G4VisAttributes* fpDefaultVisAttributes and access
+  functions to G4ModelingParameters.
+- Reverted to default assignment operator and copy constructor for
+  G4ModelingParameters and G4ViewParameters.
+- G4PhysicalVolumeModel can now handle invisible daughters.
+- More new /vis/ commands - depends on intercoms-00-04-01.
+- G4VScene passes DefaultVisAttributes* to ModelingParameters.
+
+vis-00-03-07  23rd November 1998  John Allison.
+- modeling/GNUmakefile update for move of files in particles (Hisaya).
+- Removed semi-colon in G4BoundingSphereScene.cc.
+
+vis-00-03-06  9th November 1998  John Allison.
+- Small change to a message in G4VisManager.
+- VRML refinement - see VRML/History.
+- Needs greps-00-03-03.
+
+vis-00-03-05b  9th November 1998  John Allison.
+- Merged 6th November changes with vis-00-03-05a
+- Bug fix in G4VisManager::IsValidView for batch running.
+- Needs greps-00-03-03.
+
+vis-00-03-05a  9th November 1998  Satoshi Tanaka
+- VRML 2.0 Visualization driver is added to 
+  management/include/MyVisManager.cc.
+
+vis-00-03-05  9th November 1998  Satoshi Tanaka
+- VRML 2.0 Visualization driver is commited:
+ (1) Generatin of VRML 2.0 format files to describe Geant4 simulation.
+ (2) Interactive displaying of physiccal-volume names and copy numbers
+ (3) Interactive displaying of hit positions (displayed strings are
+     costomizable.
+ (4) Wireframe drawing style of Geant4 visualization is reflected as
+     transparency = 0.7.  This value is customizable.
+     If transparency is 1.0, drawing of detector geometry is skipped,
+     and hits can be picked easily.
+
+6th November 1998  John Allison
+- Implemented basic /vis/viewer commands.
+- Added `const G4String& name' argument to G4VScene and G4VView constructors.
+
+vis-00-03-04  30th October 1998  John Allison
+- Tagged.
+
+29th October 1998  Guy Barrand
+- G4OpenGLXView.hh, G4OpenGLXmView.cc, G4OpenGLXmWindowHandlingCallbacks.cc
+  in order that things compile and compile without warnings on HP/aCC
+
+14th October 1998  John Allison
+- Augmented the new /vis/ commands.  Still not complete but they
+  co-work with the old commands.
+- Changed char* fName to G4String fName in G4VScene and G4VView.
+  Consequent changes in G4OpenGLView.  Also OpenInventor?  Etc.
+
+11th October 1998 Andy Walkden
+- added (not a very good) version of hidden lines removal code. This code 
+  suffers from depth buffering artefacts. glPolygonOffset is a feature of 
+  OpenGL version 1.1, and can help overcome depth buffer problems. The code 
+  to utilise glPolygonOffset is committed, but commented out, as it doesn't 
+  seem to work with the version of Mesa available on rsplus currently. My 
+  ideal strategy is to enable depth testing, draw the model as lines, enable 
+  filled polygon offsetting (glPolygonOffset(1.0 /*offset scale factor*/, 
+  2/*offset bias*/); glEnable (GL_POLYGON_OFFSET_FILLED);) then draw the 
+  model as filled polygons. The offsetting should just add `2' (in window 
+  coordinates, I think) onto the z value of all vertices relating to filled 
+  polygons, thus dismissing the conflict between almost identical z values 
+  for lines and filled polygon edges.
+
+vis-00-03-03 9th October 1998  John Allison
+- G4VisManager inherits G4VStateDependent.  This is used to draw
+  end-of-event models.
+
+4th October 1998 Andy Walkden
+- Added ability for all G4OpenGLX derived graphics systems to produce
+  vectored PostScript hardcopy. Facility for `automated screen dump'
+  (i.e. pixmap output) still kept, as some rasterization features
+  don't make it into the vectored PostScript output (such as haloing
+  effects). Facility currently available via G4OpenGLXm by clicking
+  `Miscellany' then `Create .eps file', to get a popup printing
+  window.
+
+vis-00-03-02a  26th September 1998  
+- DAWNFILE driver is made platform dependent.
+  (It is now compilable both at both Unix and NT without necessity
+   of C macros like WIN32.)
+
+vis-00-03-02  25th September 1998  
+- DAWNFILE driver is ported to VC++
+
+vis-00-03-01  24th September 1998  John Allison
+- Eliminated G4VPhysicalVolume* fpWorld data memebr from G4VisManager.
+
+22th September 1998 Guy Barrand.
+- Correct modeling, management, G4Ray /GNUmakefile to have
+  correct digits+hits includes.
+
+19th September 1998 Guy Barrand.
+- Due to a correction in globals.h restore correct code
+  so that OpenInventor files compile correctly on NT.
+
+vis-00-02-06  31st August 1998  John Allison
+- Added G4VModel::Validate() and in subclasses.
+- Reverted to default copy constructir and assignment operator in G4SceneData.
+- Implemented G4VisManager::GeometryHasChanged().
+- Switched on echoing of commands and history mechanism in test19.g4m.
+
+vis-00-02-05  27th August 1998  John Allison
+- Added G4HitsModel and G4TrajectoriesModel.
+- Added /vis/scene/include/hits and trajectories, and some bug fixes.
+
+vis-00-02-04  22nd August 1998  John Allison
+- Many changes in modeling - see modeling/History.
+- New commands: /vis/scene/create, list, add/volume, add/ghosts.
+
+vis-00-02-03a  20th August 1998  John Allison
+- Restored some code in G4SceneData.cc
+- Fixed syntax bug in G4PhysicalVolumeSearchScene.hh
+
+vis-00-02-03  14th August 1998  John Allison
+- Added G4VisManager::GeometryHasChanged() - run manager can notify change.
+- Removed AddRun(Event)DurationModelToCurrentSceneData - no longer used.
+- Some bug corrections in visualization/OpenGL (Guy Barrand - see
+  vis blackboard for details).
+- Some protection added in visualization/OPACS (do.)
+- Created visualization/test/OPACS (do.)
+
+12th August 1998  John Allison
+- More new commands - not fully functional yet.
+
+11th August 1998  Guy Barrand
+- G4OpenInventor : remove uneccesary includes.
+
+vis-00-02-02b  11th August  Satoshi Tanaka
+- AddPrimitive() for polymarker are implemented in DAWN and VRML drivers.
+
+vis-00-02-02a  9th August  John Allison
+- Small bug fix in G4VisCommandsScene.cc.
+
+vis-00-02-02  9th August  John Allison
+- Changed '.' to '-' in scene/view names.
+- Began introduction of new /vis/ commands.
+- Consequent changes to test - see test/History.
+
+7th August  Guy Barrand.
+- OPACS : use G4VView name to build widget names.
+- OPACS : use new interactor parenting logic.
+- OpenGL, OpenInventor, G4Ray : clean compilation warnings for OSF1/cxx, HP/aCC.
+
+7th August  John Allison/Satoshi Tanaka/Guy Barrand.
+- Added G4<driver>Scene::AddPrimitive (const G4Polymarker&) to keep
+  compilers happy.
+
+vis-00-02-01  6th August  John Allison
+- Created G4VisManagerRegisterMessengers.cc.
+- Bug fix in G4VisManager: now follows change of world volume after
+  /vis~/clear/scene.
+- OpenInventor: Correct some upper -> lower case mess (Guy Barrand)
+- G4RayView: syntax bug fixes.
+
+4th August 1998 Andy Walkden
+I made some changes to OpenGL code...
+The changes are (i) to tidy up some redundant hidden line 
+removal function calls, (ii) to put some hidden line removal 
+code in G4OpenGLScene::AddPrimitive(G4Polyhedron) and 
+(iii) to add an option to generate an encapsulated postscript 
+file of the current view in OpenGLXm. There is now a button 
+in the Miscellany pulldown of the main menubar to bring up 
+a shell in which you can specify a filename, colour or black 
+and white and request the creation of a .eps file. The 
+code is to be found in G4OpenGLXView, and so is not bound 
+to the Xm user. Also it needs fixing for some Mesa 
+implementations, and the HP CDE environment manages to stuff 
+things up when rendering to a pixmap (although CDE makes a 
+mess of most other things as well, so this isn't
+disastrous).
+
+
+vis-00-01-08  21th July 1998  John Allison
+- Removed automatic refresh from /vis/camera/reset in G4VisCommandsCamera.cc.
+
+vis-00-01-07b  21th July 1998  Satoshi Tanaka
+- Revised G4FRSCENE::SendBoundingBox() so that 
+  zooming polycy of  DAWN drivers becomes consistent with 
+  OpenGL drivers
+
+vis-00-01-07  20th July 1998  John Allison
+- Corrected bug in G4VisManager::IsViewValid to trap drawing commands
+  before geometry is available.
+
+vis-00-01-06  19th July 1998  John Allison
+- Default culling: culling - on, culling of invisible objects - on.
+- set/drawing_style does *not* change culling flags.
+- Minor bug fixes.
+
+vis-00-01-05  15th July 1998  John Allison
+- Cleaned up after name changes.
+- Minor bug fixes.
+
+vis-00-01-04  7th July 1998  Guy Barrand
+- Introduced interactivity.gmk into GNUmakefiles.
+
+vis-00-01-03  6th July 1998  John Allison
+- Changes for interface restructuring.
+- Simplified MyVisManager.
+
+vis-00-01-02  5th July 1998  John Allison
+- Changed visualization/GNUmakefile to use globlib.gmk.
+- Updated README for geant4beta.
+- Changed /vis~/draw/Ghosts to /vis~/draw/ghosts.
+
+vis-00-01-01  4th July 1998  John Allison
+- Moved G4VIS_BUILD.gmk and G4VIS_USE.gmk to geant4beta/config.
+- Changed /vis/ to /vis~/.
+
+3rd July 1998  John Allison
+- Small changes to test - see test/History.
+- Tidied.
+- Removed GNUmakefile.G4VIS_USE and make_list.sh.
+
+30th June 1998 - Paulo & Marc
+- added the G4FlavoredParallelWorldModel.hh file to 
+  visualization/modeling/include;
+- added the /vis~/draw/Ghosts [particle name] command
+  in the G4VisManMessDraw.cc file;
+- added 
+  CPPFLAGS += -I$(G4BASE)/geometry/magneticfield/include and
+  CPPFLAGS += -I$(G4BASE)/processes/parameterisation/include
+  lines to GNUmakefile to compile G4VisManMessDraw.cc.
+
+geant4beta
+============================================================
+geant4alpha
+
+vis-00-06-09  26th June 1998  John Allison
+- OPACS and Open Inventor - something about widget parents (GB)
+- Removed /new_vis/ commands.
+
+vis-00-06-08a  26th June 1998 Satoshi Tanaka
+- Updated G4VIS_USE.gmk
+- (1) Macro -DG4VIS_USE_DAWNFILE is made properly set
+- (2) G4VIS_USE_DAWN_ is renamed to G4VIS_USE_DAWN_OR_DAWNFILE
+- (3) G4VIS_USE_VRML_ is renamed to G4VIS_USE_VRML_OR_VRMLFILE
+
+vis-00-06-08  22nd June 1998  John Allison
+- Changed G4BASE = ../.. to G4BASE = $(shell (cd ../..; pwd))
+- Changed GNUmakefile.G4VIS_BUILD to G4VIS_BUILD.gmk
+
+vis-00-06-07  19th June 1998  John Allison
+- Defined G4_SOLVE_VIS_TEMPLATES in G4VIS_USE.gmk.  Needs
+  the head version of GNUmakefile.architecture.
+- Consequential changes (improvements) to template handling in test19.cc
+- Some minor improvements in modeling.
+
+vis-00-06-06  11th June 1998  John Allison
+- Fixes to test_utils - see test/History.
+- Improvements in modeling - see modeling/History.
+
+vis-00-06-05  11th June 1998  Satoshi Tanaka
+- In G4VisManMessDraw.cc and G4VisManMessSet.cc , ...
+  //    G4double unit = G4UIcommand::valueOf (unitString);
+        G4double unit = G4UnitDefinition::GetValueOf (unitString);
+
+vis-00-06-04  10th June 1998  John Allison
+- Created G4VIS_USE.gmk to replace GNUmakefile.G4VIS_USE.
+- Changed test/GNUmakefile to use G4VIS_USE.gmk.
+- Separate libraries are now default in GNUmakefile.
+- Committed an interim version of README.
+- Moved G4BoundingSphereScene from management to modeling.
+- First attempt at defining the "scene" as lists of models.
+- Removed some unnecessary checks in G4VisManMess*.
+
+vis-00-06-03  27th May   1998  Satoshi Tanaka
+- DAWNFILE driver is added. It is to generate g4.prim file
+  under the current directory.  And make DAWN or DAVID invoke 
+  using the g4.prim file as an input. For details, see the blackboard 
+  document.
+
+21st May 1998 Andy Walkden
+- Added hidden line removal code to G4OpenGLView. HLR utilises OpenGL's
+  stencil buffer, but still the drawn lines are a little fragmented
+  (an effect seen often when depth buffering is used to resolve pixel
+  rendering disputes). 
+- HLR requires wireframe rendering, filled polygon rendering and then wireframe
+  rendering again. Hence, three visits to the kernel help to slow HLR
+  rendering right down.
+
+vis-00-06-02  20th May   1998  Satoshi Tanaka
+- Added G4VisFeaturesOfDAWNFILE.hh, cc
+- Revised visualization/GNUmakefile, GNUmakefile.G4VIS_BUILD,
+  GNUmakefile.G4VIS_USE
+- These are for DAWNFILE driver in preparation, which enables to
+  invoke DAVID directly from Geant4.
+
+vis-00-06-01a 20th May   1998  Satoshi Tanaka
+- code refinement of FukuiRenderer driver
+
+vis-00-06-01  29th April 1998  John Allison
+- Introduced non-pure virtual functions
+  Establish/DecommissionSpecials (G4PhysicalVolumeModel&) in
+  G4VGraphicsScene with implementation of the former in G4VScene.
+  Modified G4PhysicalVolumeModel to use it; also protected
+  G4PhysicalVolumeModel against non-implementation of
+  Establish/DecommissionSpecials.
+- Template instantiations in G4RayView made exclusive to GNU_GCC
+- Some minor changes under test - see test/History.
+
+27th April 1998 Andy Walkden
+- altered OpenGLView's structure a little. Now, G4OpenGLXmView is a
+  type of (inherits from) G4OpenGLXView.
+- made code for haloing effects common to all OpenGL views.
+- changed XUnmapWindow in G4OpenGLXView::~G4OpenGLXView to XDestroyWindow
+  (idea of Guy's)
+
+27th April 1998 Guy Barrand
+- vis/OPACS : remove Begin/EndModeling in G4GoScene.
+
+vis-00-05-06  23rd April 1998  John Allison
+- Changed test19.mac to test19.g4m and consequent change in test19.cc.
+- Fixed order of linking vis-a-vis -lG4track and -lG4tracking (GB).
+- Fixed inadvertent bug in test_utils/src/MyPhysicsList.cc.
+- Bug fix in G4OpenGLXmConvenienceRoutines.cc (GB).
+
+vis-00-05-05  21st April 1998  John Allison
+- Added run-time command line argument: test19 [<session-type>] [<verbosity>]
+- Removed #if GNU_GCC from template instantiation requests in test19.cc.
+- Added fDefaultTextVisAttributes to G4ViewParameters.
+- Added G4VScene::GetTextColour (changed G4FukuiRendererScene, G4GoScene and
+  G4OpenInventorScene.
+- Changed default view parameters: culling on and invisible object culling on.
+- Tidied CreateScene/View.
+- Continued BaBar development.
+
+15th April 1998  John Allison
+- Added test/EucIntfce/, test/Bogus/ and test/babar_utils/ for BaBar test code.
+  Also a new main() in BaBarCallListTest.cc.  Also a data file call_list.dat.
+  See babar_utils/README.
+- Camera commands, except spin and orbit, no longer initiate draw.
+- Text is blue for time being (visible on black or white background.)
+
+15th April 1998 : Guy Barrand
+- From discussion with John and Simone G4VToolkit 
+  has been renamed to G4VInteractorManager.
+
+vis-00-05-04a  11th April 1998  Satoshi Tanaka
+- Code improvements in DAWN driver
+- (1) View parameters are sent to DAWN only at drawing times.
+- (2) Way of getting marker size are made simpler by using
+-     G4VScene::GetMarkerRadius ()  etc.
+
+vis-00-05-04  8th April 1998  John Allison
+- Small bug fix - then tag for Easter.
+
+HEAD  6th April 1998  John Allison
+- Added error printing to G4OpenGLScene::AddPrimitive (const G4Text& text).
+- Added /vis~/draw/text.
+- Added units to /vis~/draw/axes.
+- Began the job of restructuring vis commands; so there is a new class
+  G4VisCommandsCameraMessengers for starters!
+
+HEAD  4th April 1998  John Allison
+- Removed automatic drawing after /vis~/set commands.  Now an explicit
+  redraw is necessary, but it allows you to change parameters during
+  building a view.  For example to superimpose projected hits on a
+  section:
+    /vis~/clear/view
+    /vis~/set/section_plane on 0 0 20 cm 0 0 1
+    /vis~/draw/current
+    /vis~/set/section_plane off
+    /run/beamOn
+- Fixed small bug in OpenGL for section drawing.
+- Made some small improvements in G4ViewParameters.
+
+vis-00-05-03  4th April 1998  John Allison
+- Re-engineered maintenance of current depth, etc.  Needed new method
+  G4VGraphicsScene::BeginModeling (G4PhysicalVolumeModel&) in
+  graphics_reps.  The result is much cleaner model and modeling
+  parameters classes.  Also, the current depth, physical volume and
+  logical volume are immediately available as protected pointers in
+  G4VScene.
+- Required G4VScene::Begin/EndModeling to be invoked from subclass.
+- Introduced G4NullModel to hold modeling parameters.  This avoids
+  having to create a G4VModel for each graphics primitive.
+
+HEAD  3rd April 1998  John Allison
+- Added GetMarkerDiameter/Radius to G4VScene.
+- Bug fix in G4VScene::GetMarkerSize.
+- Removed GetCurrentPhysicalVolume from G4PhysicalVolumeModel - now in
+  G4ModelingParameters (but might move again soon!).
+- test/GNUmakefile now uses "$(MAKE) separate" for vis libraries.
+- test19 recognises argument "1" as a verbose flag value.
+
+HEAD April 2, 98 G.Barrand
+- Modifications for Win32/NT.
+- G4VIS_BUILD_[OIX, OIWIN32]_DRIVER, G4VIS_USE_[OIX, OIWIN32]
+
+vis-00-05-02  26th March 1998  John Allison
+- Added GetMarkerSize to G4VScene.
+- Made ~G4VisManager virtual.
+- Added current logical volume and current physical volume to working
+  space in modeling parameters.  So it is no longer necessary to cast
+  to G4PhysicalVolumeModel; all such casts removed.
+- Moved nested classes out of G4RayView.
+
+HEAD March 24, 98 G.Cosmo
+- Modified G4VisManMessExpert.cc to correctly use random numbers
+  by calling directly G4UniformRand().
+
+HEAD March 24, 98 G.Barrand
+- GNUmakefile : MAKESHLIB changed in G4MAKESHLIB
+
+vis-00-05-01a  24 March 1998  Satoshi Tanaka
+- Geometry tree can be obtained by, e.g., 
+  % grep PVName g4.prim > g4.tree
+
+vis-00-05-01  23rd March 1998  John Allison
+- Made RegisterGraphicsSystems pure virtual.
+- Added verbose level control to printing at initialization.
+- Fixed (hopefully) bug in scene deletion.
+- Made AddPrimitive (const G4Text/Circle/Square) pure virtual.
+  (Had to add dummy void G4VRML1SCENE::AddPrimitive (const G4Text&).)
+- Made AddPrimitive (const G4Polymarker&) virtual again.
+- Opened some .hh files to G4VIS_USE flags.
+- Removed Pre/PostAddThis from some graphics systems (not OPACS, OI).
+- First implementation of G4ModelingParameters::hierarchy (DTREE).
+- Added Get Global/Current Tag/Description to G4VModel.
+- Introduced "working space" in G4ModelingParameters for geometry depth.
+- Relocated some template instantiation requests (might give trouble on DEC).
+
+vis-00-04-05a  16th March 1998  Satoshi Tanaka
+- DAWN driver outputs physical-volume names and copy number.
+
+vis-00-04-05  5th March 1998  John Allison
+- Added G4Text/Circle/Square in G4RayScene.hh.
+- Added G4Text/Circle/Square in G4BoundingSphereScene.hh.
+- Made AddPrimitive (const G4Polymarker&) non-virtual in G4VScene.hh.
+
+HEAD  5th March 1998  Andy Walkden
+- Implemented G4Circle/Square.
+- Added haloing to OpenGLXm "value added" options.
+
+HEAD  5th March 1998  S.Sadilov
+- visualization/GNUmakefile - using $OUT_LIB intoduced in
+  GNUmakefile.architecture
+- visualization/management/GNUmakefile - compiling G4VisManMessSet.cc
+  without optimization on WinNT
+
+vis-00-04-04a  5th March 1998  Satoshi TANAKA
+- Environmental variables  to customized DAWN driver is
+  renamed from DAWN_... to G4DAWN_...
+- Default mode of DAWN driver is  EPS mode, i.e. 
+  mode in which EPS files are generated.
+
+vis-00-04-04  4th March 1998  John Allison
+- First tag with modeling under visualization.
+  Here's what you need to do...
+    cd prototype
+    cvs update -A -d -P modeling
+    cd visualization
+    cvs update -r vis-00-04-04 -d -P
+  Change the following lines in your GNUmakefile...
+    CPPFLAGS += -I../../visualization/modeling/include
+    LDFLAGS  += -L../../visualization/modeling/$(G4SYSTEM)
+    Remove: @cd ../../modeling      &&   $(MAKE)
+
+vis-00-04-03  4th March 1998  John Allison
+- Last tag with modeling at same level as visualization.
+- Renamed near and far (VC++ keywords) in G4ViewParameters.cc.
+- Removed unnecessary #include <strstream.h> or adapted for WIN32.
+
+vis-00-04-02b  22nd February 1998  Satoshi Tanaka
+- Split G4VIS_BUILD_VRML1_DRIVER into G4VIS_BUILD_VRML_DRIVER 
+                                 and  G4VIS_BUILD_VRMLFILE_DRIVER.
+- Split G4VIS_USE_VRML1          into G4VIS_USE_VRML           
+                                 and  G4VIS_USE_VRMLFILE.
+
+vis-00-04-02a  18th February 1998  John Allison
+- Bug fix in G4RayView!
+
+vis-00-04-02  18th February 1998  John Allison
+- Introduced /vis~/set/section_plane.
+
+vis-00-04-01  13th February 1998  John Allison
+- Made messengers compatible with the new style.
+
+vis-00-03-02a  3rd February 1998  John Allison
+- Bug fix for 02.
+- Changed GNUmakefile to use processes sub-libraries.
+
+vis-00-03-02  2nd February 1998  John Allison
+- Modernised messengers.
+
+vis-00-03-01a 29th January 1998  John Allison
+- Tagged a few improvement in OpenGL
+
+vis-00-03-01 26th January 1998  John Allison
+- Old environment variables abandoned - see visualization/README.
+- G4VisManager is now instantiated *and* deleted in main().
+- G4VisRegisterGraphicsSystem.icc replaced by
+  MyVisManager::RegisterGraphicsSystems as a way - now optional - of
+  a user overriding the default graphics system registration.
+
+Januray 20 , 98 G. Barrand
+
+- Implement object rotation in OPACS driver
+  
+Januray 19 , 98 G. Barrand
+
+- Correct OpenInventor code so that it is ANSI-C++
+  and then compiles with OSF1/cxx, HP-UX/aCC.
+
+7th January 1998  John Allison
+- Restructuring to use modeling category.
+
+December 19, 97 G. Cosmo - (alpha03)
+
+- 1st December 1997 - John Allison.
+- This is interim code for testing by the visualization
+  group and it will be tagged soon.  You must update to the
+  head of graphics_reps and visualization simulatanouesly.
+  It coworks (I hope - it's difficult to be 100% sure about
+  this since I have a few changes for other categories in
+  the pipeline - see previous email) with:
+    digits+hits              digi-00-02-01
+    events+tracks            event-00-02-01
+    geometry                 HEAD
+    global                   global-00-02-01
+    intercoms                intercoms-00-02-01
+    interfaces               interfaces-00-02-01
+    particle+matter          piim-00-02-01
+    run                      run-00-02-01
+    track                    track-00-02-01
+    tracking                 tracking-00-02-01
+- Addition of:
+    visualization/GNUmakefile.transition_to_G4VIS_BUILD
+    visualization/GNUmakefile.transition_to_G4VIS_USE
+    visualization/GNUmakefile.vis_cppflags_for_G4VIS_USE
+  to turn the existing environment variables into the
+  to-be-adopted G4VIS_... variables - see visualization/test/README.
+- Consequent changes to other visualization GNUmakefiles.
+- New way of instantiating graphics systems:
+  Set the appropriate environment variables and include and
+  compile G4VisRegisterGraphicsSystems.icc in your main():
+    ...
+    #include G4VisRegisterGraphicsSystems.icc
+    ...
+    main() {
+      ...
+- Added G4VisFeaturesOfXXX files which simple return a G4String.
+ (Guy, Jeff, would you like to join this scheme?)
+- Added commands /vis~/delete/scene and /vis~/delete/view.
+- Added /vis~/show/view to test19.odb.
+
+vis-00-02-01 to vis-00-02-05a not logged!!!
+
+vis-00-01-02  13th July 1997  John Allison
+- Consolidation of previous tag.
+
+vis-00-01-01  8th June 1997  John Allison
+- First systematic tag.
+- G4Ray introduced.
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLFontBaseStore.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLFontBaseStore.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLFontBaseStore.cc	(revision 562)
@@ -0,0 +1,59 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+
+#include "G4OpenGLFontBaseStore.hh"
+
+std::map<G4VViewer*,std::vector<G4OpenGLFontBaseStore::FontInfo> >
+G4OpenGLFontBaseStore::fFontBaseMap;
+
+void G4OpenGLFontBaseStore::AddFontBase
+(G4VViewer* viewer,G4int fontBase,
+ G4double size, const G4String& fontName) {
+  fFontBaseMap[viewer].push_back(FontInfo(fontName, size, fontBase));
+}
+
+G4int G4OpenGLFontBaseStore::GetFontBase(G4VViewer* viewer, G4double size) {
+  G4int fontBase = -1;
+  std::map<G4VViewer*,std::vector<FontInfo> >::const_iterator i;
+  i = fFontBaseMap.find(viewer);
+  if (i != fFontBaseMap.end()) {
+    G4double sizeDiscrepancy = 9999.;
+    std::vector<FontInfo>::const_iterator j, k;
+    for (j = i->second.begin(); j != i->second.end(); ++j) {
+      G4double d = std::abs(size - j->fSize);
+      if (d < sizeDiscrepancy) {
+	sizeDiscrepancy = d;
+	k = j;
+      }
+    }
+    fontBase = k->fFontBase;
+  }
+  return fontBase;
+}
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateQt.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateQt.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateQt.cc	(revision 562)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateQt.cc,v 1.11 2007/06/24 12:07:19 $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// OpenGLImmediateQt graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLImmediateQt.hh"
+#include "G4OpenGLImmediateQtViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+
+G4OpenGLImmediateQt::G4OpenGLImmediateQt ():
+  G4VGraphicsSystem ("OpenGLImmediateQt",
+		     "OGLIQT",
+		     G4VisFeaturesOfOpenGLIQt (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLImmediateQt::CreateSceneHandler
+(const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLImmediateQt::CreateViewer
+(G4VSceneHandler& scene, const G4String& name) {
+  printf("G4OpenGLImmediateQt::CreateViewer \n");
+  G4VViewer* pView =
+    new G4OpenGLImmediateQtViewer
+    ((G4OpenGLImmediateSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLImmediateQt::CreateViewer: error flagged by negative"
+	" view id in G4OpenGLImmediateQtViewer creation."
+	"\n Destroying view and returning null pointer."
+	   << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLImmediateQt::CreateViewer: null pointer on"
+      " new G4OpenGLImmediateQtViewer." << G4endl;
+  }
+  printf("G4OpenGLImmediateQt::CreateViewer END \n");
+   return pView;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateQt.cc.orig
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateQt.cc.orig	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateQt.cc.orig	(revision 562)
@@ -0,0 +1,78 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateQt.cc,v 1.11 2007/06/24 12:07:19 $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+//
+// OpenGLImmediateQt graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLImmediateQt.hh"
+#include "G4OpenGLImmediateQtViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+
+G4OpenGLImmediateQt::G4OpenGLImmediateQt ():
+        G4VGraphicsSystem ("OpenGLImmediateQt",
+                           "OGLIQT",
+                           G4VisFeaturesOfOpenGLIQt (),
+                   G4VGraphicsSystem::threeD) {
+    G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLImmediateQt::CreateSceneHandler
+(const G4String& name) {
+    G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
+    return    pScene;
+}
+
+G4VViewer* G4OpenGLImmediateQt::CreateViewer
+(G4VSceneHandler& scene, const G4String& name) {
+    G4VViewer* pView =
+        new G4OpenGLImmediateQtViewer
+        ((G4OpenGLImmediateSceneHandler&) scene, name);
+    if (pView) {
+        if (pView -> GetViewId () < 0) {
+            G4cerr << "G4OpenGLImmediateQt::CreateViewer: error flagged by negative"
+            " view id in G4OpenGLImmediateQtViewer creation."
+            "\n Destroying view and returning null pointer."
+            << G4endl;
+            delete pView;
+            pView = 0;
+        }
+    } else {
+        G4cerr << "G4OpenGLImmediateQt::CreateViewer: null pointer on"
+        " new G4OpenGLImmediateQtViewer." << G4endl;
+    }
+    return pView;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateQtViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateQtViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateQtViewer.cc	(revision 562)
@@ -0,0 +1,204 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateQtViewer.cc,v 1.16 2007/06/25 16:38:13 $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+//
+// Class G4OpenGLImmediateQtViewer : a class derived from G4OpenGLQtViewer and
+//                                G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4OpenGLImmediateQtViewer.hh"
+#include "G4VisManager.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLImmediateQtViewer::G4OpenGLImmediateQtViewer
+(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;
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+}
+
+G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQtViewer() {
+   printf("GLWidget::~GLWidget \n");
+     makeCurrent();
+   printf("GLWidget::~GLWidget END\n");
+}
+
+void G4OpenGLImmediateQtViewer::Initialise() {
+   printf("GLWidget::Initialise \n");
+   printf("readyToPaint = false \n");
+   readyToPaint = false;
+   CreateGLQtContext ();
+   printf("G4OpenGLImmediateQtViewer::Initialise () 2\n");
+
+  CreateMainWindow (this);
+  printf("G4OpenGLImmediateQtViewer::Initialise () 3\n");
+
+  CreateFontLists ();  // FIXME Does nothing!
+  
+  printf("readyToPaint = true \n");
+  readyToPaint = true;
+  
+  // First Draw
+  SetView();
+  printf("    ClearView\n");
+  ClearView (); //ok, put the background correct
+  ShowView();
+  FinishView();
+}
+
+void G4OpenGLImmediateQtViewer::initializeGL () {
+
+   InitializeGLView ();
+
+   printf("G4OpenGLImmediateQtViewer::InitialiseGL () 1\n");
+
+   // 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 ();
+   //   printf("G4OpenGLImmediateQtViewer::InitialiseGL () 2\n");
+   FinishView ();
+   
+
+
+   glDepthFunc (GL_LEQUAL);
+   glDepthMask (GL_TRUE);
+
+   printf("G4OpenGLImmediateQtViewer::InitialiseGL  -------------------------------------------------------------------------------------\n");
+}
+
+
+void G4OpenGLImmediateQtViewer::DrawView () {
+
+  printf("G4OpenGLImmediateQtViewer::DrawView %d %d   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
+   // 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) {
+     printf("G4OpenGLImmediateQtViewer::DrawView DANS LE IF\n");
+
+     HaloingFirstPass ();
+     NeedKernelVisit ();
+     ProcessView ();
+     glFlush ();
+
+     HaloingSecondPass ();
+
+   }
+
+   NeedKernelVisit ();  // Always need to visit G4 kernel.
+   ProcessView ();
+   FinishView ();
+  printf("G4OpenGLImmediateQtViewer::DrawView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",WinSize_x, WinSize_y);
+  readyToPaint = false;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLImmediateQtViewer::FinishView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  printf("G4OpenGLImmediateQtViewer::FinishView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
+
+   glFlush ();
+  printf("G4OpenGLImmediateQtViewer::FinishView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
+
+}
+
+
+/**
+ - Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
+ */
+void G4OpenGLImmediateQtViewer::resizeGL(
+ int width
+,int height)
+{  
+  int side = qMin(width, height);
+  glViewport((width - side) / 2, (height - side) / 2, side, side);
+  glMatrixMode(GL_PROJECTION);
+  glLoadIdentity();
+  glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
+  glMatrixMode(GL_MODELVIEW);
+  printf("G4OpenGLImmediateQtViewer::resizeGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
+}
+
+
+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++;
+   printf("\n\nG4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV %d ready %d\n",nbPaint,readyToPaint);
+   WinSize_x = (G4int) width();
+   WinSize_y = (G4int) height();
+
+   glViewport (0, 0, width(), height());
+
+   SetView();
+//   //  printf("before ClearView\n");
+   printf("    ClearView\n");
+   
+   ClearView (); //ok, put the background correct
+   DrawView();
+   readyToPaint = true; // could be set to false by DrawView
+
+
+   printf("G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d ready %d\n\n\n",nbPaint,readyToPaint);
+ }
+
+void G4OpenGLImmediateQtViewer::updateQWidget() {
+  updateGL();
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateSceneHandler.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateSceneHandler.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateSceneHandler.cc	(revision 562)
@@ -0,0 +1,203 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.24 2006/09/04 12:03:25 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL immediate scene - draws immediately to buffer
+//                           (saving space on server).
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+// Included here - problems with HP compiler if not before other includes?
+#include "G4NURBS.hh"
+
+// Here follows a special for Mesa, the OpenGL emulator.  Does not affect
+// other OpenGL's, as far as I'm aware.   John Allison 18/9/96.
+#define CENTERLINE_CLPP  /* CenterLine C++ workaround: */
+// Also seems to be required for HP's CC and AIX xlC, at least.
+
+#include "G4OpenGLImmediateSceneHandler.hh"
+
+#include "G4OpenGLTransform3D.hh"
+#include "G4Polyline.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+
+G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler (G4VGraphicsSystem& system,
+						const G4String& name):
+G4OpenGLSceneHandler (system, fSceneIdCount++, name)
+{}
+
+G4OpenGLImmediateSceneHandler::~G4OpenGLImmediateSceneHandler ()
+{}
+
+#include <iomanip>
+
+void G4OpenGLImmediateSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
+{
+  const G4Colour& c = GetColour (visible);
+  glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polyline& polyline)
+{
+  AddPrimitivePreamble(polyline);
+  G4OpenGLSceneHandler::AddPrimitive(polyline);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Circle& circle)
+{
+  AddPrimitivePreamble(circle);
+  G4OpenGLSceneHandler::AddPrimitive(circle);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Square& square)
+{
+  AddPrimitivePreamble(square);
+  G4OpenGLSceneHandler::AddPrimitive(square);
+}
+
+void G4OpenGLImmediateSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation) {
+  G4VSceneHandler::BeginPrimitives (objectTransformation);
+  glPushMatrix();
+  G4OpenGLTransform3D oglt (objectTransformation);
+
+  /*************************** Check matrix.
+  const GLdouble* m = oglt.GetGLMatrix ();
+  G4cout << "G4OpenGLTransform3D matrix:";
+  for (int i = 0; i < 16; i++) {
+    if ((i % 4) == 0) G4cout << '\n';
+    G4cout << std::setw (15) << m[i];
+  }
+  G4cout << G4endl;
+  *****************************************/
+
+  glMultMatrixd (oglt.GetGLMatrix ());
+}
+
+void G4OpenGLImmediateSceneHandler::EndPrimitives ()
+{
+  glPopMatrix();
+
+  // See all primitives immediately...
+  glFlush ();
+
+  G4VSceneHandler::EndPrimitives ();
+}
+
+void G4OpenGLImmediateSceneHandler::BeginPrimitives2D()
+{
+  G4VSceneHandler::BeginPrimitives2D();
+
+  // Push current 3D world matrices and load identity to define screen
+  // coordinates...
+  glMatrixMode (GL_PROJECTION);
+  glPushMatrix();
+  glLoadIdentity();
+  glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
+  glMatrixMode (GL_MODELVIEW);
+  glPushMatrix();
+  glLoadIdentity();
+}
+
+void G4OpenGLImmediateSceneHandler::EndPrimitives2D()
+{
+  // Pop current 3D world matrices back again...
+  glMatrixMode (GL_PROJECTION);
+  glPopMatrix();
+  glMatrixMode (GL_MODELVIEW);
+  glPopMatrix();
+
+  // See all primitives immediately...
+  glFlush ();
+
+  G4VSceneHandler::EndPrimitives2D ();
+}
+
+void G4OpenGLImmediateSceneHandler::BeginModeling () {
+  G4VSceneHandler::BeginModeling();
+}
+
+void G4OpenGLImmediateSceneHandler::EndModeling () {
+  G4VSceneHandler::EndModeling ();
+}
+
+void G4OpenGLImmediateSceneHandler::ClearTransientStore () {
+  G4VSceneHandler::ClearTransientStore ();
+  // Make sure screen corresponds to graphical database...
+  if (fpViewer) {
+    fpViewer -> SetView ();
+    fpViewer -> ClearView ();
+    fpViewer -> DrawView ();
+  }
+}
+
+void G4OpenGLImmediateSceneHandler::RequestPrimitives (const G4VSolid& solid)
+{
+  if (fReadyForTransients) {
+    // Always draw transient solids, e.g., hits represented as solids.
+    // (As we have no control over the order of drawing of transient
+    // objects, we cannot do anything about transparent ones, as
+    // below, so always draw them.)
+    G4VSceneHandler::RequestPrimitives (solid);
+    return;
+  }
+
+  // For non-transient (run-duration) objects, ensure transparent
+  // objects are drawn last.  The problem of
+  // blending/transparency/alpha is quite a tricky one - see History
+  // of opengl-V07-01-01/2/3.
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes(fpVisAttribs);
+  const G4Colour& c = pVA -> GetColour ();
+  G4double opacity = c.GetAlpha ();
+
+  if (!fSecondPass) {
+    G4bool transparency_enabled = true;
+    G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
+    if (pViewer) transparency_enabled = pViewer->transparency_enabled;
+    if (transparency_enabled && opacity < 1.) {
+      // On first pass, transparent objects are not drawn, but flag is set...
+      fSecondPassRequested = true;
+      return;
+    }
+  }
+
+  // On second pass, opaque objects are not drwan...
+  if (fSecondPass && opacity >= 1.) return;
+
+  // Else invoke base class method...
+  G4VSceneHandler::RequestPrimitives (solid);
+}
+
+G4int G4OpenGLImmediateSceneHandler::fSceneIdCount = 0;
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateViewer.cc	(revision 562)
@@ -0,0 +1,70 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateViewer.cc,v 1.8 2006/09/04 12:07:59 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLImmediateViewer : Encapsulates the `immediateness' of
+//                               an OpenGL view, for inheritance by
+//                               derived (X, Xm...) classes.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4OpenGLImmediateViewer.hh"
+
+G4OpenGLImmediateViewer::G4OpenGLImmediateViewer (G4OpenGLImmediateSceneHandler& scene):
+G4VViewer (scene, -1),
+G4OpenGLViewer (scene)
+{}
+
+void G4OpenGLImmediateViewer::ProcessView ()
+{
+  const G4Planes& cutaways = fVP.GetCutawayPlanes();
+  G4bool cutawayUnion = fVP.IsCutaway() &&
+    fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion;
+  size_t nPasses = cutawayUnion? cutaways.size(): 1;
+  for (size_t i = 0; i < nPasses; ++i) {
+
+    if (cutawayUnion) {
+      double a[4];
+      a[0] = cutaways[i].a();
+      a[1] = cutaways[i].b();
+      a[2] = cutaways[i].c();
+      a[3] = cutaways[i].d();
+      glClipPlane (GL_CLIP_PLANE2, a);
+      glEnable (GL_CLIP_PLANE2);
+    }
+
+    NeedKernelVisit ();  // Always need to visit G4 kernel.
+    G4VViewer::ProcessView ();
+
+    if (cutawayUnion) glDisable (GL_CLIP_PLANE2);
+  }
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateWin32.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateWin32.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateWin32.cc	(revision 562)
@@ -0,0 +1,80 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateWin32.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// OpenGLImmediateWin32 graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLImmediateWin32.hh"
+#include "G4OpenGLImmediateWin32Viewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+
+G4OpenGLImmediateWin32::G4OpenGLImmediateWin32 ():
+  G4VGraphicsSystem ("OpenGLImmediateWin32",
+		     "OGLIWin32",
+		     G4VisFeaturesOfOpenGLIWin32 (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLImmediateWin32::CreateSceneHandler
+(const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLImmediateWin32::CreateViewer
+(G4VSceneHandler& scene, const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLImmediateWin32Viewer
+    ((G4OpenGLImmediateSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLImmediateWin32::CreateViewer: error flagged by negative"
+	" view id in G4OpenGLImmediateWin32Viewer creation."
+	"\n Destroying view and returning null pointer."
+	   << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLImmediateWin32::CreateViewer: null pointer on"
+      " new G4OpenGLImmediateWin32Viewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateWin32Viewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateWin32Viewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateWin32Viewer.cc	(revision 562)
@@ -0,0 +1,120 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and
+//                                G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4OpenGLImmediateWin32Viewer.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLImmediateWin32Viewer::G4OpenGLImmediateWin32Viewer
+(G4OpenGLImmediateSceneHandler& sceneHandler,
+ const G4String&  name):
+G4OpenGLViewer (sceneHandler),
+G4OpenGLWin32Viewer (sceneHandler),
+G4OpenGLImmediateViewer (sceneHandler),
+G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name) {
+
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+}
+
+void G4OpenGLImmediateWin32Viewer::Initialise () {
+
+// ensure a suitable window was found
+
+  CreateGLWin32Context ();
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  glDrawBuffer (GL_FRONT);
+
+  // clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+}
+
+void G4OpenGLImmediateWin32Viewer::DrawView () {
+
+  // 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...
+  //Win32 version needed
+  //glXMakeCurrent (dpy, win, cx);
+  glViewport (0, 0, WinSize_x, WinSize_y);
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    NeedKernelVisit ();
+    ProcessView ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+  }
+
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+  ProcessView ();
+  FinishView ();
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLImmediateWin32Viewer::FinishView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fHDC) return;
+
+  glFlush ();
+
+  // Empty the Windows message queue :
+  MSG event;
+  while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
+    ::TranslateMessage(&event);
+    ::DispatchMessage (&event);
+  }
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateX.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateX.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateX.cc	(revision 562)
@@ -0,0 +1,83 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateX.cc,v 1.12 2006/08/14 12:07:19 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenGL graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLImmediateX.hh"
+#include "G4OpenGLImmediateXViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+#include "G4OpenGLXViewerMessenger.hh"
+
+G4OpenGLImmediateX::G4OpenGLImmediateX ():
+  G4VGraphicsSystem ("OpenGLImmediateX",
+		     "OGLIX",
+		     G4VisFeaturesOfOpenGLIX (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+  G4OpenGLXViewerMessenger::GetInstance();
+}
+
+G4OpenGLImmediateX::~G4OpenGLImmediateX () {}
+
+G4VSceneHandler* G4OpenGLImmediateX::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLImmediateX::CreateViewer (G4VSceneHandler& scene,
+					 const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLImmediateXViewer ((G4OpenGLImmediateSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLImmediateX::CreateViewer: error flagged by negative"
+	" view id in G4OpenGLImmediateXViewer creation."
+	"\n Destroying view and returning null pointer."
+	   << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLImmediateX::CreateViewer: null pointer on"
+      " new G4OpenGLImmediateXViewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateXViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateXViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateXViewer.cc	(revision 562)
@@ -0,0 +1,114 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateXViewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLImmediateXViewer : a class derived from G4OpenGLXViewer and
+//                                G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4OpenGLImmediateXViewer.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLImmediateXViewer::
+G4OpenGLImmediateXViewer (G4OpenGLImmediateSceneHandler& sceneHandler,
+			  const G4String&  name)
+ : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+   G4OpenGLViewer (sceneHandler),
+   G4OpenGLXViewer (sceneHandler),
+   G4OpenGLImmediateViewer (sceneHandler)
+{
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+
+// ensure a suitable window was found
+  if (!vi_immediate) {
+    G4cerr << "G4OpenGLImmediateXViewer::G4OpenGLImmediateXViewer -"
+      " G4OpenGLXViewer couldn't get a visual." << G4endl;  
+    fViewId = -1;  // This flags an error.
+    return;
+  }
+}
+
+G4OpenGLImmediateXViewer::~G4OpenGLImmediateXViewer () {}
+
+void G4OpenGLImmediateXViewer::Initialise () {
+
+  CreateGLXContext (vi_immediate);
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  InitializeGLView ();
+
+  // clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  glDrawBuffer (GL_FRONT);
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+}
+
+void G4OpenGLImmediateXViewer::DrawView () {
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //Make sure current viewer is attached and clean...
+  glXMakeCurrent (dpy, win, cx);
+  glViewport (0, 0, WinSize_x, WinSize_y);
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    NeedKernelVisit ();
+    ProcessView ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+  }
+
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+  ProcessView ();
+  FinishView ();
+
+}
+
+void G4OpenGLImmediateXViewer::FinishView () {
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propogated before progressing.
+  glFlush ();
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateXm.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateXm.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateXm.cc	(revision 562)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateXm.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLImmediateXm.hh"
+#include "G4OpenGLImmediateXmViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+#include "G4OpenGLXmViewerMessenger.hh"
+
+G4OpenGLImmediateXm::G4OpenGLImmediateXm ():
+  G4VGraphicsSystem ("OpenGLImmediateXm",
+		     "OGLIXm",
+		     G4VisFeaturesOfOpenGLIXm (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+  G4OpenGLXmViewerMessenger::GetInstance();
+}
+
+G4OpenGLImmediateXm::~G4OpenGLImmediateXm () {}
+
+G4VSceneHandler* G4OpenGLImmediateXm::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLImmediateSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLImmediateXm::CreateViewer (G4VSceneHandler& scene,
+					  const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLImmediateXmViewer ((G4OpenGLImmediateSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLImmediateXm::CreateViewer: error flagged by"
+	" negative view id in G4OpenGLImmediateXmViewer creation."
+	"\n Destroying view and returning null pointer." << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLImmediateXm::CreateViewer: null pointer on"
+      " new G4OpenGLImmediateXmViewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateXmViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateXmViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLImmediateXmViewer.cc	(revision 562)
@@ -0,0 +1,120 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLImmediateXmViewer.cc,v 1.17 2006/07/03 16:38:13 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  10th February 1997
+// Class G4OpenGLImmediateXmViewer : a class derived from G4OpenGLXmViewer
+//                                     and G4OpenGLImmediateViewer.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLImmediateXmViewer.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLImmediateXmViewer::
+G4OpenGLImmediateXmViewer(G4OpenGLImmediateSceneHandler& sceneHandler,
+                          const G4String& name)
+ : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+   G4OpenGLViewer (sceneHandler),
+   G4OpenGLXmViewer (sceneHandler),
+   G4OpenGLImmediateViewer (sceneHandler)
+{
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+
+// ensure a suitable window was found
+  if (!vi_immediate) {
+    G4cerr << "G4OpenGLImmediateXmViewer::G4OpenGLImmediateXmViewer -"
+      " G4OpenGLXmViewer couldn't get a visual." << G4endl;  
+    fViewId = -1;  // This flags an error.
+    return;
+  }
+}
+
+G4OpenGLImmediateXmViewer::~G4OpenGLImmediateXmViewer () {}
+
+void G4OpenGLImmediateXmViewer::Initialise () {
+
+  CreateGLXContext (vi_immediate);
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  InitializeGLView ();
+
+  // clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+  
+  glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+  glLineWidth (1.0);
+
+  glEnable (GL_BLEND);
+  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+  // If a double buffer context has been forced upon us, ignore the
+  // back buffer for this OpenGLImmediate view.
+  glDrawBuffer (GL_FRONT);
+}
+
+void G4OpenGLImmediateXmViewer::DrawView () {
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //Make sure current viewer is attached and clean...
+  glXMakeCurrent (dpy, win, cx);
+  glViewport (0, 0, WinSize_x, WinSize_y);
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    NeedKernelVisit ();
+    ProcessView ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+  }
+
+  NeedKernelVisit ();  // Always need to visit G4 kernel.
+  ProcessView ();
+  FinishView ();
+
+}
+
+void G4OpenGLImmediateXmViewer::FinishView () {
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propogated before progressing.
+  glFlush ();
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLQtViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLQtViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLQtViewer.cc	(revision 562)
@@ -0,0 +1,658 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLQtViewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// G4OpenGLQtViewer : Class to provide Qt specific
+//                     functionality for OpenGL in GEANT4
+//
+// 27/06/2003 : G.Barrand : implementation (at last !).
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4OpenGLQtViewer.hh"
+
+#include "G4ios.hh"
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+#include "G4Scene.hh"
+
+#include "G4Qt.hh"
+#include "G4UIManager.hh"
+#include <QtGui/qboxlayout.h>
+#include <QtGui/qdialog.h>
+#include <QtGui/qmenu.h>
+
+//////////////////////////////////////////////////////////////////////////////
+/**
+   Implementation of virtual method of G4VViewer
+*/
+void G4OpenGLQtViewer::SetView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  printf("G4OpenGLQtViewer::SetView ++++++++++++++++++++\n");
+  //   if(!fHDC) return;
+  //   if(!fHGLRC) return;
+  //   ::wglMakeCurrent(fHDC,fHGLRC);
+  //  fWindow->makeCurrent();
+  G4OpenGLViewer::SetView ();  
+  printf("G4OpenGLQtViewer::SetView --------------------\n");
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+/**
+   Implementation of virtual method of G4VViewer
+*/
+void G4OpenGLQtViewer::ShowView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  printf("G4OpenGLQtViewer::ShowView  +++++++++++++++++++++\n");
+  //   if(!fHDC) return;
+  //  fWindow->resize(100, 300);
+  glFlush ();
+  printf("G4OpenGLQtViewer::ShowView -----------------------\n");
+
+  //   // Empty the Windows message queue :
+  //   MSG event;
+  //   while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
+  //     ::TranslateMessage(&event);
+  //     ::DispatchMessage (&event);
+  //   }
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLQtViewer::CreateGLQtContext (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  printf("G4OpenGLQtViewer::CreateGLQtContext \n");
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLQtViewer::CreateMainWindow (
+                                         QGLWidget* glWidget
+                                         ) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+
+  if(fWindow) return; //Done.
+  printf("G4OpenGLQtViewer::CreateMainWindow glWidget\n");
+
+  // launch Qt if not
+  G4Qt* interactorManager = G4Qt::getInstance ();
+  //  G4UImanager* UI = G4UImanager::GetUIpointer();
+
+  fWindow = glWidget ;
+  //  fWindow->makeCurrent();
+
+  // create window
+  if (qApp) {
+    GLWindow = new QDialog();//qApp->mainWidget());
+  } else {
+    GLWindow = new QDialog();
+  }
+
+  QHBoxLayout *mainLayout = new QHBoxLayout;
+
+  mainLayout->addWidget(fWindow);
+  GLWindow->setLayout(mainLayout);
+  GLWindow->setWindowTitle("QGl Viewer");
+  GLWindow->resize(300, 300);
+  GLWindow->show();
+  
+  WinSize_x = 400;
+  WinSize_y = 400;
+  if (WinSize_x < fVP.GetWindowSizeHintX ())
+    WinSize_x = fVP.GetWindowSizeHintX ();
+  if (WinSize_y < fVP.GetWindowSizeHintY ())
+    WinSize_y = fVP.GetWindowSizeHintY ();
+
+  if(!fWindow) return;
+  printf("G4OpenGLQtViewer::CreateMainWindow glWidget END\n");
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+G4OpenGLQtViewer::G4OpenGLQtViewer (
+                                    G4OpenGLSceneHandler& scene
+                                    )
+  :G4VViewer (scene, -1)
+  ,G4OpenGLViewer (scene)
+  ,fWindow(0)
+  ,fContextMenu(0)
+  ,fMouseAction(true)
+                                   //,fHDC(0)
+                                   //,fHGLRC(0)
+                                   //////////////////////////////////////////////////////////////////////////////
+                                   //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  printf("G4OpenGLQtViewer::G4OpenGLQtViewer \n");
+}
+
+//////////////////////////////////////////////////////////////////////////////
+G4OpenGLQtViewer::~G4OpenGLQtViewer (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  printf("G4OpenGLQtViewer::~G4OpenGLQtViewer \n");
+  delete fContextMenu;
+
+  //   // This is the end (Jim Morisson).
+  //   if (fViewId >= 0) {
+  //     if(wglGetCurrentContext()!=NULL) wglMakeCurrent(NULL,NULL);
+  //     if(fHGLRC)	{
+  //       wglDeleteContext(fHGLRC);
+  //       fHGLRC = NULL;
+  //     }
+    
+  //     if(fWindow) {
+  //       ::SetWindowLong(fWindow,GWL_USERDATA,LONG(NULL));
+  //       if(fHDC) ::ReleaseDC(fWindow,fHDC);
+  //       ::DestroyWindow(fWindow);
+  //     }
+  //   }
+}
+
+
+void G4OpenGLQtViewer::createPopupMenu()    {
+
+  fContextMenu = new QMenu("All");
+
+  QMenu *mMouseAction = fContextMenu->addMenu("&Mouse action");
+  QAction *rotate = mMouseAction->addAction("&Rotate scene");
+  QAction *move = mMouseAction->addAction("&Move scene");
+  // INIT mMouse
+  createRadioAction(rotate,move,SLOT(toggleMouseAction(bool)),1);
+
+  //Style Menu
+  QMenu *mStyle = fContextMenu->addMenu("&Style");
+
+  QMenu *mRepresentation = mStyle->addMenu("&Representation");
+  QAction *polyhedron = mRepresentation->addAction("Polyhedron");
+  QAction *nurbs = mRepresentation->addAction("NURBS");
+  // INIT mStyle
+  G4ViewParameters::RepStyle style;
+  style = fVP.GetRepStyle();
+  if (style == G4ViewParameters::polyhedron) {
+    createRadioAction(polyhedron,nurbs,SLOT(toggleRepresentation(bool)),1);
+  } else if (style == G4ViewParameters::nurbs) {
+    createRadioAction(polyhedron,nurbs,SLOT(toggleRepresentation(bool)),2);
+  } else {
+    mRepresentation->clear();
+  }
+
+
+  QMenu *mDrawing = mStyle->addMenu("&Drawing");
+  fDrawingWireframe = mDrawing->addAction("Wireframe");
+  fDrawingWireframe->setCheckable(true);
+  fDrawingWireframe->setChecked(true);
+  fDrawingLineRemoval = mDrawing->addAction("Hidden line removal");
+  fDrawingLineRemoval->setCheckable(true);
+  fDrawingSurfaceRemoval = mDrawing->addAction("Hidden Surface removal");
+  fDrawingSurfaceRemoval->setCheckable(true);
+  fDrawingLineSurfaceRemoval = mDrawing->addAction("Hidden line and surface removal");
+  fDrawingLineSurfaceRemoval->setCheckable(true);
+  // INIT Drawing
+  G4ViewParameters::DrawingStyle d_style;
+  d_style = fVP.GetDrawingStyle();
+  
+  fDrawingWireframe->setCheckable(true);
+  fDrawingLineRemoval->setCheckable(true);
+  fDrawingSurfaceRemoval->setCheckable(true);
+  fDrawingLineSurfaceRemoval->setCheckable(true);
+
+  if (d_style == G4ViewParameters::wireframe) {
+    fDrawingWireframe->setChecked(true);
+  } else if (d_style == G4ViewParameters::hlr) {
+    fDrawingLineRemoval->setChecked(true);
+  } else if (d_style == G4ViewParameters::hsr) {
+    fDrawingSurfaceRemoval->setChecked(true);
+  } else if (d_style == G4ViewParameters::hlhsr) {
+    fDrawingLineSurfaceRemoval->setChecked(true);
+  } else {
+    mDrawing->clear();
+  }
+
+  QObject ::connect(fDrawingWireframe, SIGNAL(triggered(bool)),this, SLOT(actionDrawingWireframe()));
+  QObject ::connect(fDrawingLineRemoval, SIGNAL(triggered(bool)),this, SLOT(actionDrawingLineRemoval()));
+  QObject ::connect(fDrawingSurfaceRemoval, SIGNAL(triggered(bool)),this, SLOT(actionDrawingSurfaceRemoval()));
+  QObject ::connect(fDrawingLineSurfaceRemoval, SIGNAL(triggered(bool)),this, SLOT(actionDrawingLineSurfaceRemoval()));
+
+
+  QMenu *mBackground = mStyle->addMenu("&Background color");
+  QAction *white = mBackground->addAction("White");
+  QAction *black = mBackground->addAction("Black");
+  if (background.GetRed() == 1. &&
+      background.GetGreen() == 1. &&
+      background.GetBlue() == 1.) {
+    createRadioAction(white,black,SLOT(toggleBackground(bool)),1);
+  } else {
+    createRadioAction(white,black,SLOT(toggleBackground(bool)),2);
+  }
+
+
+  // Action Menu
+  QMenu *mActions = fContextMenu->addMenu("&Actions");
+  QAction *rotation = mActions->addAction("Rotation control panel");
+  QAction *panning = mActions->addAction("Panning control panel");
+  QAction *setControl = mActions->addAction("Set control panel limits");
+
+  // Miscellany Menu
+  QMenu * mMisc = fContextMenu->addMenu("&Miscellany");
+  QAction *miscellany = mMisc->addAction("Miscellany control panel");
+  QAction *exitG4 = mMisc->addAction("Exit to G4Vis >");
+  QAction *createEPS = mMisc->addAction("Create .eps file");
+
+  // Special Menu
+  QMenu *mSpecial = fContextMenu->addMenu("S&pecial");
+  QMenu *transparency = mSpecial->addMenu("Transparency");
+  QAction *transparencyOn = transparency->addAction("On");
+  QAction *transparencyOff = transparency->addAction("Off");
+  if (transparency_enabled == false) {
+    createRadioAction(transparencyOn,transparencyOff,SLOT(toggleTransparency(bool)),2);
+  } else if (transparency_enabled == true) {
+    createRadioAction(transparencyOn,transparencyOff,SLOT(toggleTransparency(bool)),1);
+  } else {
+    mSpecial->clear();
+  }
+
+
+  QMenu *mAntialiasing = mSpecial->addMenu("Antialiasing");
+  QAction *antialiasingOn = mAntialiasing->addAction("On");
+  QAction *antialiasingOff = mAntialiasing->addAction("Off");
+  if (antialiasing_enabled == false) {
+    createRadioAction(antialiasingOn,antialiasingOff,SLOT(toggleAntialiasing(bool)),2);
+  } else if (antialiasing_enabled == true) {
+    createRadioAction(antialiasingOn,antialiasingOff,SLOT(toggleAntialiasing(bool)),1);
+  } else {
+    mAntialiasing->clear();
+  }
+
+  QMenu *mHaloing = mSpecial->addMenu("Haloing");
+  QAction *haloingOn = mHaloing->addAction("On");
+  QAction *haloingOff = mHaloing->addAction("Off");
+  if (haloing_enabled == false) {
+    createRadioAction(haloingOn,haloingOff,SLOT(toggleHaloing(bool)),2);
+  } else if (haloing_enabled == true) {
+    createRadioAction(haloingOn,haloingOff,SLOT(toggleHaloing(bool)),1);
+  } else {
+    mHaloing->clear();
+  }
+
+  QMenu *mAux = mSpecial->addMenu("Auxiliary edges");
+  QAction *auxOn = mAux->addAction("On");
+  QAction *auxOff = mAux->addAction("Off");
+  if (!fVP.IsAuxEdgeVisible()) {
+    createRadioAction(auxOn,auxOff,SLOT(toggleAux(bool)),1);
+  } else {
+    createRadioAction(auxOn,auxOff,SLOT(toggleAux(bool)),2);
+  }
+
+
+  QMenu *mFullScreen = mSpecial->addMenu("Full screen");
+  QAction *fullOn = mFullScreen->addAction("On");
+  QAction *fullOff = mFullScreen->addAction("Off");
+  createRadioAction(fullOn,fullOff,SLOT(toggleFullScreen(bool)),2);
+
+}
+
+void G4OpenGLQtViewer::manageContextMenuEvent(QContextMenuEvent *e)
+{
+  if (!GLWindow) return;
+  
+  if (!fContextMenu) 
+    createPopupMenu();
+
+  // launch menu
+  if ( fContextMenu ) {
+    fContextMenu->exec( e->globalPos() );
+    //    delete fContextMenu;
+  }
+  e->accept();
+}
+
+
+/**
+   Create a radio button menu. The two menu will be connected. When click on one,
+   eatch state will be invert and callback method will be called.
+   @param action1 first action to connect
+   @param action2 second action to connect
+   @method callback method
+   @nCheck 1: first action xill be set true. 2 : second action will be set true
+*/
+void G4OpenGLQtViewer::createRadioAction(QAction *action1,QAction *action2, const std::string& method,unsigned int nCheck) {
+
+  action1->setCheckable(true);
+  action2->setCheckable(true);
+
+  if (nCheck ==1)
+    action1->setChecked (true);
+  else
+    action2->setChecked (true);
+   
+  QObject ::connect(action1, SIGNAL(triggered(bool)),action2, SLOT(toggle()));
+  QObject ::connect(action2, SIGNAL(triggered(bool)),action1, SLOT(toggle()));
+
+  QObject ::connect(action1, SIGNAL(toggled(bool)),this, method.c_str());
+
+}
+
+void G4OpenGLQtViewer::actionDrawingWireframe() {
+  emit toggleDrawingAction(1);
+}
+void G4OpenGLQtViewer::actionDrawingLineRemoval() {
+  emit toggleDrawingAction(2);
+}
+void G4OpenGLQtViewer::actionDrawingSurfaceRemoval() {
+  emit toggleDrawingAction(3);
+}
+void G4OpenGLQtViewer::actionDrawingLineSurfaceRemoval() {
+  emit toggleDrawingAction(4);
+}
+
+
+
+void G4OpenGLQtViewer::toggleDrawingAction(int aAction) {
+
+  G4ViewParameters::DrawingStyle d_style;
+  
+
+  if (aAction ==1) {
+    fDrawingWireframe->setChecked (true);
+    fDrawingLineRemoval->setChecked (false);
+    fDrawingSurfaceRemoval->setChecked (false);
+    fDrawingLineSurfaceRemoval->setChecked (false);
+
+    d_style = G4ViewParameters::wireframe;
+
+  } else  if (aAction ==2) {
+    fDrawingWireframe->setChecked (false);
+    fDrawingLineRemoval->setChecked (true);
+    fDrawingSurfaceRemoval->setChecked (false);
+    fDrawingLineSurfaceRemoval->setChecked (false);
+
+    d_style = G4ViewParameters::hlr;
+
+  } else  if (aAction ==3) {
+    fDrawingWireframe->setChecked (false);
+    fDrawingLineRemoval->setChecked (false);
+    fDrawingSurfaceRemoval->setChecked (true);
+    fDrawingLineSurfaceRemoval->setChecked (false);
+
+    d_style = G4ViewParameters::hsr;
+
+  } else  if (aAction ==4) {
+    fDrawingWireframe->setChecked (false);
+    fDrawingLineRemoval->setChecked (false);
+    fDrawingSurfaceRemoval->setChecked (false);
+    fDrawingLineSurfaceRemoval->setChecked (true);
+
+    d_style = G4ViewParameters::hlhsr;
+  }
+  fVP.SetDrawingStyle(d_style);
+
+  updateQWidget();
+  printf("G4OpenGLQtViewer::toggleDrawingAction\n");
+}
+
+
+/**
+   SLOT Activate by a click on the representation menu
+
+*/
+void G4OpenGLQtViewer::toggleRepresentation(bool check) {
+
+  G4ViewParameters::RepStyle style;
+  if (check == 1) {
+    style = G4ViewParameters::polyhedron;
+  } else {
+    style = G4ViewParameters::nurbs;
+  }
+  fVP.SetRepStyle (style);
+
+  printf("G4OpenGLQtViewer::toggleRepresentation 3%d\n",check);
+  updateQWidget();
+  printf("G4OpenGLQtViewer::toggleRepresentation 4%d\n",check);
+
+}
+void G4OpenGLQtViewer::toggleBackground(bool check) {
+
+  //   //I need to revisit the kernel if the background colour changes and
+  //   //hidden line removal is enabled, because hlr drawing utilises the
+  //   //background colour in its drawing...
+  //   // (Note added by JA 13/9/2005) Background now handled in view
+  //   // parameters.  A kernel visit is triggered on change of background.
+  if (check == 1) {
+    ((G4ViewParameters&)this->GetViewParameters()).
+      SetBackgroundColour(G4Colour(1.,1.,1.));  // White
+  } else {
+    ((G4ViewParameters&)this->GetViewParameters()).
+      SetBackgroundColour(G4Colour(0.,0.,0.));  // Black
+  }
+  updateQWidget();
+}
+
+void G4OpenGLQtViewer::toggleTransparency(bool check) {
+  
+  if (check) {
+    transparency_enabled = false;
+  } else {
+    transparency_enabled = true;
+  }
+  SetNeedKernelVisit (true);
+  updateQWidget();
+}
+
+void G4OpenGLQtViewer::toggleAntialiasing(bool check) {
+
+  if (!check) {
+    antialiasing_enabled = false;
+    glDisable (GL_LINE_SMOOTH);
+    glDisable (GL_POLYGON_SMOOTH);
+  } else {
+    antialiasing_enabled = true;
+    glEnable (GL_LINE_SMOOTH);
+    glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
+    glEnable (GL_POLYGON_SMOOTH);
+    glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+  }
+
+  updateQWidget();
+  //   pView->SetView ();
+  //   pView->ClearView ();
+  //   pView->DrawView ();
+
+  printf("G4OpenGLQtViewer::toggleRepresentation %d\n",check);
+}
+
+//FIXME : I SEE NOTHING...
+void G4OpenGLQtViewer::toggleHaloing(bool check) {
+  if (check) {
+    haloing_enabled = false;
+  } else {
+    haloing_enabled = true;
+  }
+
+  updateQWidget();
+
+  printf("G4OpenGLQtViewer::toggleRepresentation %d\n",check);
+}
+void G4OpenGLQtViewer::toggleAux(bool check) {
+  if (check) {
+    fVP.SetAuxEdgeVisible(false);
+  } else {
+    fVP.SetAuxEdgeVisible(true);
+  }
+  SetNeedKernelVisit (true);
+  updateQWidget();
+
+  printf("G4OpenGLQtViewer::toggleRepresentation %d\n",check);
+}
+void G4OpenGLQtViewer::toggleFullScreen(bool check) {
+  GLWindow->setWindowState(GLWindow->windowState() ^ Qt::WindowFullScreen);
+
+  printf("G4OpenGLQtViewer::toggleRepresentation %d\n",check);
+}
+
+void G4OpenGLQtViewer::toggleMouseAction(bool check) {
+  if (check) { // rotate scene
+    fMouseAction = true;
+  } else { // move scene
+    fMouseAction = false;
+  }
+
+  printf("G4OpenGLQtViewer::toggleRepresentation %d\n",check);
+}
+
+
+void G4OpenGLQtViewer::G4MousePressEvent(QPoint p)
+{
+  lastPos = p;
+}
+
+void G4OpenGLQtViewer::G4MouseMoveEvent(int pos_x, int pos_y,Qt::MouseButtons mButtons)
+{
+  int dx = pos_x - lastPos.x();
+  int dy = pos_y - lastPos.y();
+  
+  if (fMouseAction) {  // rotate
+    if (mButtons & Qt::LeftButton) {
+      //phi spin stuff here
+      
+      G4Vector3D vp = fVP.GetViewpointDirection ().unit ();
+      G4Vector3D up = fVP.GetUpVector ().unit ();
+      
+      G4Vector3D yprime = (up.cross(vp)).unit();
+      G4Vector3D zprime = (vp.cross(yprime)).unit();
+      
+      G4double delta_alpha;
+      G4double delta_theta;
+      
+      if (fVP.GetLightsMoveWithCamera()) {
+        delta_alpha = dy;
+        delta_theta = -dx;
+      } else {
+        delta_alpha = -dy;
+        delta_theta = dx;
+      }    
+
+      delta_alpha *= deg;
+      delta_theta *= deg;
+
+      G4Vector3D new_vp = std::cos(delta_alpha) * vp + std::sin(delta_alpha) * zprime;
+      
+      G4Vector3D new_up;
+      if (fVP.GetLightsMoveWithCamera()) {
+        new_up = (new_vp.cross(yprime)).unit();
+        fVP.SetUpVector(new_up);
+      } else {
+        new_up = up;
+      }
+      ////////////////
+      // Rotates by fixed azimuthal angle delta_theta.
+
+      G4double cosalpha = new_up.dot (new_vp.unit());
+      G4double sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
+      yprime = (new_up.cross (new_vp.unit())).unit ();
+      G4Vector3D xprime = yprime.cross (new_up);
+      // Projection of vp on plane perpendicular to up...
+      G4Vector3D a1 = sinalpha * xprime;
+      // Required new projection...
+      G4Vector3D a2 =
+        sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
+      // Required Increment vector...
+      G4Vector3D delta = a2 - a1;
+      // So new viewpoint is...
+      G4Vector3D viewPoint = new_vp.unit() + delta;
+
+      fVP.SetViewAndLights (viewPoint);
+      updateQWidget();
+      
+    } else if (mButtons & Qt::RightButton) {
+      // NEVER DONE BECAUSE OF MOUSE MENU
+      //       printf("G4OpenGLQtViewer::mouseMoveEvent Right \n");
+      //       setXRotation(xRot + dy/2);
+      //       setZRotation(zRot + dx/2);
+      //       updateQWidget();
+    }
+  } else {  // move
+
+    float dx = pos_x - lastPos.x();
+    float dy = pos_y - lastPos.y();
+    
+    G4Point3D stp
+      = GetSceneHandler()->GetScene()->GetStandardTargetPoint();
+    
+    G4Point3D tp = stp + fVP.GetCurrentTargetPoint ();
+    
+    const G4Vector3D& upVector = fVP.GetUpVector ();
+    const G4Vector3D& vpVector = fVP.GetViewpointDirection ();
+    
+    G4Vector3D unitRight = (upVector.cross (vpVector)).unit();
+    G4Vector3D unitUp    = (vpVector.cross (unitRight)).unit();
+    
+    tp += -dx * unitRight + dy * unitUp;
+    fVP.SetCurrentTargetPoint (tp - stp);
+    
+    updateQWidget();
+  }
+  lastPos = QPoint(pos_x, pos_y);
+}
+
+
+float G4OpenGLQtViewer::getXRot()
+{
+  return xRot;
+}
+
+float G4OpenGLQtViewer::getYRot()
+{
+  return yRot;
+}
+
+float G4OpenGLQtViewer::getZRot()
+{
+  return zRot;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLSceneHandler.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLSceneHandler.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLSceneHandler.cc	(revision 562)
@@ -0,0 +1,784 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLSceneHandler.cc,v 1.45 2006/08/30 11:37:34 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenGL stored scene - creates OpenGL display lists.
+// OpenGL immediate scene - draws immediately to buffer
+//                           (saving space on server).
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+// Included here - problems with HP compiler if not before other includes?
+#include "G4NURBS.hh"
+
+// Here follows a special for Mesa, the OpenGL emulator.  Does not affect
+// other OpenGL's, as far as I'm aware.   John Allison 18/9/96.
+#define CENTERLINE_CLPP  /* CenterLine C++ workaround: */
+// Also seems to be required for HP's CC and AIX xlC, at least.
+
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLFontBaseStore.hh"
+#include "G4OpenGLTransform3D.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+#include "G4Transform3D.hh"
+#include "G4Polyline.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+#include "G4VMarker.hh"
+#include "G4Polyhedron.hh"
+#include "G4VisAttributes.hh"
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Scene.hh"
+#include "G4VisExtent.hh"
+
+G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system,
+			      G4int id,
+			      const G4String& name):
+  G4VSceneHandler (system, id, name)
+{}
+
+G4OpenGLSceneHandler::~G4OpenGLSceneHandler ()
+{
+  ClearStore ();
+}
+
+const GLubyte G4OpenGLSceneHandler::fStippleMaskHashed [128] = {
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
+};
+
+const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron ()
+{
+  // Clipping done in G4OpenGLViewer::SetView.
+  return 0;
+
+  // But...OpenGL no longer seems to reconstruct clipped edges, so,
+  // when the BooleanProcessor is up to it, abandon this and use
+  // generic clipping in G4VSceneHandler::CreateSectionPolyhedron...
+  // return G4VSceneHandler::CreateSectionPolyhedron();
+}
+
+const G4Polyhedron* G4OpenGLSceneHandler::CreateCutawayPolyhedron ()
+{
+  // Cutaway done in G4OpenGLViewer::SetView.
+  return 0;
+
+  // But...if not, when the BooleanProcessor is up to it...
+  // return G4VSceneHandler::CreateCutawayPolyhedron();
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
+{
+  G4int nPoints = line.size ();
+  if (nPoints <= 0) return;
+
+  // Note: colour treated in sub-class.
+
+  if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
+    glDisable (GL_DEPTH_TEST);
+  else {glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LESS);}
+
+  glDisable (GL_LIGHTING);
+
+  G4double lineWidth = GetLineWidth(line);
+  glLineWidth(lineWidth);
+
+  glBegin (GL_LINE_STRIP);
+  for (G4int iPoint = 0; iPoint < nPoints; iPoint++) {
+  G4double x, y, z;
+    x = line[iPoint].x(); 
+    y = line[iPoint].y();
+    z = line[iPoint].z();
+    glVertex3d (x, y, z);
+  }
+  glEnd ();
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
+
+  const G4Colour& c = GetTextColour (text);  // Picks up default if none.
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize (text, sizeType);
+  G4ThreeVector position (text.GetPosition ());
+  G4String textString = text.GetText();
+
+  G4int font_base = G4OpenGLFontBaseStore::GetFontBase(fpViewer,size);
+  if (font_base < 0) {
+    static G4int callCount = 0;
+    ++callCount;
+    if (callCount <= 10 || callCount%100 == 0) {
+      G4cout <<
+	"G4OpenGLSceneHandler::AddPrimitive (const G4Text&) call count "
+	     << callCount <<
+	"\n  No fonts available."
+	"\n  Called with text \""
+	     << text.GetText ()
+	     << "\"\n  at " << position
+	     << ", size " << size
+	     << ", offsets " << text.GetXOffset () << ", " << text.GetYOffset ()
+	     << ", type " << G4int(sizeType)
+	     << ", colour " << c
+	     << G4endl;
+    }
+    return;
+  }
+  const char* textCString = textString.c_str();
+  glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+  glDisable (GL_DEPTH_TEST);
+  glDisable (GL_LIGHTING);
+  
+  glRasterPos3f(position.x(),position.y(),position.z());
+  // No action on offset or layout at present.
+  glPushAttrib(GL_LIST_BIT);
+  glListBase(font_base);
+  glCallLists(strlen(textCString), GL_UNSIGNED_BYTE, (GLubyte *)textCString);
+  glPopAttrib();
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Circle& circle) {
+  glEnable (GL_POINT_SMOOTH);
+  AddCircleSquare (circle, 24);
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) {
+  glDisable (GL_POINT_SMOOTH);
+  AddCircleSquare (square, 4);
+}
+
+void G4OpenGLSceneHandler::AddCircleSquare
+(const G4VMarker& marker,
+ G4int nSides) {
+
+  // Note: colour treated in sub-class.
+
+  if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
+    glDisable (GL_DEPTH_TEST);
+  else {glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LESS);}
+  
+  glDisable (GL_LIGHTING);
+  
+  G4double lineWidth = GetLineWidth(marker);
+  glLineWidth(lineWidth);
+
+  G4VMarker::FillStyle style = marker.GetFillStyle();
+  
+  switch (style) {
+  case G4VMarker::noFill: 
+    glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+    break;
+    
+  case G4VMarker::hashed:
+    /*
+    G4cout << "Hashed fill style in G4OpenGLSceneHandler."
+	   << "\n  Not implemented.  Using G4VMarker::filled."
+	   << G4endl;
+    */
+    glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+    glPolygonStipple (fStippleMaskHashed);
+    // See also:
+    //   if (style == G4VMarker::filled || style == G4VMarker::hashed)...
+    // (twice) below.
+    break;
+    
+  case G4VMarker::filled:
+    glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+    break;
+    
+  default:
+    G4cout << "Unrecognised fill style in G4OpenGLSceneHandler."
+	   << "\n  Using G4VMarker::filled."
+	   << G4endl;
+    glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+    break;
+    
+  }
+
+  // A few useful quantities...
+  G4Point3D centre = marker.GetPosition();
+  const G4Vector3D& viewpointDirection =
+    fpViewer -> GetViewParameters().GetViewpointDirection();
+  const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
+  MarkerSizeType sizeType;
+  G4double size = GetMarkerSize(marker, sizeType);
+
+  // Find "size" of marker in world space (but see note below)...
+  G4double worldSize;
+  if (sizeType == world) {  // Size specified in world coordinates.
+    worldSize = size;
+  }
+  else { // Size specified in screen (window) coordinates.
+
+    // Find window coordinates of centre...
+    GLdouble modelMatrix[16];
+    glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
+    G4double projectionMatrix[16];
+    glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix);
+    GLint viewport[4];
+    glGetIntegerv(GL_VIEWPORT,viewport);
+    GLdouble winx, winy, winz;
+    gluProject(centre.x(), centre.y(), centre.z(),
+	       modelMatrix, projectionMatrix, viewport,
+	       &winx, &winy, &winz);
+
+    // Determine ratio window:world...
+    const G4Vector3D inScreen = (up.cross(viewpointDirection)).unit();
+    const G4Vector3D p = centre + inScreen;
+    GLdouble winDx, winDy, winDz;
+    gluProject(p.x(), p.y(), p.z(),
+               modelMatrix, projectionMatrix, viewport,
+               &winDx, &winDy, &winDz);
+    G4double winWorldRatio = std::sqrt(std::pow(winx - winDx, 2) +
+				  std::pow(winy - winDy, 2));
+    worldSize = size / winWorldRatio;
+  }
+
+  // Draw...
+  DrawXYPolygon (worldSize, centre, nSides);
+}
+
+/***************************************************
+Note: We have to do it this way round so that when a global
+transformation is applied, such as with /vis/viewer/set/viewpoint,
+the markers follow the world coordinates without having to
+recreate the display lists.  The down side is that the markers
+rotate.  The only way to avoid this is to play with the modelview
+and projection matrices of OpenGL - which I need to think about.
+For future reference, here is the code to draw in window
+coordinates; its down side is that markers do not follow global
+transformations.  Some clever stuff is needed.
+
+  ...
+  // Find window coordinates of centre...
+  GLdouble modelMatrix[16];
+  glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
+  G4double projectionMatrix[16];
+  glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix);
+  GLint viewport[4];
+  glGetIntegerv(GL_VIEWPORT,viewport);
+  GLdouble winx, winy, winz;
+  gluProject(centre.x(), centre.y(), centre.z(),
+             modelMatrix, projectionMatrix, viewport,
+             &winx, &winy, &winz);
+
+  // Find window size...
+  G4double winSize;
+  if (size) {  // Size specified in world coordinates.
+    // Determine size in window coordinates...
+    (Note: improve this by using an inScreen vector as above.)
+    GLdouble winx1, winy1, winz1;
+    gluProject(centre.x() + size, centre.y() + size, centre.z() + size,
+               modelMatrix, projectionMatrix, viewport,
+               &winx1, &winy1, &winz1);
+    winSize = std::sqrt((std::pow(winx - winx1, 2) +
+                    std::pow(winy - winy1, 2) +
+                    std::pow(winz - winz1, 2)) / 3.);
+  }
+  else {
+    winSize = scale *
+      userSpecified ? marker.GetScreenSize() : def.GetScreenSize();
+  }
+
+  // Prepare to draw in window coordinates...
+  glMatrixMode (GL_PROJECTION);
+  glPushMatrix();
+  glLoadIdentity();
+  gluOrtho2D(GLdouble(viewport[0]),
+             GLdouble(viewport[0] + viewport[2]),
+             GLdouble(viewport[1]),
+             GLdouble(viewport[1] + viewport[3]));
+  glMatrixMode (GL_MODELVIEW);
+  glPushMatrix();
+  glLoadIdentity();
+
+  // Draw in window coordinates...
+  DrawScreenPolygon (winSize, G4Point3D(winx, winy, winz), nSides);
+
+  // Re-instate matrices...
+  glMatrixMode (GL_PROJECTION);
+  glPopMatrix();
+  glMatrixMode (GL_MODELVIEW);
+  glPopMatrix();
+  ...
+}
+
+void G4OpenGLSceneHandler::DrawScreenPolygon
+(G4double size,
+ const G4Point3D& centre,
+ G4int nSides) {
+  glBegin (GL_POLYGON);
+  const G4double dPhi = twopi / nSides;
+  const G4double r = size / 2.;
+  G4double phi;
+  G4int i;
+  for (i = 0, phi = -dPhi / 2.; i < nSides; i++, phi += dPhi) {
+    G4double x, y, z;
+    x = centre.x() + r * std::cos(phi);
+    y = centre.y() + r * std::sin(phi);
+    z = centre.z();
+    glVertex3d (x, y, z);
+  }
+  glEnd ();
+}
+**********************************************/
+
+void G4OpenGLSceneHandler::DrawXYPolygon
+(G4double size,
+ const G4Point3D& centre,
+ G4int nSides) {
+  const G4Vector3D& viewpointDirection =
+    fpViewer -> GetViewParameters().GetViewpointDirection();
+  const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
+  const G4double dPhi = twopi / nSides;
+  const G4double radius = size / 2.;
+  G4Vector3D start = radius * (up.cross(viewpointDirection)).unit();
+  G4double phi;
+  G4int i;
+  glBegin (GL_POLYGON);
+  for (i = 0, phi = 0.; i < nSides; i++, phi += dPhi) {
+    G4Vector3D r = start; r.rotate(phi, viewpointDirection);
+    G4Vector3D p = centre + r;
+    glVertex3d (p.x(), p.y(), p.z());
+  }
+  glEnd ();
+}
+
+//Method for handling G4Polyhedron objects for drawing solids.
+void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
+
+  // Assume all facets are planar convex quadrilaterals.
+  // Draw each facet individually
+  
+  if (polyhedron.GetNoFacets() == 0) return;
+
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
+
+  // Get view parameters that the user can force through the vis
+  // attributes, thereby over-riding the current view parameter.
+  G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+
+  //Get colour, etc...
+  G4bool transparency_enabled = true;
+  G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
+  if (pViewer) transparency_enabled = pViewer->transparency_enabled;
+  const G4Colour& c = GetColour (polyhedron);
+  GLfloat materialColour [4];
+  materialColour [0] = c.GetRed ();
+  materialColour [1] = c.GetGreen ();
+  materialColour [2] = c.GetBlue ();
+  if (transparency_enabled) {
+    materialColour [3] = c.GetAlpha ();
+  } else {
+    materialColour [3] = 1.;
+  }
+
+  G4double lineWidth = GetLineWidth(polyhedron);
+  glLineWidth(lineWidth);
+
+  GLfloat clear_colour[4];
+  glGetFloatv (GL_COLOR_CLEAR_VALUE, clear_colour);
+
+  G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+
+  G4bool clipping = pViewer->fVP.IsSection() || pViewer->fVP.IsCutaway();
+
+  switch (drawing_style) {
+  case (G4ViewParameters::hlhsr):
+    // Set up as for hidden line removal but paint polygon faces later...
+  case (G4ViewParameters::hlr):
+    glEnable (GL_STENCIL_TEST);
+    // The stencil buffer is cleared in G4OpenGLViewer::ClearView.
+    // The procedure below leaves it clear.
+    glStencilFunc (GL_ALWAYS, 0, 1);
+    glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT);
+    glEnable (GL_DEPTH_TEST);
+    glDepthFunc (GL_LEQUAL);
+    if (materialColour[3] < 1.) {
+      // Transparent...
+      glDisable (GL_CULL_FACE);
+      glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+    } else {
+      // Opaque...
+      if (clipping) {
+	glDisable (GL_CULL_FACE);
+	glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+      } else {
+	glEnable (GL_CULL_FACE);
+	glCullFace (GL_BACK);
+	glPolygonMode (GL_FRONT, GL_LINE);
+      }
+    }
+    glDisable (GL_LIGHTING);
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+    break;
+  case (G4ViewParameters::hsr):
+    glEnable (GL_DEPTH_TEST);
+    glDepthFunc (GL_LEQUAL);    
+    if (materialColour[3] < 1.) {
+      // Transparent...
+      glDepthMask (0);  // Make depth buffer read-only.
+      glDisable (GL_CULL_FACE);
+      glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+      glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, materialColour);
+    } else {
+      // Opaque...
+      glDepthMask (1);  // Make depth buffer writable (default).
+      if (clipping) {
+	glDisable (GL_CULL_FACE);
+	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+      } else {
+	glEnable (GL_CULL_FACE);
+	glCullFace (GL_BACK);
+	glPolygonMode (GL_FRONT, GL_FILL);
+      }
+      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColour);
+    }
+    glEnable (GL_LIGHTING);
+    break;
+  case (G4ViewParameters::wireframe):
+  default:
+    glEnable (GL_DEPTH_TEST);
+    glDepthFunc (GL_LEQUAL);    //??? was GL_ALWAYS
+    glDisable (GL_CULL_FACE);
+    glDisable (GL_LIGHTING);
+    glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+    break;
+  }
+
+  //Loop through all the facets...
+  glBegin (GL_QUADS);
+  G4bool notLastFace;
+  do {
+
+    //First, find vertices, edgeflags and normals and note "not last facet"...
+    G4Point3D vertex[4];
+    G4int edgeFlag[4];
+    G4Normal3D normals[4];
+    G4int n;
+    notLastFace = polyhedron.GetNextFacet(n, vertex, edgeFlag, normals);
+
+    //Loop through the four edges of each G4Facet...
+    G4int edgeCount = 0;
+    for(edgeCount = 0; edgeCount < n; ++edgeCount) {
+      // Check to see if edge is visible or not...
+      if (isAuxEdgeVisible) {
+	edgeFlag[edgeCount] = 1;
+      }
+      if (edgeFlag[edgeCount] > 0) {
+	glEdgeFlag (GL_TRUE);
+      } else {
+	glEdgeFlag (GL_FALSE);
+      }
+      glNormal3d (normals[edgeCount].x(), 
+		  normals[edgeCount].y(),
+		  normals[edgeCount].z());
+      glVertex3d (vertex[edgeCount].x(), 
+		  vertex[edgeCount].y(),
+		  vertex[edgeCount].z());
+    }
+    // HepPolyhedron produces triangles too; in that case add an extra
+    // vertex identical to first...
+    if (n == 3) {
+      edgeCount = 3;
+      normals[edgeCount] = normals[0];
+      vertex[edgeCount] = vertex[0];
+      edgeFlag[edgeCount] = -1;
+      glEdgeFlag (GL_FALSE);
+      glNormal3d (normals[edgeCount].x(),
+		  normals[edgeCount].y(), 
+		  normals[edgeCount].z());
+      glVertex3d (vertex[edgeCount].x(),
+		  vertex[edgeCount].y(), 
+		  vertex[edgeCount].z());
+    }
+    // Trap situation where number of edges is > 4...
+    if (n > 4) {
+      G4cerr <<
+	"G4OpenGLSceneHandler::AddPrimitive(G4Polyhedron): WARNING";
+      G4PhysicalVolumeModel* pPVModel =
+	dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+      if (pPVModel) {
+	G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
+	G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
+	G4cerr <<
+	"\n  Volume " << pCurrentPV->GetName() <<
+	", Solid " << pCurrentLV->GetSolid()->GetName() <<
+	  " (" << pCurrentLV->GetSolid()->GetEntityType();
+      }
+      G4cerr<<
+	"\n   G4Polyhedron facet with " << n << " edges" << G4endl;
+    }
+
+    // Do it all over again (twice) for hlr...
+    if  (drawing_style == G4ViewParameters::hlr ||
+	 drawing_style == G4ViewParameters::hlhsr) {
+
+      glEnd ();  // Placed here to balance glBegin above, allowing GL
+		 // state changes below, then glBegin again.  Avoids
+		 // having glBegin/End pairs *inside* loop in the more
+		 // usual case of no hidden line removal.
+
+      // Draw through stencil...
+      glStencilFunc (GL_EQUAL, 0, 1);
+      glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
+      if (drawing_style == G4ViewParameters::hlhsr) {
+	glEnable (GL_LIGHTING);
+      }
+      glEnable (GL_DEPTH_TEST);
+      glDepthFunc (GL_LEQUAL);    
+      if (materialColour[3] < 1.) {
+	// Transparent...
+	glDepthMask (0);  // Make depth buffer read-only.
+	glDisable (GL_CULL_FACE);
+	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+      } else {
+	// Opaque...
+	glDepthMask (1);  // Make depth buffer writable (default).
+	if (clipping) {
+	  glDisable (GL_CULL_FACE);
+	  glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+	} else {
+	  glEnable (GL_CULL_FACE);
+	  glCullFace (GL_BACK);
+	  glPolygonMode (GL_FRONT, GL_FILL);
+	}
+      }
+      GLfloat* painting_colour;
+      if  (drawing_style == G4ViewParameters::hlr) {
+	if (materialColour[3] < 1.) {
+	  // Transparent - don't paint...
+	  goto end_of_drawing_through_stencil;
+	}
+	painting_colour = clear_colour;
+      } else {  // drawing_style == G4ViewParameters::hlhsr
+	painting_colour = materialColour;
+      }
+      if (materialColour[3] < 1.) {
+	// Transparent...
+	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, painting_colour);
+      } else {
+	// Opaque...
+	glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, painting_colour);
+      }
+      glColor4fv (painting_colour);
+      glBegin (GL_QUADS);
+      for (int edgeCount = 0; edgeCount < 4; ++edgeCount) {
+	if (edgeFlag[edgeCount] > 0) {
+	  glEdgeFlag (GL_TRUE);
+	} else {
+	  glEdgeFlag (GL_FALSE);
+	}
+	glNormal3d (normals[edgeCount].x(), 
+		    normals[edgeCount].y(),
+		    normals[edgeCount].z());
+	glVertex3d (vertex[edgeCount].x(), 
+		    vertex[edgeCount].y(),
+		    vertex[edgeCount].z());
+      }
+      glEnd ();
+    end_of_drawing_through_stencil:
+
+      // and once more to reset the stencil bits...
+      glStencilFunc (GL_ALWAYS, 0, 1);
+      glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT);
+      glDepthFunc (GL_LEQUAL);  // to make sure line gets drawn.  
+      if (materialColour[3] < 1.) {
+	// Transparent...
+	glDisable (GL_CULL_FACE);
+	glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+      } else {
+	// Opaque...
+	if (clipping) {
+	  glDisable (GL_CULL_FACE);
+	  glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+	} else {
+	  glEnable (GL_CULL_FACE);
+	  glCullFace (GL_BACK);
+	  glPolygonMode (GL_FRONT, GL_LINE);
+	}
+      }
+      glDisable (GL_LIGHTING);
+      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+      glBegin (GL_QUADS);
+      for (int edgeCount = 0; edgeCount < 4; ++edgeCount) {
+	if (edgeFlag[edgeCount] > 0) {
+	  glEdgeFlag (GL_TRUE);
+	} else {
+	  glEdgeFlag (GL_FALSE);
+	}
+	glNormal3d (normals[edgeCount].x(), 
+		    normals[edgeCount].y(),
+		    normals[edgeCount].z());
+	glVertex3d (vertex[edgeCount].x(), 
+		    vertex[edgeCount].y(),
+		    vertex[edgeCount].z());
+      }
+      glEnd ();
+      glDepthFunc (GL_LEQUAL);   // Revert for next facet.
+      glBegin (GL_QUADS);      // Ready for next facet.  GL
+			       // says it ignores incomplete
+			       // quadrilaterals, so final empty
+			       // glBegin/End sequence should be OK.
+    }
+  } while (notLastFace);  
+  
+  glEnd ();
+  glDisable (GL_STENCIL_TEST);  // Revert to default for next primitive.
+  glDepthMask (1);              // Revert to default for next primitive.
+}
+
+//Method for handling G4NURBS objects for drawing solids.
+//Knots and Ctrl Pnts MUST be arrays of GLfloats.
+void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) {
+
+  GLUnurbsObj *gl_nurb;
+  gl_nurb = gluNewNurbsRenderer ();
+
+  GLfloat *u_knot_array, *u_knot_array_ptr;
+  u_knot_array = u_knot_array_ptr = new GLfloat [nurb.GetnbrKnots(G4NURBS::U)];
+  G4NURBS::KnotsIterator u_iterator (nurb, G4NURBS::U);
+  while (u_iterator.pick (u_knot_array_ptr++));
+
+  GLfloat *v_knot_array, *v_knot_array_ptr;
+  v_knot_array = v_knot_array_ptr = new GLfloat [nurb.GetnbrKnots(G4NURBS::V)];
+  G4NURBS::KnotsIterator v_iterator (nurb, G4NURBS::V);
+  while (v_iterator.pick (v_knot_array_ptr++));
+
+  GLfloat *ctrl_pnt_array, *ctrl_pnt_array_ptr;
+  ctrl_pnt_array = ctrl_pnt_array_ptr =
+    new GLfloat [nurb.GettotalnbrCtrlPts () * G4NURBS::NofC];
+  G4NURBS::CtrlPtsCoordsIterator c_p_iterator (nurb);
+  while (c_p_iterator.pick (ctrl_pnt_array_ptr++));
+
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (nurb.GetVisAttributes ());
+
+  // Get view parameters that the user can force through the vis
+  // attributes, thereby over-riding the current view parameter.
+  G4ViewParameters::DrawingStyle drawing_style = GetDrawingStyle (pVA);
+  //G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
+  
+  //Get colour, etc..
+  const G4Colour& c = pVA -> GetColour ();
+
+  switch (drawing_style) {
+
+  case (G4ViewParameters::hlhsr):
+    //    G4cout << "Hidden line removal not implememented in G4OpenGL.\n"
+    // << "Using hidden surface removal." << G4endl;
+  case (G4ViewParameters::hsr):
+    {
+      glEnable (GL_LIGHTING);
+      glEnable (GL_DEPTH_TEST);
+      glEnable (GL_AUTO_NORMAL);
+      glEnable (GL_NORMALIZE);
+      gluNurbsProperty (gl_nurb, GLU_DISPLAY_MODE, GLU_FILL);
+      gluNurbsProperty (gl_nurb, GLU_SAMPLING_TOLERANCE, 50.0);
+      GLfloat materialColour [4];
+      materialColour [0] = c.GetRed ();
+      materialColour [1] = c.GetGreen ();
+      materialColour [2] = c.GetBlue ();
+      materialColour [3] = 1.0;  // = c.GetAlpha () for transparency -
+				 // but see complication in
+				 // AddPrimitive(const G4Polyhedron&).
+      glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColour);
+      break;
+    }
+  case (G4ViewParameters::hlr):
+    //    G4cout << "Hidden line removal not implememented in G4OpenGL.\n"
+    // << "Using wireframe." << G4endl;
+  case (G4ViewParameters::wireframe):
+  default:
+    glDisable (GL_LIGHTING);
+//    glDisable (GL_DEPTH_TEST);
+    glEnable (GL_DEPTH_TEST);
+    glDisable (GL_AUTO_NORMAL);
+    glDisable (GL_NORMALIZE);
+    gluNurbsProperty (gl_nurb, GLU_DISPLAY_MODE, GLU_OUTLINE_POLYGON);
+    gluNurbsProperty (gl_nurb, GLU_SAMPLING_TOLERANCE, 50.0);
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+    break;
+  }	
+
+  gluBeginSurface (gl_nurb);
+  G4int u_stride = 4;
+  G4int v_stride = nurb.GetnbrCtrlPts(G4NURBS::U) * 4;
+
+  gluNurbsSurface (gl_nurb, 
+		   nurb.GetnbrKnots (G4NURBS::U), (GLfloat*)u_knot_array, 
+		   nurb.GetnbrKnots (G4NURBS::V), (GLfloat*)v_knot_array,
+		   u_stride,
+		   v_stride,  
+		   ctrl_pnt_array,
+		   nurb.GetUorder (),
+		   nurb.GetVorder (), 
+		   GL_MAP2_VERTEX_4);
+  
+  gluEndSurface (gl_nurb);
+
+  delete [] u_knot_array;  // These should be allocated with smart allocators
+  delete [] v_knot_array;  // to avoid memory explosion.
+  delete [] ctrl_pnt_array;
+
+  gluDeleteNurbsRenderer (gl_nurb);
+}
+
+void G4OpenGLSceneHandler::AddCompound(const G4VTrajectory& traj) {
+  G4VSceneHandler::AddCompound(traj);  // For now.
+}
+
+void G4OpenGLSceneHandler::AddCompound(const G4VHit& hit) {
+  G4VSceneHandler::AddCompound(hit);  // For now.
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredQt.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredQt.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredQt.cc	(revision 562)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredQt.cc,v 1.11 2007/06/24 12:07:19 $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// OpenGLStoredQt graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredQt.hh"
+#include "G4OpenGLStoredQtViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+
+G4OpenGLStoredQt::G4OpenGLStoredQt ():
+  G4VGraphicsSystem ("OpenGLStoredQt",
+		     "OGLSQT",
+		     G4VisFeaturesOfOpenGLIQt (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLStoredQt::CreateSceneHandler
+(const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLStoredSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLStoredQt::CreateViewer
+(G4VSceneHandler& scene, const G4String& name) {
+  printf("G4OpenGLStoredQt::CreateViewer \n");
+  G4VViewer* pView =
+    new G4OpenGLStoredQtViewer
+    ((G4OpenGLStoredSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      G4cerr << "G4OpenGLStoredQt::CreateViewer: error flagged by negative"
+	" view id in G4OpenGLStoredQtViewer creation."
+	"\n Destroying view and returning null pointer."
+	   << G4endl;
+      delete pView;
+      pView = 0;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLStoredQt::CreateViewer: null pointer on"
+      " new G4OpenGLStoredQtViewer." << G4endl;
+  }
+  printf("G4OpenGLStoredQt::CreateViewer END \n");
+   return pView;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredQtViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredQtViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredQtViewer.cc	(revision 562)
@@ -0,0 +1,259 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredQtViewer.cc,v 1.16 2007/06/25 16:38:13 $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+//
+// Class G4OpenGLStoredQtViewer : a class derived from G4OpenGLQtViewer and
+//                                G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
+
+#include "G4OpenGLStoredQtViewer.hh"
+#include "G4VisManager.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer
+(G4OpenGLStoredSceneHandler& sceneHandler,
+ const G4String&  name):
+ G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+ G4OpenGLViewer (sceneHandler),
+ G4OpenGLQtViewer (sceneHandler),
+ G4OpenGLStoredViewer (sceneHandler),
+ QGLWidget()                      // FIXME : gerer le pb du parent !
+ {
+   nbPaint =0;
+   hasToRepaint =false;
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+}
+
+G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() {
+   printf("GLWidget::~GLWidget \n");
+     makeCurrent();
+   printf("GLWidget::~GLWidget END\n");
+}
+
+void G4OpenGLStoredQtViewer::Initialise() {
+   printf("GLWidget::Initialise \n");
+   readyToPaint = false;
+   CreateGLQtContext ();
+   printf("G4OpenGLStoredQtViewer::Initialise () 2\n");
+
+  CreateMainWindow (this);
+  printf("G4OpenGLStoredQtViewer::Initialise () 3\n");
+
+  CreateFontLists ();  // FIXME Does nothing!
+  
+  printf("readyToPaint = true \n");
+  readyToPaint = true;
+  
+  // First Draw
+  SetView();
+  printf("    ClearView\n");
+  ClearView (); //ok, put the background correct
+  ShowView();
+  FinishView();
+}
+
+void G4OpenGLStoredQtViewer::initializeGL () {
+
+   InitializeGLView ();
+
+   printf("G4OpenGLStoredQtViewer::InitialiseGL () 1\n");
+
+   // clear the buffers and window.
+   ClearView ();
+   //   printf("G4OpenGLStoredQtViewer::InitialiseGL () 2\n");
+   FinishView ();
+   
+   glDepthFunc (GL_LEQUAL);
+   glDepthMask (GL_TRUE);
+
+   hasToRepaint =true;
+
+   printf("G4OpenGLStoredQtViewer::InitialiseGL  -------------------------------------------------------------------------------------\n");
+}
+
+
+void G4OpenGLStoredQtViewer::DrawView () {
+
+  printf("G4OpenGLStoredQtViewer::DrawView %d %d   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y);
+
+   G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+   //Make sure current viewer is attached and clean...
+   //Qt version needed
+   glViewport (0, 0, WinSize_x, WinSize_y);
+
+   //See if things have changed from last time and remake if necessary...
+   // The fNeedKernelVisit flag might have been set by the user in
+   // /vis/viewer/rebuild, but if not, make decision and set flag only
+   // if necessary...
+   if (!fNeedKernelVisit) KernelVisitDecision ();
+   G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+   ProcessView ();
+   
+
+   if(style!=G4ViewParameters::hlr &&
+      haloing_enabled) {
+     printf("G4OpenGLStoredQtViewer::DrawView DANS LE IF\n");
+
+     HaloingFirstPass ();
+     DrawDisplayLists ();
+     glFlush ();
+
+     HaloingSecondPass ();
+
+     DrawDisplayLists ();
+
+   } else {
+     
+     // If kernel visit was needed, drawing and FinishView will already
+     // have been done, so...
+     if (!kernelVisitWasNeeded) {
+       DrawDisplayLists ();
+     } else {
+       // However, union cutaways are implemented in DrawDisplayLists, so make
+       // an extra pass...
+       if (fVP.IsCutaway() &&
+           fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
+         ClearView();
+         DrawDisplayLists ();
+       }
+     }
+   }
+
+   FinishView ();
+  printf("G4OpenGLStoredQtViewer::DrawView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",WinSize_x, WinSize_y);
+   hasToRepaint =true;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLStoredQtViewer::FinishView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  printf("G4OpenGLStoredQtViewer::FinishView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");
+
+  glFlush ();
+  swapBuffers ();
+  printf("G4OpenGLStoredQtViewer::FinishView ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
+
+}
+
+
+/**
+ - Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
+ */
+void G4OpenGLStoredQtViewer::resizeGL(
+ int aWidth
+,int aHeight)
+{  
+  glViewport(0, 0, aWidth, aHeight);
+  glMatrixMode(GL_PROJECTION);
+  glMatrixMode(GL_MODELVIEW);
+
+   if (((WinSize_x != (G4int)aWidth)) || (WinSize_y != (G4int) aHeight)) {
+     hasToRepaint =true;
+   }
+   WinSize_x = (G4int) aWidth;
+   WinSize_y = (G4int) aHeight;
+
+  printf("G4OpenGLStoredQtViewer::resizeGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d %d=%d %d=%d\n",hasToRepaint,width(),aWidth,height(),aHeight);
+}
+
+
+
+void G4OpenGLStoredQtViewer::paintGL()
+ {
+   if (!readyToPaint) {
+     printf("\n\nG4OpenGLStoredQtViewer::paintGL ============  Not ready %d\n",readyToPaint);
+     readyToPaint= true;
+     return;
+   }
+   // DO NOT RESIZE IF SIZE HAS NOT CHANGE :
+   //    WHEN CLICK ON THE FRAME FOR EXAMPLE
+   //    EXECEPT WHEN MOUSE MOVE EVENT
+   if ( !hasToRepaint) {
+     if (((WinSize_x == (G4int)width())) &&(WinSize_y == (G4int) height())) {
+       printf("\n\nG4OpenGLStoredQtViewer::paintGL ============  Dont repaint\n");
+       return;
+     }
+   }
+   nbPaint++;
+   printf("\n\nG4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV %d ready %d\n",nbPaint,readyToPaint);
+   WinSize_x = (G4int) width();
+   WinSize_y = (G4int) height();
+   
+   glViewport (0, 0, width(), height());
+   //   glLoadIdentity();
+   
+
+   SetView();
+
+//   //  printf("before ClearView\n");
+   printf("    ClearView\n");
+   
+   ClearView (); //ok, put the background correct
+   glRotated(getXRot(), 1.0, 0.0, 0.0);
+   glRotated(getYRot(), 0.0, 1.0, 0.0);
+   glRotated(getZRot(), 0.0, 0.0, 1.0);
+   DrawView();
+
+   hasToRepaint =false;
+
+   printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d ready %d\n\n\n",nbPaint,readyToPaint);
+ }
+
+void G4OpenGLStoredQtViewer::mousePressEvent(QMouseEvent *event)
+{
+  printf("G4OpenGLStoredQtViewer::mousePressEvent\n");
+  G4MousePressEvent(event->pos());
+}
+
+void G4OpenGLStoredQtViewer::mouseMoveEvent(QMouseEvent *event)
+{
+  G4MouseMoveEvent(event->x(),event->y(),event->buttons());
+  //  DrawView();
+}
+
+
+void G4OpenGLStoredQtViewer::contextMenuEvent(QContextMenuEvent *e)
+{
+  manageContextMenuEvent(e);
+}
+
+void G4OpenGLStoredQtViewer::updateQWidget() {
+  hasToRepaint= true;
+  updateGL();
+  hasToRepaint= false;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredSceneHandler.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredSceneHandler.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredSceneHandler.cc	(revision 562)
@@ -0,0 +1,392 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredSceneHandler.cc,v 1.31 2006/08/30 11:43:57 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL stored scene - creates OpenGL display lists.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+// Included here - problems with HP compiler if not before other includes?
+#include "G4NURBS.hh"
+
+// Here follows a special for Mesa, the OpenGL emulator.  Does not affect
+// other OpenGL's, as far as I'm aware.   John Allison 18/9/96.
+#define CENTERLINE_CLPP  /* CenterLine C++ workaround: */
+// Also seems to be required for HP's CC and AIX xlC, at least.
+
+#include "G4OpenGLStoredSceneHandler.hh"
+
+#include "G4PhysicalVolumeModel.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4Polyline.hh"
+#include "G4Polymarker.hh"
+#include "G4Circle.hh"
+#include "G4Square.hh"
+
+G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system,
+					  const G4String& name):
+G4OpenGLSceneHandler (system, fSceneIdCount++, name),
+fMemoryForDisplayLists (true),
+fAddPrimitivePreambleNestingDepth (0),
+fTopPODL (0)
+{}
+
+G4OpenGLStoredSceneHandler::~G4OpenGLStoredSceneHandler ()
+{}
+
+void G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
+{
+  // Track nesting depth to avoid recursive calls, for example, from a
+  // G4Polymarker that invokes a G4Circle...
+  fAddPrimitivePreambleNestingDepth++;
+  if (fAddPrimitivePreambleNestingDepth > 1) return;
+
+  const G4Colour& c = GetColour (visible);
+
+  if (fMemoryForDisplayLists && fReadyForTransients) {
+
+    TO& to = fTOList.back();  // Transient object information.
+
+    // Get vis attributes - pick up defaults if none.
+    const G4VisAttributes* pVA =
+      fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());
+
+    // Get time information from vis attributes.
+    to.fStartTime = pVA->GetStartTime();
+    to.fEndTime = pVA->GetEndTime();
+
+    // Keep colour out of (already started) display list so that it
+    // can be applied independently.
+    glEndList();
+    glDeleteLists(fDisplayListId, 1);
+    to.fColour = c;
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+    glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
+      
+  } else {
+
+    // Make sure colour is set in other cases.
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+  }
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitivePostamble()
+{
+  fAddPrimitivePreambleNestingDepth--;
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)
+{
+  AddPrimitivePreamble(polyline);
+  G4OpenGLSceneHandler::AddPrimitive(polyline);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle)
+{
+  AddPrimitivePreamble(circle);
+  G4OpenGLSceneHandler::AddPrimitive(circle);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square)
+{
+  AddPrimitivePreamble(square);
+  G4OpenGLSceneHandler::AddPrimitive(square);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
+{
+  AddPrimitivePreamble(polymarker);
+  G4OpenGLSceneHandler::AddPrimitive(polymarker);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation) {
+  
+  G4VSceneHandler::BeginPrimitives (objectTransformation);
+
+  if (fMemoryForDisplayLists) {
+    fDisplayListId = glGenLists (1);
+    if (!fDisplayListId) {  // Could pre-allocate?
+      G4cout << "********************* WARNING! ********************\n"
+	   <<"Unable to allocate any more display lists in OpenGL.\n "
+	   << "      Continuing drawing in IMMEDIATE MODE.\n"
+	   << "***************************************************" << G4endl;
+      fMemoryForDisplayLists = false;
+    }
+  }
+  if (fMemoryForDisplayLists) {
+    if (fReadyForTransients) {
+      TO to(fDisplayListId, objectTransformation);
+      fTOList.push_back(to);
+      glDrawBuffer (GL_FRONT);
+      glPushMatrix();
+      G4OpenGLTransform3D oglt (objectTransformation);
+      glMultMatrixd (oglt.GetGLMatrix ());
+      glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
+    }
+    else {
+      fPOList.push_back(PO(fDisplayListId, objectTransformation));
+      glNewList (fDisplayListId, GL_COMPILE);
+    }
+  } else {
+    glDrawBuffer (GL_FRONT);
+    glPushMatrix();
+    G4OpenGLTransform3D oglt (objectTransformation);
+    glMultMatrixd (oglt.GetGLMatrix ());
+  }
+}
+
+void G4OpenGLStoredSceneHandler::EndPrimitives () {
+  if (fMemoryForDisplayLists) {
+    glEndList();
+  }
+  if (fReadyForTransients || !fMemoryForDisplayLists) {
+    glPopMatrix();
+    glFlush ();
+    glDrawBuffer (GL_BACK);
+  }
+  G4VSceneHandler::EndPrimitives ();
+}
+
+void G4OpenGLStoredSceneHandler::BeginPrimitives2D()
+{
+  G4VSceneHandler::BeginPrimitives2D();
+
+  if (fMemoryForDisplayLists) {
+    fDisplayListId = glGenLists (1);
+    if (!fDisplayListId) {  // Could pre-allocate?
+      G4cout << "********************* WARNING! ********************\n"
+	   <<"Unable to allocate any more display lists in OpenGL.\n "
+	   << "      Continuing drawing in IMMEDIATE MODE.\n"
+	   << "***************************************************" << G4endl;
+      fMemoryForDisplayLists = false;
+    }
+  }
+  if (fMemoryForDisplayLists) {
+    if (fReadyForTransients) {
+      fTOList.push_back(TO(fDisplayListId));
+      glDrawBuffer (GL_FRONT);
+      glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
+    }
+    else {
+      fPOList.push_back(PO(fDisplayListId));
+      glNewList (fDisplayListId, GL_COMPILE);
+    }
+  } else {
+    glDrawBuffer (GL_FRONT);
+  }
+  // Push current 3D world matrices and load identity to define screen
+  // coordinates...
+  glMatrixMode (GL_PROJECTION);
+  glPushMatrix();
+  glLoadIdentity();
+  glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
+  glMatrixMode (GL_MODELVIEW);
+  glPushMatrix();
+  glLoadIdentity();
+}
+
+void G4OpenGLStoredSceneHandler::EndPrimitives2D ()
+{
+  // Pop current 3D world matrices back again...
+  glMatrixMode (GL_PROJECTION);
+  glPopMatrix();
+  glMatrixMode (GL_MODELVIEW);
+  glPopMatrix();
+
+  if (fMemoryForDisplayLists) {
+    glEndList();
+  }
+  if (fReadyForTransients || !fMemoryForDisplayLists) {
+    glFlush ();
+    glDrawBuffer (GL_BACK);
+  }
+  G4VSceneHandler::EndPrimitives2D ();
+}
+
+void G4OpenGLStoredSceneHandler::BeginModeling () {
+  G4VSceneHandler::BeginModeling();
+  ClearStore();  // ...and all that goes with it.
+  /* Debug...
+  fDisplayListId = glGenLists (1);
+  G4cout << "OGL::fDisplayListId (start): " << fDisplayListId << G4endl;
+  */
+}
+
+void G4OpenGLStoredSceneHandler::EndModeling () {
+  // Make a List which calls the other lists.
+  fTopPODL = glGenLists (1);
+  if (!fTopPODL) {
+    G4cout <<
+      "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
+      "  display List for fTopPODL - try OpenGL Immediated mode."
+	   << G4endl;
+  }
+  else {
+    glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); {
+      for (size_t i = 0; i < fPOList.size (); i++) {
+	glPushMatrix();
+	G4OpenGLTransform3D oglt (fPOList[i].fTransform);
+	glMultMatrixd (oglt.GetGLMatrix ());
+	glCallList (fPOList[i].fDisplayListId);
+	glPopMatrix();
+      }
+    }
+    glEndList ();
+  }
+
+  G4VSceneHandler::EndModeling ();
+
+  /* Debug...
+  fDisplayListId = glGenLists (1);
+  G4cout << "OGL::fDisplayListId (end): " << fDisplayListId << G4endl;
+  */
+}
+
+void G4OpenGLStoredSceneHandler::ClearStore () {
+
+  G4VSceneHandler::ClearStore ();  // Sets need kernel visit, etc.
+
+  // Delete OpenGL permanent display lists.
+  for (size_t i = 0; i < fPOList.size (); i++)
+    glDeleteLists (fPOList[i].fDisplayListId, 1);
+  if (fTopPODL) glDeleteLists (fTopPODL, 1);
+  fTopPODL = 0;
+
+  // Clear other lists, dictionary, etc.
+  fPOList.clear ();
+  fSolidMap.clear ();
+
+  // ...and clear transient store...
+  for (size_t i = 0; i < fTOList.size (); i++)
+    glDeleteLists(fTOList[i].fDisplayListId, 1);
+  fTOList.clear ();
+}
+
+void G4OpenGLStoredSceneHandler::ClearTransientStore () {
+
+  G4VSceneHandler::ClearTransientStore ();
+
+  // Delete OpenGL transient display lists and Transient Objects themselves.
+  for (size_t i = 0; i < fTOList.size (); i++)
+    glDeleteLists(fTOList[i].fDisplayListId, 1);
+  fTOList.clear ();
+
+  // Make sure screen corresponds to graphical database...
+  if (fpViewer) {
+    fpViewer -> SetView ();
+    fpViewer -> ClearView ();
+    fpViewer -> DrawView ();
+  }
+}
+
+void G4OpenGLStoredSceneHandler::RequestPrimitives (const G4VSolid& solid)
+{
+  if (fReadyForTransients) {
+    // Always draw transient solids, e.g., hits represented as solids.
+    // (As we have no control over the order of drawing of transient
+    // objects, we cannot do anything about transparent ones, as
+    // below, so always draw them.)
+    G4VSceneHandler::RequestPrimitives (solid);
+    return;
+  }
+
+  // For non-transient (run-duration) objects, ensure transparent
+  // objects are drawn last.  The problem of
+  // blending/transparency/alpha is quite a tricky one - see History
+  // of opengl-V07-01-01/2/3.
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes(fpVisAttribs);
+  const G4Colour& c = pVA -> GetColour ();
+  G4double opacity = c.GetAlpha ();
+
+  if (!fSecondPass) {
+    G4bool transparency_enabled = true;
+    G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
+    if (pViewer) transparency_enabled = pViewer->transparency_enabled;
+    if (transparency_enabled && opacity < 1.) {
+      // On first pass, transparent objects are not drawn, but flag is set...
+      fSecondPassRequested = true;
+      return;
+    }
+  }
+
+  // On second pass, opaque objects are not drwan...
+  if (fSecondPass && opacity >= 1.) return;
+
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+ 
+  if (pPVModel) {
+    // If part of the geometry hierarchy, i.e., from a
+    // G4PhysicalVolumeModel, check if a display list already exists for
+    // this solid, re-use it if possible.  We could be smarter, and
+    // recognise repeated branches of the geometry hierarchy, for
+    // example.  But this algorithm should be secure, I think...
+    const G4VSolid* pSolid = &solid;
+    EAxis axis = kRho;
+    G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
+    if (pCurrentPV -> IsReplicated ()) {
+      G4int nReplicas;
+      G4double width;
+      G4double offset;
+      G4bool consuming;
+      pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
+    }
+    // Provided it is not parametrised (because if so, the
+    // solid's parameters might have been changed)...
+    if (!(pCurrentPV -> IsParameterised ()) &&
+	// Provided it is not replicated radially (because if so, the
+	// solid's parameters will have been changed)...
+	!(pCurrentPV -> IsReplicated () && axis == kRho) &&
+	// ...and if the solid has already been rendered...
+	(fSolidMap.find (pSolid) != fSolidMap.end ())) {
+      fDisplayListId = fSolidMap [pSolid];
+      fPOList.push_back(PO(fDisplayListId,*fpObjectTransformation));
+    }
+    else {
+      G4VSceneHandler::RequestPrimitives (solid);
+      fSolidMap [pSolid] = fDisplayListId;
+    }
+    return;
+  }
+
+  // Otherwise invoke base class method...
+  G4VSceneHandler::RequestPrimitives (solid);
+}
+
+G4int G4OpenGLStoredSceneHandler::fSceneIdCount = 0;
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredViewer.cc	(revision 562)
@@ -0,0 +1,245 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredViewer.cc,v 1.20 2006/10/24 06:23:18 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLStoredViewer : Encapsulates the `storedness' of
+//                            an OpenGL view, for inheritance by
+//                            derived (X, Xm...) classes.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4OpenGLStoredViewer.hh"
+
+#include "G4OpenGLStoredSceneHandler.hh"
+#include "G4Text.hh"
+#include "G4Circle.hh"
+#include "G4UnitsTable.hh"
+#include "G4Scene.hh"
+
+G4OpenGLStoredViewer::G4OpenGLStoredViewer
+(G4OpenGLStoredSceneHandler& sceneHandler):
+G4VViewer (sceneHandler, -1),  
+G4OpenGLViewer (sceneHandler), 
+fG4OpenGLStoredSceneHandler (sceneHandler)
+{
+  fLastVP = fDefaultVP; // Not sure if this gets executed before or
+  // after G4VViewer::G4VViewer!!  Doesn't matter much.
+}
+
+G4OpenGLStoredViewer::~G4OpenGLStoredViewer () {}
+
+void G4OpenGLStoredViewer::KernelVisitDecision () {
+  
+  // If there's a significant difference with the last view parameters
+  // of either the scene handler or this viewer, trigger a rebuild.
+
+  if (!fG4OpenGLStoredSceneHandler.fTopPODL ||
+      CompareForKernelVisit(fLastVP)) {
+    NeedKernelVisit ();
+  }      
+  fLastVP = fVP;
+}
+
+G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
+
+  if (
+      (lastVP.GetDrawingStyle ()    != fVP.GetDrawingStyle ())    ||
+      (lastVP.IsAuxEdgeVisible ()   != fVP.IsAuxEdgeVisible ())   ||
+      (lastVP.GetRepStyle ()        != fVP.GetRepStyle ())        ||
+      (lastVP.IsCulling ()          != fVP.IsCulling ())          ||
+      (lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
+      (lastVP.IsDensityCulling ()   != fVP.IsDensityCulling ())   ||
+      (lastVP.IsCullingCovered ()   != fVP.IsCullingCovered ())   ||
+      (lastVP.IsSection ()          != fVP.IsSection ())          ||
+      // Section (DCUT) implemented locally.  But still need to visit
+      // kernel if status changes so that back plane culling can be
+      // switched.
+      (lastVP.IsCutaway ()          != fVP.IsCutaway ())          ||
+      // Cutaways implemented locally.  But still need to visit kernel
+      // if status changes so that back plane culling can be switched.
+      (lastVP.IsExplode ()          != fVP.IsExplode ())          ||
+      (lastVP.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
+      (lastVP.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
+      (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
+      ) {
+    return true;
+  }
+
+  if (lastVP.IsDensityCulling () &&
+      (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
+    return true;
+
+  /**************************************************************
+  Section (DCUT) implemented locally.  No need to visit kernel if
+  section plane itself changes.
+  if (lastVP.IsSection () &&
+      (lastVP.GetSectionPlane () != fVP.GetSectionPlane ()))
+    return true;
+  ***************************************************************/
+
+  /**************************************************************
+  Cutaways implemented locally.  No need to visit kernel if cutaway
+  planes themselves change.
+  if (lastVP.IsCutaway ()) {
+    if (lastVP.GetCutawayPlanes ().size () !=
+	fVP.GetCutawayPlanes ().size ()) return true;
+    for (size_t i = 0; i < lastVP.GetCutawayPlanes().size(); ++i)
+      if (lastVP.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
+	return true;
+  }
+  ***************************************************************/
+
+  if (lastVP.IsExplode () &&
+      (lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
+    return true;
+
+  return false;
+}
+
+void G4OpenGLStoredViewer::DrawDisplayLists () {
+
+  const G4Planes& cutaways = fVP.GetCutawayPlanes();
+  G4bool cutawayUnion = fVP.IsCutaway() &&
+    fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion;
+  size_t nPasses = cutawayUnion? cutaways.size(): 1;
+  for (size_t i = 0; i < nPasses; ++i) {
+
+    if (cutawayUnion) {
+      double a[4];
+      a[0] = cutaways[i].a();
+      a[1] = cutaways[i].b();
+      a[2] = cutaways[i].c();
+      a[3] = cutaways[i].d();
+      glClipPlane (GL_CLIP_PLANE2, a);
+      glEnable (GL_CLIP_PLANE2);
+    }
+
+    if (fG4OpenGLStoredSceneHandler.fTopPODL)
+      glCallList (fG4OpenGLStoredSceneHandler.fTopPODL);
+    size_t tmp_size = fG4OpenGLStoredSceneHandler.fTOList.size();
+    G4double bsf = 1.;  // Brightness scaling factor.
+    for (size_t i = 0; i < tmp_size; ++i) {
+      G4OpenGLStoredSceneHandler::TO& to =
+	fG4OpenGLStoredSceneHandler.fTOList[i];
+      if ((!(to.fEndTime < fStartTime ))&& (!(to.fStartTime > fEndTime))) {
+	glPushMatrix();
+	G4OpenGLTransform3D oglt (to.fTransform);
+	glMultMatrixd (oglt.GetGLMatrix ());
+	G4Colour& c = to.fColour;
+	if (fFadeFactor > 0. && to.fEndTime < fEndTime)
+	  bsf = 1. - fFadeFactor *
+	    ((fEndTime - to.fEndTime) / (fEndTime - fStartTime));
+	glColor3d(bsf * c.GetRed (), bsf * c.GetGreen (), bsf * c.GetBlue ());
+	glCallList (to.fDisplayListId);
+	glPopMatrix();
+      }
+    }
+
+    if (cutawayUnion) glDisable (GL_CLIP_PLANE2);
+  }
+
+  // Display time at "head" of time range, which is fEndTime...
+  if (fDisplayHeadTime && fEndTime < DBL_MAX) {
+    glMatrixMode (GL_PROJECTION);
+    glPushMatrix();
+    glLoadIdentity();
+    glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
+    glMatrixMode (GL_MODELVIEW);
+    glPushMatrix();
+    glLoadIdentity();
+    G4Text headTimeText(G4BestUnit(fEndTime,"Time"),
+			G4Point3D(fDisplayHeadTimeX, fDisplayHeadTimeY, 0.));
+    headTimeText.SetScreenSize(fDisplayHeadTimeSize);
+    G4VisAttributes visAtts (G4Colour
+			     (fDisplayHeadTimeRed,
+			      fDisplayHeadTimeGreen,
+			      fDisplayHeadTimeBlue));
+    headTimeText.SetVisAttributes(&visAtts);
+    fG4OpenGLStoredSceneHandler.AddPrimitive(headTimeText);
+    glMatrixMode (GL_PROJECTION);
+    glPopMatrix();
+    glMatrixMode (GL_MODELVIEW);
+    glPopMatrix();
+  }
+
+  // Display light front...
+  if (fDisplayLightFront && fEndTime < DBL_MAX) {
+    G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
+    if (lightFrontRadius > 0.) {
+      G4Point3D lightFrontCentre(fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ);
+      G4Point3D circleCentre = lightFrontCentre;
+      G4double circleRadius = lightFrontRadius;
+      if (fVP.GetFieldHalfAngle() > 0.) {
+	// Perspective view.  Find horizon centre and radius...
+	G4Point3D targetPoint = fSceneHandler.GetScene()->GetStandardTargetPoint() +
+	  fVP.GetCurrentTargetPoint();
+	G4double sceneRadius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+	if(sceneRadius <= 0.) sceneRadius = 1.;
+	G4double cameraDistance = fVP.GetCameraDistance(sceneRadius);
+	G4Point3D cameraPosition = targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
+	G4Vector3D lightFrontToCameraDirection = cameraPosition - lightFrontCentre;
+	G4double lightFrontCentreDistance = lightFrontToCameraDirection.mag();
+	/*
+	G4cout << "cameraPosition: " << cameraPosition
+	       << ", lightFrontCentre: " << lightFrontCentre
+	       << ", lightFrontRadius: " << lightFrontRadius
+	       << ", lightFrontCentreDistance: " << lightFrontCentreDistance
+	       << ", dot: " << lightFrontToCameraDirection * fVP.GetViewpointDirection()
+	       << G4endl;
+	*/
+	if (lightFrontToCameraDirection * fVP.GetViewpointDirection() > 0. && lightFrontRadius < lightFrontCentreDistance) {
+	  // Light front in front of camera...
+	  G4double sineHorizonAngle = lightFrontRadius / lightFrontCentreDistance;
+	  circleCentre = lightFrontCentre + (lightFrontRadius * sineHorizonAngle) * lightFrontToCameraDirection.unit();
+	  circleRadius = lightFrontRadius * std::sqrt(1. - std::pow(sineHorizonAngle, 2));
+	  /*
+	  G4cout << "sineHorizonAngle: " << sineHorizonAngle
+		 << ", circleCentre: " << circleCentre
+		 << ", circleRadius: " << circleRadius
+		 << G4endl;
+	  */
+	} else {
+	  circleRadius = -1.;
+	}
+      }
+      if (circleRadius > 0.) {
+	G4Circle lightFront(circleCentre);
+	lightFront.SetWorldRadius(circleRadius);
+	glColor3d(fDisplayLightFrontRed,
+		  fDisplayLightFrontGreen,
+		  fDisplayLightFrontBlue);
+	static_cast<G4OpenGLSceneHandler&>(fSceneHandler).
+	  G4OpenGLSceneHandler::AddPrimitive(lightFront);
+      }
+    }
+  }
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredWin32.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredWin32.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredWin32.cc	(revision 562)
@@ -0,0 +1,80 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// OpenGLStoredWin32 graphics system factory.
+
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredWin32.hh"
+#include "G4OpenGLStoredWin32Viewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+
+G4OpenGLStoredWin32::G4OpenGLStoredWin32 ():
+  G4VGraphicsSystem ("OpenGLStoredWin32",
+		     "OGLSWin32",
+		     G4VisFeaturesOfOpenGLSWin32 (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLStoredWin32::CreateSceneHandler
+(const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLStoredSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLStoredWin32::CreateViewer
+(G4VSceneHandler& scene, const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLStoredWin32Viewer ((G4OpenGLStoredSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      delete pView;
+      pView = 0;
+      G4cerr << "G4OpenGLStoredWin32::CreateViewer: error flagged by"
+	" negative view id in G4OpenGLStoredWin32Viewer creation."
+	"\n Destroying view and returning null pointer." << G4endl;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLStoredWin32::CreateViewer: null pointer on"
+      " new G4OpenGLStoredWin32Viewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
+
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredWin32Viewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredWin32Viewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredWin32Viewer.cc	(revision 562)
@@ -0,0 +1,135 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.18 2006/09/04 12:07:59 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Class G4OpenGLStoredWin32Viewer : a class derived from G4OpenGLWin32Viewer and
+//                             G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4OpenGLStoredWin32Viewer.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLStoredWin32Viewer::G4OpenGLStoredWin32Viewer
+(G4OpenGLStoredSceneHandler& sceneHandler,
+ const G4String&  name):
+G4OpenGLViewer (sceneHandler),
+G4OpenGLWin32Viewer (sceneHandler),
+G4OpenGLStoredViewer (sceneHandler),
+G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name) {
+
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+}
+
+void G4OpenGLStoredWin32Viewer::Initialise () {
+
+  //Check that G4OpenGLWin32Viewer got a double buffered colour visual
+
+  CreateGLWin32Context ();
+  CreateMainWindow ();
+  CreateFontLists ();
+
+// clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+}
+
+void G4OpenGLStoredWin32Viewer::DrawView () {
+
+  //Make sure current viewer is attached and clean...
+  //Win32 version needed
+  //  glXMakeCurrent (dpy, win, cx);
+  glViewport (0, 0, WinSize_x, WinSize_y);
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //See if things have changed from last time and remake if necessary...
+  // The fNeedKernelVisit flag might have been set by the user in
+  // /vis/viewer/rebuild, but if not, make decision and set flag only
+  // if necessary...
+  if (!fNeedKernelVisit) KernelVisitDecision ();
+  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+  ProcessView ();
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    DrawDisplayLists ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+    DrawDisplayLists ();
+    FinishView ();
+
+  } else {
+
+    // If kernel visit was needed, drawing and FinishView will already
+    // have been done, so...
+    if (!kernelVisitWasNeeded) {
+      DrawDisplayLists ();
+      FinishView ();
+    } else {
+    // However, union cutaways are implemented in DrawDisplayLists, so make
+    // an extra pass...
+      if (fVP.IsCutaway() &&
+	  fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
+	ClearView();
+	DrawDisplayLists ();
+	FinishView ();
+      }
+    }
+  }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLStoredWin32Viewer::FinishView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fHDC) return;
+
+  glFlush ();
+  ::SwapBuffers(fHDC);
+
+  // Empty the Windows message queue :
+  MSG event;
+  while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
+    ::TranslateMessage(&event);
+    ::DispatchMessage (&event);
+  }
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredX.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredX.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredX.cc	(revision 562)
@@ -0,0 +1,84 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredX.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredX.hh"
+#include "G4OpenGLStoredXViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+#include "G4OpenGLXViewerMessenger.hh"
+
+G4OpenGLStoredX::G4OpenGLStoredX ():
+  G4VGraphicsSystem ("OpenGLStoredX",
+		     "OGLSX",
+		     G4VisFeaturesOfOpenGLSX (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+  G4OpenGLXViewerMessenger::GetInstance();
+}
+
+G4OpenGLStoredX::~G4OpenGLStoredX () {}
+
+G4VSceneHandler* G4OpenGLStoredX::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLStoredSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLStoredX::CreateViewer (G4VSceneHandler& scene,
+				      const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLStoredXViewer ((G4OpenGLStoredSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      delete pView;
+      pView = 0;
+      G4cerr << "G4OpenGLStoredX::CreateViewer: error flagged by"
+	" negative view id in G4OpenGLStoredXViewer creation."
+	"\n Destroying view and returning null pointer." << G4endl;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLStoredX::CreateViewer: null pointer on"
+      " new G4OpenGLStoredXViewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
+
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredXViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredXViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredXViewer.cc	(revision 562)
@@ -0,0 +1,131 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredXViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  7th February 1997
+// Class G4OpenGLStoredXViewer : a class derived from G4OpenGLXViewer and
+//                             G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4OpenGLStoredXViewer.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLStoredXViewer::
+G4OpenGLStoredXViewer (G4OpenGLStoredSceneHandler& sceneHandler,
+		 const G4String& name)
+ : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+   G4OpenGLViewer (sceneHandler),
+   G4OpenGLXViewer (sceneHandler),
+   G4OpenGLStoredViewer (sceneHandler)
+{
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+
+  if (!vi_stored) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLStoredXViewer::G4OpenGLStoredXViewer -"
+      " G4OpenGLXViewer couldn't get a visual." << G4endl;
+    return;
+  }
+}
+
+G4OpenGLStoredXViewer::~G4OpenGLStoredXViewer () {}
+
+void G4OpenGLStoredXViewer::Initialise () {
+
+  CreateGLXContext (vi_stored);
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  InitializeGLView ();
+
+// clear the buffers and window.
+  ClearView ();
+  FinishView ();
+
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+}
+
+void G4OpenGLStoredXViewer::DrawView () {
+
+  //Make sure current viewer is attached and clean...
+  glXMakeCurrent (dpy, win, cx);
+  glViewport (0, 0, WinSize_x, WinSize_y);
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //See if things have changed from last time and remake if necessary...
+  // The fNeedKernelVisit flag might have been set by the user in
+  // /vis/viewer/rebuild, but if not, make decision and set flag only
+  // if necessary...
+  if (!fNeedKernelVisit) KernelVisitDecision ();
+  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+  ProcessView ();
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    DrawDisplayLists ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+    DrawDisplayLists ();
+    FinishView ();
+
+  } else {
+
+    // If kernel visit was needed, drawing and FinishView will already
+    // have been done, so...
+    if (!kernelVisitWasNeeded) {
+      DrawDisplayLists ();
+      FinishView ();
+    } else {
+    // However, union cutaways are implemented in DrawDisplayLists, so make
+    // an extra pass...
+      if (fVP.IsCutaway() &&
+	  fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
+	ClearView();
+	DrawDisplayLists ();
+	FinishView ();
+      }
+    }
+  }
+}
+
+void G4OpenGLStoredXViewer::FinishView () {
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propogated before progressing.
+  glXSwapBuffers (dpy, win);  
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredXm.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredXm.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredXm.cc	(revision 562)
@@ -0,0 +1,79 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredXm.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  10th February 1997
+// OpenGL graphics system factory.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4VisFeaturesOfOpenGL.hh"
+#include "G4VSceneHandler.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredXm.hh"
+#include "G4OpenGLStoredXmViewer.hh"
+#include "G4OpenGLViewerMessenger.hh"
+#include "G4OpenGLXmViewerMessenger.hh"
+
+G4OpenGLStoredXm::G4OpenGLStoredXm ():
+  G4VGraphicsSystem ("OpenGLStoredXm",
+		     "OGLSXm",
+		     G4VisFeaturesOfOpenGLSXm (),
+		     G4VGraphicsSystem::threeD)
+{
+  G4OpenGLViewerMessenger::GetInstance();
+  G4OpenGLXmViewerMessenger::GetInstance();
+}
+
+G4VSceneHandler* G4OpenGLStoredXm::CreateSceneHandler (const G4String& name) {
+  G4VSceneHandler* pScene = new G4OpenGLStoredSceneHandler (*this, name);
+  return    pScene;
+}
+
+G4VViewer* G4OpenGLStoredXm::CreateViewer (G4VSceneHandler& scene, const G4String& name) {
+  G4VViewer* pView =
+    new G4OpenGLStoredXmViewer ((G4OpenGLStoredSceneHandler&) scene, name);
+  if (pView) {
+    if (pView -> GetViewId () < 0) {
+      delete pView;
+      pView = 0;
+      G4cerr << "G4OpenGLStoredXm::CreateViewer: error flagged by"
+	" negative view id in G4OpenGLStoredXmViewer creation."
+	"\n Destroying view and returning null pointer." << G4endl;
+    }
+  }
+  else {
+    G4cerr << "G4OpenGLStoredXm::CreateViewer: null pointer on"
+      " new G4OpenGLStoredXmViewer." << G4endl;
+  }
+  return pView;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredXmViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredXmViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLStoredXmViewer.cc	(revision 562)
@@ -0,0 +1,136 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLStoredXmViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  10th February 1997
+// Class G4OpenGLStoredXmViewer : a class derived from G4OpenGLXmViewer 
+//                              and G4OpenGLStoredViewer.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLStoredXmViewer.hh"
+
+#include "G4ios.hh"
+
+G4OpenGLStoredXmViewer::
+G4OpenGLStoredXmViewer (G4OpenGLStoredSceneHandler& sceneHandler,
+			const G4String& name)
+ : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
+   G4OpenGLViewer (sceneHandler),
+   G4OpenGLXmViewer (sceneHandler),
+   G4OpenGLStoredViewer (sceneHandler)
+{
+
+  if (fViewId < 0) return;  // In case error in base class instantiation.
+
+  if (!vi_stored) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLStoredXmViewer::G4OpenGLStoredXmViewer -"
+      " G4OpenGLXmViewer couldn't get a visual." << G4endl;
+    return;
+  }
+}
+
+G4OpenGLStoredXmViewer::~G4OpenGLStoredXmViewer () {}
+
+void G4OpenGLStoredXmViewer::Initialise () {
+
+  CreateGLXContext (vi_stored);
+  CreateMainWindow ();
+  CreateFontLists ();
+
+  InitializeGLView ();
+
+// clear the buffers and window.
+  ClearView ();
+  FinishView ();
+  
+  glDepthFunc (GL_LEQUAL);
+  glDepthMask (GL_TRUE);
+  
+  glEnable (GL_BLEND);
+  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+  glDrawBuffer (GL_BACK);
+}
+
+void G4OpenGLStoredXmViewer::DrawView () {
+
+  //Make sure current viewer is attached and clean...
+  glXMakeCurrent (dpy, win, cx);
+  glViewport (0, 0, WinSize_x, WinSize_y);
+
+  G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
+
+  //See if things have changed from last time and remake if necessary...
+  // /vis/viewer/rebuild, but if not, make decision and set flag only
+  // if necessary...
+  if (!fNeedKernelVisit) KernelVisitDecision ();
+  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
+  ProcessView ();
+
+  if(style!=G4ViewParameters::hlr &&
+     haloing_enabled) {
+
+    HaloingFirstPass ();
+    DrawDisplayLists ();
+    glFlush ();
+
+    HaloingSecondPass ();
+
+    DrawDisplayLists ();
+    FinishView ();
+
+  } else {
+
+    // If kernel visit was needed, drawing and FinishView will already
+    // have been done, so...
+    if (!kernelVisitWasNeeded) {
+      DrawDisplayLists ();
+      FinishView ();
+    } else {
+    // However, union cutaways are implemented in DrawDisplayLists, so make
+    // an extra pass...
+      if (fVP.IsCutaway() &&
+	  fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
+	ClearView();
+	DrawDisplayLists ();
+	FinishView ();
+      }
+    }
+  }
+}
+
+void G4OpenGLStoredXmViewer::FinishView () {
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propogated before progressing.
+  glXSwapBuffers (dpy, win);  
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLTransform3D.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLTransform3D.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLTransform3D.cc	(revision 562)
@@ -0,0 +1,57 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// Andrew Walkden  24th October 1996
+// G4OpenGLTransform3D provides OpenGL style transformation matrix
+// from G4Transform3D.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4OpenGLTransform3D.hh"
+
+G4OpenGLTransform3D::G4OpenGLTransform3D (const G4Transform3D &t):
+  G4Transform3D (t) {}
+
+const GLdouble* G4OpenGLTransform3D::GetGLMatrix () 
+{
+  GLdouble *p = m;
+  for (size_t i=0; i<4; i++)
+  { 
+    for (size_t k=0; k<3; k++)
+    {
+      *p++ = operator()(k,i);
+    }
+    *p++ = 0.;
+  } 
+  m[15] = 1.; 
+  return m;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLViewer.cc	(revision 562)
@@ -0,0 +1,277 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLViewer.cc,v 1.29 2006/09/19 16:13:15 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  27th March 1996
+// OpenGL view - opens window, hard copy, etc.
+
+#ifdef G4VIS_BUILD_OPENGL_DRIVER
+
+#include "G4ios.hh"
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLSceneHandler.hh"
+#include "G4OpenGLTransform3D.hh"
+
+#include "G4Scene.hh"
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+#include "G4Plane3D.hh"
+
+G4OpenGLViewer::G4OpenGLViewer (G4OpenGLSceneHandler& scene):
+G4VViewer (scene, -1),
+background (G4Colour(0.,0.,0.)),
+transparency_enabled (true),
+antialiasing_enabled (false),
+haloing_enabled (false),
+fStartTime(-DBL_MAX),
+fEndTime(DBL_MAX),
+fFadeFactor(0.),
+fDisplayHeadTime(false),
+fDisplayHeadTimeX(-0.9),
+fDisplayHeadTimeY(-0.9),
+fDisplayHeadTimeSize(24.),
+fDisplayHeadTimeRed(0.),
+fDisplayHeadTimeGreen(1.),
+fDisplayHeadTimeBlue(1.),
+fDisplayLightFront(false),
+fDisplayLightFrontX(0.),
+fDisplayLightFrontY(0.),
+fDisplayLightFrontZ(0.),
+fDisplayLightFrontT(0.),
+fDisplayLightFrontRed(0.),
+fDisplayLightFrontGreen(1.),
+fDisplayLightFrontBlue(0.)
+{
+  // Make changes to view parameters for OpenGL...
+  fVP.SetAutoRefresh(true);
+  fDefaultVP.SetAutoRefresh(true);
+
+  //  glClearColor (0.0, 0.0, 0.0, 0.0);
+  //  glClearDepth (1.0);
+  //  glDisable (GL_BLEND);
+  //  glDisable (GL_LINE_SMOOTH);
+  //  glDisable (GL_POLYGON_SMOOTH);
+
+}
+
+G4OpenGLViewer::~G4OpenGLViewer () {}
+
+void G4OpenGLViewer::InitializeGLView () 
+{
+  printf("G4OpenGLViewer::InitializeGLView () VVVVVVVVVVVVVVVVVVVVV \n");
+  glClearColor (0.0, 0.0, 0.0, 0.0);
+  glClearDepth (1.0);
+  glDisable (GL_BLEND);
+  glDisable (GL_LINE_SMOOTH);
+  glDisable (GL_POLYGON_SMOOTH);
+  printf("G4OpenGLViewer::InitializeGLView () ^^^^^^^^^^^^^^^^^^^^ \n");
+}  
+
+void G4OpenGLViewer::ClearView () {
+  glClearColor (background.GetRed(),
+		background.GetGreen(),
+		background.GetBlue(),
+		1.);
+  glClearDepth (1.0);
+  //Below line does not compile with Mesa includes. 
+  //glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
+  glClear (GL_COLOR_BUFFER_BIT);
+  glClear (GL_DEPTH_BUFFER_BIT);
+  glClear (GL_STENCIL_BUFFER_BIT);
+  glFlush ();
+}
+
+void G4OpenGLViewer::SetView () {
+  
+  // Calculates view representation based on extent of object being
+  // viewed and (initial) viewpoint.  (Note: it can change later due
+  // to user interaction via visualization system's GUI.)
+  
+  // Lighting.
+  GLfloat lightPosition [4];
+  lightPosition [0] = fVP.GetActualLightpointDirection().x();
+  lightPosition [1] = fVP.GetActualLightpointDirection().y();
+  lightPosition [2] = fVP.GetActualLightpointDirection().z();
+  lightPosition [3] = 0.;
+  // Light position is "true" light direction, so must come after gluLookAt.
+  GLfloat ambient [] = { 0.2, 0.2, 0.2, 1.};
+  GLfloat diffuse [] = { 0.8, 0.8, 0.8, 1.};
+  glEnable (GL_LIGHT0);
+  glLightfv (GL_LIGHT0, GL_AMBIENT, ambient);
+  glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse);
+  
+  // Get radius of scene, etc.
+  // Note that this procedure properly takes into account zoom, dolly and pan.
+  const G4Point3D targetPoint
+    = fSceneHandler.GetScene()->GetStandardTargetPoint()
+    + fVP.GetCurrentTargetPoint ();
+  G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
+  if(radius<=0.) radius = 1.;
+  const G4double cameraDistance = fVP.GetCameraDistance (radius);
+  const G4Point3D cameraPosition =
+    targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
+  const GLdouble pnear   = fVP.GetNearDistance (cameraDistance, radius);
+  const GLdouble pfar    = fVP.GetFarDistance  (cameraDistance, pnear, radius);
+  const GLdouble right  = fVP.GetFrontHalfHeight (pnear, radius);
+  const GLdouble left   = -right;
+  const GLdouble bottom = left;
+  const GLdouble top    = right;
+  
+  glMatrixMode (GL_PROJECTION); // set up Frustum.
+  glLoadIdentity();
+
+  const G4Vector3D scale = fVP.GetScaleFactor();
+  glScaled(scale.x(),scale.y(),scale.z());
+  
+  if (fVP.GetFieldHalfAngle() == 0.) {
+    glOrtho (left, right, bottom, top, pnear, pfar);
+  }
+  else {
+    glFrustum (left, right, bottom, top, pnear, pfar);
+  }
+  
+  glMatrixMode (GL_MODELVIEW); // apply further transformations to scene.
+  glLoadIdentity();
+  
+  const G4Normal3D& upVector = fVP.GetUpVector ();  
+  G4Point3D gltarget;
+  if (cameraDistance > 1.e-6 * radius) {
+    gltarget = targetPoint;
+  }
+  else {
+    gltarget = targetPoint - radius * fVP.GetViewpointDirection().unit();
+  }
+
+  const G4Point3D& pCamera = cameraPosition;  // An alias for brevity.
+  gluLookAt (pCamera.x(),  pCamera.y(),  pCamera.z(),       // Viewpoint.
+	     gltarget.x(), gltarget.y(), gltarget.z(),      // Target point.
+	     upVector.x(), upVector.y(), upVector.z());     // Up vector.
+  
+  // Light position is "true" light direction, so must come after gluLookAt.
+  glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
+
+  // OpenGL no longer seems to reconstruct clipped edges, so, when the
+  // BooleanProcessor is up to it, abandon this and use generic
+  // clipping in G4OpenGLSceneHandler::CreateSectionPolyhedron.  Also,
+  // force kernel visit on change of clipping plane in
+  // G4OpenGLStoredViewer::CompareForKernelVisit.
+  if (fVP.IsSection () ) {  // pair of back to back clip planes.
+    const G4Plane3D& s = fVP.GetSectionPlane ();
+    double sArray[4];
+    sArray[0] = s.a();
+    sArray[1] = s.b();
+    sArray[2] = s.c();
+    sArray[3] = s.d() + radius * 1.e-05;
+    glClipPlane (GL_CLIP_PLANE0, sArray);
+    glEnable (GL_CLIP_PLANE0);
+    sArray[0] = -s.a();
+    sArray[1] = -s.b();
+    sArray[2] = -s.c();
+    sArray[3] = -s.d() + radius * 1.e-05;
+    glClipPlane (GL_CLIP_PLANE1, sArray);
+    glEnable (GL_CLIP_PLANE1);
+  } else {
+    glDisable (GL_CLIP_PLANE0);
+    glDisable (GL_CLIP_PLANE1);
+  }
+
+  const G4Planes& cutaways = fVP.GetCutawayPlanes();
+  size_t nPlanes = cutaways.size();
+  if (fVP.IsCutaway() &&
+      fVP.GetCutawayMode() == G4ViewParameters::cutawayIntersection &&
+      nPlanes > 0) {
+    double a[4];
+    a[0] = cutaways[0].a();
+    a[1] = cutaways[0].b();
+    a[2] = cutaways[0].c();
+    a[3] = cutaways[0].d();
+    glClipPlane (GL_CLIP_PLANE2, a);
+    glEnable (GL_CLIP_PLANE2);
+    if (nPlanes > 1) {
+      a[0] = cutaways[1].a();
+      a[1] = cutaways[1].b();
+      a[2] = cutaways[1].c();
+      a[3] = cutaways[1].d();
+      glClipPlane (GL_CLIP_PLANE3, a);
+      glEnable (GL_CLIP_PLANE3);
+    }
+    if (nPlanes > 2) {
+      a[0] = cutaways[2].a();
+      a[1] = cutaways[2].b();
+      a[2] = cutaways[2].c();
+      a[3] = cutaways[2].d();
+      glClipPlane (GL_CLIP_PLANE4, a);
+      glEnable (GL_CLIP_PLANE4);
+    }
+  } else {
+    glDisable (GL_CLIP_PLANE2);
+    glDisable (GL_CLIP_PLANE3);
+    glDisable (GL_CLIP_PLANE4);
+  }
+
+  // Background.
+  background = fVP.GetBackgroundColour ();
+
+}
+
+void G4OpenGLViewer::HaloingFirstPass () {
+  
+  //To perform haloing, first Draw all information to the depth buffer
+  //alone, using a chunky line width, and then Draw all info again, to
+  //the colour buffer, setting a thinner line width an the depth testing 
+  //function to less than or equal, so if two lines cross, the one 
+  //passing behind the other will not pass the depth test, and so not
+  //get rendered either side of the infront line for a short distance.
+
+  //First, disable writing to the colo(u)r buffer...
+  glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+
+  //Now enable writing to the depth buffer...
+  glDepthMask (GL_TRUE);
+  glDepthFunc (GL_LESS);
+  glClearDepth (1.0);
+
+  //Finally, set the line width to something wide...
+  glLineWidth (3.0);
+
+}
+
+void G4OpenGLViewer::HaloingSecondPass () {
+
+  //And finally, turn the colour buffer back on with a sesible line width...
+  glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+  glDepthFunc (GL_LEQUAL);
+  glLineWidth (1.0);
+
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLViewerMessenger.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLViewerMessenger.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLViewerMessenger.cc	(revision 562)
@@ -0,0 +1,330 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLViewerMessenger.cc,v 1.5 2006/10/24 06:20:42 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+
+#include "G4OpenGLViewerMessenger.hh"
+
+#include "G4OpenGLViewer.hh"
+#include "G4OpenGLStoredViewer.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithADouble.hh"
+#include "G4UIcmdWithABool.hh"
+#include "G4VisManager.hh"
+#include <sstream>
+
+G4OpenGLViewerMessenger*
+G4OpenGLViewerMessenger::fpInstance = 0;
+
+G4OpenGLViewerMessenger*
+G4OpenGLViewerMessenger::GetInstance()
+{
+  if (!fpInstance) fpInstance = new G4OpenGLViewerMessenger;
+  return fpInstance;
+}
+
+G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
+{
+  G4bool omitable;
+
+  fpDirectory = new G4UIdirectory("/vis/ogl/");
+  fpDirectory->SetGuidance("G4OpenGLViewer commands.");
+
+  fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
+  fpDirectorySet->SetGuidance("G4OpenGLViewer set commands.");
+
+  G4UIparameter* parameter;
+
+  fpCommandDisplayHeadTime =
+    new G4UIcommand("/vis/ogl/set/displayHeadTime", this);
+  fpCommandDisplayHeadTime->SetGuidance
+    ("Display head time of range in 2D text.");
+  parameter = new G4UIparameter ("displayHeadTime", 'b', omitable = false);
+  parameter->SetDefaultValue(false);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("screenX", 'd', omitable = true);
+  parameter->SetGuidance("-1 < screenX < 1");
+  parameter->SetParameterRange("screenX >= -1. && screenX <= 1.");
+  parameter->SetDefaultValue(-0.9);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("screenY", 'd', omitable = true);
+  parameter->SetGuidance("-1 < screenY < 1");
+  parameter->SetParameterRange("screenY >= -1. && screenY <= 1.");
+  parameter->SetDefaultValue(-0.9);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("screenSize", 'd', omitable = true);
+  parameter->SetDefaultValue(24.);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("red", 'd', omitable = true);
+  parameter->SetParameterRange("red >= 0. && red <= 1.");
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("green", 'd', omitable = true);
+  parameter->SetParameterRange("green >= 0. && green <= 1.");
+  parameter->SetDefaultValue(1.);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("blue", 'd', omitable = true);
+  parameter->SetParameterRange("blue >= 0. && blue <= 1.");
+  parameter->SetDefaultValue(1.);
+  fpCommandDisplayHeadTime->SetParameter(parameter);
+
+  fpCommandDisplayLightFront =
+    new G4UIcommand("/vis/ogl/set/displayLightFront", this);
+  fpCommandDisplayLightFront->SetGuidance
+    ("Display the light front at head time.");
+  fpCommandDisplayLightFront->SetGuidance
+    ("Tip: The trajectories can appear of jump ahead of the light front"
+     "\nbecause their time range overlaps the viewer's time range.  To"
+     "\naverage out this discrete time effect, advance the light front by"
+     "\nhalf the trajectories interval. E.g., if the trajectory time slice"
+     "\ninterval is 0.01 ns:"
+     "\n  /vis/ogl/set/displayLightFront true -90 0 0 mm -0.005 ns"
+     "\nTo prevent them beating the light front at all:"
+     "\n  /vis/ogl/set/displayLightFront true -90 0 0 mm -0.01 ns");
+  parameter = new G4UIparameter ("displayLightFront", 'b', omitable = false);
+  parameter->SetDefaultValue(false);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("originX", 'd', omitable = true);
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("originY", 'd', omitable = true);
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("originZ", 'd', omitable = true);
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("space_unit", 's', omitable = true);
+  parameter->SetDefaultValue("m");
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("originT", 'd', omitable = true);
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("time_unit", 's', omitable = true);
+  parameter->SetDefaultValue("s");
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("red", 'd', omitable = true);
+  parameter->SetParameterRange("red >= 0. && red <= 1.");
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("green", 'd', omitable = true);
+  parameter->SetParameterRange("green >= 0. && green <= 1.");
+  parameter->SetDefaultValue(1.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+  parameter = new G4UIparameter ("blue", 'd', omitable = true);
+  parameter->SetParameterRange("blue >= 0. && blue <= 1.");
+  parameter->SetDefaultValue(0.);
+  fpCommandDisplayLightFront->SetParameter(parameter);
+
+  fpCommandEndTime =
+    new G4UIcommand("/vis/ogl/set/endTime", this);
+  fpCommandEndTime->SetGuidance("Set end and range of track time.");
+  parameter = new G4UIparameter ("end-time", 'd', omitable = false);
+  parameter->SetDefaultValue(DBL_MAX);
+  fpCommandEndTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
+  parameter->SetDefaultValue("ns");
+  fpCommandEndTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("time-range", 'd', omitable = true);
+  parameter->SetDefaultValue(-1.);
+  fpCommandEndTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
+  parameter->SetDefaultValue("ns");
+  fpCommandEndTime->SetParameter(parameter);
+
+  fpCommandFade = new G4UIcmdWithADouble("/vis/ogl/set/fade", this);
+  fpCommandFade->SetGuidance
+    ("0: no fade; 1: maximum fade with time within range.");
+  fpCommandFade->SetParameterName("fadefactor", omitable = false);
+  fpCommandFade->SetRange("fadefactor>=0.&&fadefactor<=1.");
+  fpCommandFade->SetDefaultValue(0.);
+
+  fpCommandStartTime =
+    new G4UIcommand("/vis/ogl/set/startTime", this);
+  fpCommandStartTime->SetGuidance("Set start and range of track time.");
+  parameter = new G4UIparameter ("start-time", 'd', omitable = false);
+  parameter->SetDefaultValue(-DBL_MAX);
+  fpCommandStartTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
+  parameter->SetDefaultValue("ns");
+  fpCommandStartTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("time-range", 'd', omitable = true);
+  parameter->SetDefaultValue(-1.);
+  fpCommandStartTime->SetParameter(parameter);
+  parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
+  parameter->SetDefaultValue("ns");
+  fpCommandStartTime->SetParameter(parameter);
+
+  fpCommandTransparency =
+    new G4UIcmdWithABool("/vis/ogl/set/transparency", this);
+  fpCommandTransparency->SetGuidance
+    ("True/false to enable/disable rendering of transparent objects.");
+  fpCommandTransparency->SetParameterName
+    ("transparency-enabled", omitable = true);
+  fpCommandTransparency->SetDefaultValue(true);
+}
+
+G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
+{
+  delete fpCommandTransparency;
+  delete fpCommandStartTime;
+  delete fpCommandFade;
+  delete fpCommandEndTime;
+  delete fpCommandDisplayLightFront;
+  delete fpCommandDisplayHeadTime;
+  delete fpDirectorySet;
+  delete fpDirectory;
+}
+
+void G4OpenGLViewerMessenger::SetNewValue
+(G4UIcommand* command, G4String newValue)
+{
+  G4VisManager* pVisManager = G4VisManager::GetInstance();
+
+  G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
+
+  if (!pVViewer) {
+    G4cout <<
+      "G4OpenGLViewerMessenger::SetNewValue: No current viewer."
+      "\n  \"/vis/open\", or similar, to get one."
+           << G4endl;
+    return;
+  }
+
+  G4OpenGLViewer* pOGLViewer = dynamic_cast<G4OpenGLViewer*>(pVViewer);
+
+  if (!pOGLViewer) {
+    G4cout <<
+      "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type"
+      "\n  OGL.  Use \"/vis/viewer/select\" or \"/vis/open\"."
+           << G4endl;
+    return;
+  }
+
+  G4OpenGLStoredViewer* pViewer =
+    dynamic_cast<G4OpenGLStoredViewer*>(pVViewer);
+
+  if (!pViewer) {
+    G4cout <<
+  "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type OGLS."
+  "\n  The time slice viewing feature is only implemented for OGL Stored"
+  "\n  viewers at present.  Use \"/vis/viewer/select\" or \"/vis/open\"."
+           << G4endl;
+    return;
+  }
+
+  if (command == fpCommandDisplayHeadTime)
+    {
+      G4String display;
+      G4double screenX, screenY, screenSize, red, green, blue;
+      std::istringstream iss(newValue);
+      iss >> display >> screenX >> screenY
+	  >> screenSize >> red >> green >> blue;
+      pViewer->fDisplayHeadTime = command->ConvertToBool(display);
+      pViewer->fDisplayHeadTimeX = screenX;
+      pViewer->fDisplayHeadTimeY = screenY;
+      pViewer->fDisplayHeadTimeSize = screenSize;
+      pViewer->fDisplayHeadTimeRed = red;
+      pViewer->fDisplayHeadTimeGreen = green;
+      pViewer->fDisplayHeadTimeBlue = blue;
+    }
+
+  if (command == fpCommandDisplayLightFront)
+    {
+      G4String display, originX, originY, originZ, unitS, originT, unitT;
+      G4double red, green, blue;
+      std::istringstream iss(newValue);
+      iss >> display
+	  >> originX >> originY >> originZ >> unitS
+	  >> originT >> unitT
+	  >> red >> green >> blue;
+      pViewer->fDisplayLightFront = command->ConvertToBool(display);
+      pViewer->fDisplayLightFrontX =
+	command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS));
+      pViewer->fDisplayLightFrontY =
+	command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS));
+      pViewer->fDisplayLightFrontZ =
+	command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS));
+      pViewer->fDisplayLightFrontT =
+	command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT));
+      pViewer->fDisplayLightFrontRed = red;
+      pViewer->fDisplayLightFrontGreen = green;
+      pViewer->fDisplayLightFrontBlue = blue;
+    }
+
+  if (command == fpCommandEndTime)
+    {
+      G4String end_time_string, end_time_unit,
+	time_range_string, time_range_unit;
+      std::istringstream iss(newValue);
+      iss >> end_time_string >> end_time_unit
+	  >> time_range_string >> time_range_unit;
+      pViewer->fEndTime = command->ConvertToDimensionedDouble
+	(G4String(end_time_string + ' ' + end_time_unit));
+      G4double timeRange = command->ConvertToDimensionedDouble
+	(G4String(time_range_string + ' ' + time_range_unit));
+      if (timeRange > 0.) {
+	pViewer->fStartTime = pViewer->fEndTime - timeRange;
+      }
+      if (pViewer->fVP.IsAutoRefresh())
+	G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+    }
+
+  if (command == fpCommandFade)
+    {
+      pViewer->fFadeFactor = command->ConvertToDouble(newValue);
+      if (pViewer->fVP.IsAutoRefresh())
+	G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+    }
+
+  if (command == fpCommandStartTime)
+    {
+      G4String start_time_string, start_time_unit,
+	time_range_string, time_range_unit;
+      std::istringstream iss(newValue);
+      iss >> start_time_string >> start_time_unit
+	  >> time_range_string >> time_range_unit;
+      pViewer->fStartTime = command->ConvertToDimensionedDouble
+	(G4String(start_time_string + ' ' + start_time_unit));
+      G4double timeRange = command->ConvertToDimensionedDouble
+	(G4String(time_range_string + ' ' + time_range_unit));
+      if (timeRange > 0.) {
+	pViewer->fEndTime = pViewer->fStartTime + timeRange;
+      }
+      if (pViewer->fVP.IsAutoRefresh())
+	G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+    }
+
+  if (command == fpCommandTransparency)
+    {
+      pViewer->transparency_enabled = command->ConvertToBool(newValue);
+      if (pViewer->fVP.IsAutoRefresh())
+	G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
+    }
+
+}
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLWin32Viewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLWin32Viewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLWin32Viewer.cc	(revision 562)
@@ -0,0 +1,289 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLWin32Viewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// G4OpenGLWin32Viewer : Class to provide WindowsNT specific
+//                     functionality for OpenGL in GEANT4
+//
+// 27/06/2003 : G.Barrand : implementation (at last !).
+
+#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
+
+#include "G4OpenGLWin32Viewer.hh"
+
+#include "G4ios.hh"
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::SetView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fHDC) return;
+  if(!fHGLRC) return;
+  ::wglMakeCurrent(fHDC,fHGLRC);
+  G4OpenGLViewer::SetView ();  
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::ShowView (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(!fHDC) return;
+  glFlush ();
+  // Empty the Windows message queue :
+  MSG event;
+  while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
+    ::TranslateMessage(&event);
+    ::DispatchMessage (&event);
+  }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::GetWin32Connection (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::CreateGLWin32Context (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void G4OpenGLWin32Viewer::CreateMainWindow (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  if(fWindow) return; //Done.
+
+  // Bill Gates stuff...
+  static const char className[] = "G4OpenGLWin32";
+  static bool done = false;
+  if(done==false) {
+    WNDCLASS wc;
+    wc.style = CS_HREDRAW | CS_VREDRAW;
+    wc.lpfnWndProc = (WNDPROC)WindowProc;
+    wc.cbClsExtra = 0;
+    wc.cbWndExtra = 0;
+    wc.hInstance = ::GetModuleHandle(NULL);
+    wc.hIcon = LoadIcon  (NULL, IDI_APPLICATION);
+    wc.hCursor = LoadCursor(NULL,IDC_CROSS);
+    wc.hbrBackground = NULL;
+    wc.lpszMenuName = className;
+    wc.lpszClassName = className;
+    ::RegisterClass(&wc);
+    done = true;
+  }  
+  
+  WinSize_x = 400;
+  WinSize_y = 400;
+  if (WinSize_x < fVP.GetWindowSizeHintX ())
+    WinSize_x = fVP.GetWindowSizeHintX ();
+  if (WinSize_y < fVP.GetWindowSizeHintY ())
+    WinSize_y = fVP.GetWindowSizeHintY ();
+
+  fWindow = ::CreateWindow(className,fName.c_str(), 
+			   WS_OVERLAPPEDWINDOW,
+			   //WS_CHILD | WS_VISIBLE,
+			   0,0,
+			   WinSize_x,WinSize_y,
+			   NULL, NULL, 
+			   ::GetModuleHandle(NULL),
+			   NULL);
+  if(!fWindow) return;
+
+  ::SetWindowLong(fWindow,GWL_USERDATA,LONG(this));
+
+  // initialize OpenGL rendering :
+  fHDC = ::GetDC(fWindow);
+  if( fHDC && (SetWindowPixelFormat(fHDC)==TRUE) ) {
+    fHGLRC = ::wglCreateContext(fHDC);
+  }
+  
+  if(fHDC && fHGLRC) {
+    ::wglMakeCurrent(fHDC,fHGLRC);
+  }
+
+  ::SetForegroundWindow(fWindow);
+  ::ShowWindow(fWindow,SW_SHOWDEFAULT);
+  ::UpdateWindow(fWindow);
+  ::DrawMenuBar(fWindow);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+G4OpenGLWin32Viewer::G4OpenGLWin32Viewer (
+ G4OpenGLSceneHandler& scene
+)
+:G4VViewer (scene, -1)
+,G4OpenGLViewer (scene)
+,fWindow(0)
+,fHDC(0)
+,fHGLRC(0)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+G4OpenGLWin32Viewer::~G4OpenGLWin32Viewer (
+) 
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  // This is the end (Jim Morisson).
+  if (fViewId >= 0) {
+    if(wglGetCurrentContext()!=NULL) wglMakeCurrent(NULL,NULL);
+    if(fHGLRC)	{
+      wglDeleteContext(fHGLRC);
+      fHGLRC = NULL;
+    }
+    
+    if(fWindow) {
+      ::SetWindowLong(fWindow,GWL_USERDATA,LONG(NULL));
+      if(fHDC) ::ReleaseDC(fWindow,fHDC);
+      ::DestroyWindow(fWindow);
+    }
+  }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+LRESULT CALLBACK G4OpenGLWin32Viewer::WindowProc ( 
+ HWND   aWindow
+,UINT   aMessage
+,WPARAM aWParam
+,LPARAM aLParam
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+/*
+  switch (aMessage) { 
+  case WM_PAINT:{
+    printf("debug : PAINT\n");
+    HDC	hDC;
+    PAINTSTRUCT	ps;
+    hDC = BeginPaint(aWindow,&ps);
+    if(This) {
+      // FIXME : To have an automatic refresh someone have to redraw here.
+    }
+    EndPaint(aWindow, &ps);
+
+    //FIXME : have to handle WM_RESIZE
+    //pView->WinSize_x = (G4int) width;
+    //pView->WinSize_y = (G4int) height;
+    G4OpenGLWin32Viewer* This = 
+      (G4OpenGLWin32Viewer*)::GetWindowLong(aWindow,GWL_USERDATA);
+    if(This) {
+      This->SetView();
+      glViewport(0,0,This->WinSize_x,This->WinSize_y);
+      This->ClearView();
+      This->DrawView();
+      // WARNING : the below empty the Windows message queue...
+      This->FinishView();
+    }
+  } return 0;
+  default:
+    return DefWindowProc(aWindow,aMessage,aWParam,aLParam);
+  }
+*/
+  return DefWindowProc(aWindow,aMessage,aWParam,aLParam);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+bool G4OpenGLWin32Viewer::SetWindowPixelFormat(
+ HDC aHdc
+)
+//////////////////////////////////////////////////////////////////////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
+{
+  // The ungessable...
+
+  PIXELFORMATDESCRIPTOR pfd;
+  pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
+  pfd.nVersion = 1;
+  pfd.dwFlags = 
+    PFD_DRAW_TO_WINDOW | 
+    PFD_SUPPORT_OPENGL | 
+    PFD_DOUBLEBUFFER | 
+    PFD_STEREO_DONTCARE;  
+  pfd.iPixelType = PFD_TYPE_RGBA;
+  pfd.cColorBits = 32;
+  pfd.cRedBits = 8;
+  pfd.cRedShift = 16;
+  pfd.cGreenBits = 8;
+  pfd.cGreenShift = 8;
+  pfd.cBlueBits	= 8;
+  pfd.cBlueShift = 0;
+  pfd.cAlphaBits = 0;
+  pfd.cAlphaShift = 0;
+  pfd.cAccumBits = 64;	
+  pfd.cAccumRedBits = 16;
+  pfd.cAccumGreenBits = 16;
+  pfd.cAccumBlueBits = 16;
+  pfd.cAccumAlphaBits = 0;
+  pfd.cDepthBits = 32;
+  pfd.cStencilBits = 8;
+  pfd.cAuxBuffers = 0;
+  pfd.iLayerType = PFD_MAIN_PLANE;
+  pfd.bReserved	= 0;
+  pfd.dwLayerMask = 0;
+  pfd.dwVisibleMask = 0;
+  pfd.dwDamageMask = 0;
+  
+  int pixelIndex = ::ChoosePixelFormat(aHdc,&pfd);
+  if (pixelIndex==0) {
+    pixelIndex = 1;	
+    if (::DescribePixelFormat(aHdc, 
+			      pixelIndex, 
+			      sizeof(PIXELFORMATDESCRIPTOR), 
+			      &pfd)==0) {
+      return false;
+    }
+  }
+  if (::SetPixelFormat(aHdc,pixelIndex,&pfd)==FALSE) return false;
+  return true;
+}
+
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXViewer.cc	(revision 562)
@@ -0,0 +1,1091 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXViewer.cc,v 1.34 2006/11/01 11:22:26 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+//
+// 
+// Andrew Walkden  7th February 1997
+// G4OpenGLXViewer : Class to provide XWindows specific
+//                 functionality for OpenGL in GEANT4
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4OpenGLXViewer.hh"
+
+#include "G4OpenGLFontBaseStore.hh"
+
+#include <sstream>
+
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+
+#include <assert.h>
+
+int G4OpenGLXViewer::snglBuf_RGBA[12] =
+{ GLX_RGBA,
+  GLX_RED_SIZE, 1,
+  GLX_GREEN_SIZE, 1, 
+  GLX_BLUE_SIZE, 1,
+  GLX_DEPTH_SIZE, 1,
+  GLX_STENCIL_SIZE, 1,
+  None };
+
+int G4OpenGLXViewer::dblBuf_RGBA[13] =
+{ GLX_RGBA,
+  GLX_RED_SIZE, 1,
+  GLX_GREEN_SIZE, 1,
+  GLX_BLUE_SIZE, 1,
+  GLX_DOUBLEBUFFER,
+  GLX_DEPTH_SIZE, 1,
+  GLX_STENCIL_SIZE, 1,
+  None };
+
+#define NewString(str) \
+ ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
+
+#define USE_DEFAULT_COLORMAP 1
+#define USE_STANDARD_COLORMAP 0
+
+static const char* gouraudtriangleEPS[] =
+{
+  "/bd{bind def}bind def /triangle { aload pop   setrgbcolor  aload pop 5 3",
+  "roll 4 2 roll 3 2 roll exch moveto lineto lineto closepath fill } bd",
+  "/computediff1 { 2 copy sub abs threshold ge {pop pop pop true} { exch 2",
+  "index sub abs threshold ge { pop pop true} { sub abs threshold ge } ifelse",
+  "} ifelse } bd /computediff3 { 3 copy 0 get 3 1 roll 0 get 3 1 roll 0 get",
+  "computediff1 {true} { 3 copy 1 get 3 1 roll 1 get 3 1 roll 1 get",
+  "computediff1 {true} { 3 copy 2 get 3 1 roll  2 get 3 1 roll 2 get",
+  "computediff1 } ifelse } ifelse } bd /middlecolor { aload pop 4 -1 roll",
+  "aload pop 4 -1 roll add 2 div 5 1 roll 3 -1 roll add 2 div 3 1 roll add 2",
+  "div 3 1 roll exch 3 array astore } bd /gouraudtriangle { computediff3 { 4",
+  "-1 roll aload 7 1 roll 6 -1 roll pop 3 -1 roll pop add 2 div 3 1 roll add",
+  "2 div exch 3 -1 roll aload 7 1 roll exch pop 4 -1 roll pop add 2 div 3 1",
+  "roll add 2 div exch 3 -1 roll aload 7 1 roll pop 3 -1 roll pop add 2 div 3",
+  "1 roll add 2 div exch 7 3 roll 10 -3 roll dup 3 index middlecolor 4 1 roll",
+  "2 copy middlecolor 4 1 roll 3 copy pop middlecolor 4 1 roll 13 -1 roll",
+  "aload pop 17 index 6 index 15 index 19 index 6 index 17 index 6 array",
+  "astore 10 index 10 index 14 index gouraudtriangle 17 index 5 index 17",
+  "index 19 index 5 index 19 index 6 array astore 10 index 9 index 13 index",
+  "gouraudtriangle 13 index 16 index 5 index 15 index 18 index 5 index 6",
+  "array astore 12 index 12 index 9 index gouraudtriangle 17 index 16 index",
+  "15 index 19 index 18 index 17 index 6 array astore 10 index 12 index 14",
+  "index gouraudtriangle 18 {pop} repeat } { aload pop 5 3 roll aload pop 7 3",
+  "roll aload pop 9 3 roll 4 index 6 index 4 index add add 3 div 10 1 roll 7",
+  "index 5 index 3 index add add 3 div 10 1 roll 6 index 4 index 2 index add",
+  "add 3 div 10 1 roll 9 {pop} repeat 3 array astore triangle } ifelse } bd",
+  NULL
+};
+
+XVisualInfo*  G4OpenGLXViewer::vi_single_buffer = 0;
+XVisualInfo*  G4OpenGLXViewer::vi_double_buffer = 0;
+
+extern "C" {
+  Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
+    return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
+  }
+}
+
+void G4OpenGLXViewer::SetView () {
+  glXMakeCurrent (dpy, win, cx);
+  G4OpenGLViewer::SetView ();  
+}
+
+void G4OpenGLXViewer::ShowView () {
+  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
+                //be propagated before progressing.
+  glFlush ();
+}
+
+void G4OpenGLXViewer::GetXConnection () {
+// get a connection.
+  dpy = XOpenDisplay (0);
+  if (!dpy) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't open display." << G4endl;
+    return;
+  }
+
+// make sure OpenGL is supported and installed properly.
+  if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer X Server has no GLX extension." 
+	 << G4endl;
+    return;
+  }
+
+}
+
+void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
+
+  vi = v;
+// get window's attributes
+  if (!XGetWindowAttributes(dpy, XRootWindow (dpy, vi -> screen), &xwa)) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't return window attributes"
+	 << G4endl;
+    return;
+  }
+  
+// create a GLX context
+  cx = glXCreateContext (dpy, vi, 0, true);
+  if (!cx) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't create context."
+	 << G4endl;
+    return;
+  }
+
+// New stab at getting a colormap
+
+  Status status;
+  XStandardColormap *standardCmaps = XAllocStandardColormap ();
+  int i, numCmaps;
+
+  status = XmuLookupStandardColormap (dpy, 
+				      vi -> screen, 
+				      vi -> visualid, 
+				      vi -> depth, 
+				      XA_RGB_DEFAULT_MAP, 
+				      False, 
+				      True);
+  
+  if (status == 1) {
+    status = XGetRGBColormaps (dpy, 
+			       XRootWindow (dpy, vi -> screen), 
+			       &standardCmaps, 
+			       &numCmaps, 
+			       XA_RGB_DEFAULT_MAP);
+    if (status == 1)
+      for (i = 0; i < numCmaps; i++)
+	if (standardCmaps[i].visualid == vi -> visualid) {
+	  cmap = standardCmaps[i].colormap;
+	  XFree (standardCmaps);
+	}
+    G4cout << "Got standard cmap" << G4endl;
+  } else {
+    cmap = XCreateColormap (dpy, 
+			    XRootWindow(dpy, vi -> screen), 
+			    vi -> visual, 
+			    AllocNone);
+    G4cout << "Created own cmap" << G4endl;
+  }
+
+  if (!cmap) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap."
+	 << G4endl;
+    return;
+  }
+
+}
+  
+void G4OpenGLXViewer::CreateMainWindow () {
+  
+// create a window
+  swa.colormap = cmap;
+  swa.border_pixel = 0;
+  swa.event_mask = ExposureMask | ButtonPressMask | StructureNotifyMask;
+  swa.backing_store = WhenMapped;
+
+  // Window size and position...
+  unsigned int width, height;
+  x_origin = 0;
+  y_origin = 0;
+  size_hints = XAllocSizeHints();
+  const G4String& XGeometryString = fVP.GetXGeometryString();
+  int screen_num = DefaultScreen(dpy);
+  if (!XGeometryString.empty()) {
+    G4int geometryResultMask = XParseGeometry
+      ((char*)XGeometryString.c_str(),
+       &x_origin, &y_origin, &width, &height);
+    if (geometryResultMask & (WidthValue | HeightValue)) {
+      if (geometryResultMask & XValue) {
+	if (geometryResultMask & XNegative) {
+	  x_origin = DisplayWidth(dpy, screen_num) + x_origin - width;
+	}
+	size_hints->flags |= PPosition;
+	size_hints->x = x_origin;
+      }
+      if (geometryResultMask & YValue) {
+	if (geometryResultMask & YNegative) {
+	  y_origin = DisplayHeight(dpy, screen_num) + y_origin - height;
+	}
+	size_hints->flags |= PPosition;
+	size_hints->y = y_origin;
+      }
+    } else {
+      G4cout << "ERROR: Geometry string \""
+	     << XGeometryString
+	     << "\" invalid.  Using \"600x600\"."
+	     << G4endl;
+      width = 600;
+      height = 600;
+    }
+  }
+  size_hints->width = width;
+  size_hints->height = height;
+  size_hints->flags |= PSize;
+
+  //  G4int                             WinSize_x;
+  //  G4int                             WinSize_y;
+  WinSize_x = width;
+  WinSize_y = height;
+
+  G4cout << "Window name: " << fName << G4endl;
+  strncpy (charViewName, fName, 100);
+  char *window_name = charViewName;
+  char *icon_name = charViewName;
+  //char tmpatom[] = "XA_WM_NORMAL_HINTS"; 
+  wm_hints = XAllocWMHints();
+  class_hints = XAllocClassHint();
+
+  XStringListToTextProperty (&window_name, 1, &windowName);
+  XStringListToTextProperty (&icon_name, 1, &iconName);
+
+  wm_hints -> initial_state = NormalState;
+  wm_hints -> input = True;
+  wm_hints -> icon_pixmap = icon_pixmap;
+  wm_hints -> flags = StateHint | IconPixmapHint | InputHint;
+
+  class_hints -> res_name  = NewString("G4OpenGL");
+  class_hints -> res_class = NewString("G4OpenGL");
+
+  win = XCreateWindow (dpy, XRootWindow (dpy, vi -> screen), x_origin, 
+                       y_origin, WinSize_x, WinSize_y, 0, vi -> depth,
+                       InputOutput, vi -> visual,  
+                       CWBorderPixel | CWColormap | 
+                       CWEventMask | CWBackingStore,
+                       &swa);
+  
+  XSetWMProperties (dpy, win, &windowName, &iconName, 0, 0, 
+                    size_hints, wm_hints, class_hints);
+  
+// request X to Draw window on screen.
+  XMapWindow (dpy, win);
+
+// Wait for window to appear (wait for an "expose" event).
+  XIfEvent (dpy, &event, G4OpenGLXViewerWaitForNotify, (char*) win);
+
+// connect the context to a window
+  glXMakeCurrent (dpy, win, cx);
+
+}
+
+void G4OpenGLXViewer::CreateFontLists () {
+
+  std::map<G4double,G4String> fonts;  // G4VMarker screen size and font name.
+  fonts[10.] = "-adobe-courier-bold-r-normal--10-100-75-75-m-60-iso8859-1";
+  fonts[11.] = "-adobe-courier-bold-r-normal--11-80-100-100-m-60-iso8859-1";
+  fonts[12.] = "-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1";
+  fonts[13.] = "fixed";
+  fonts[14.] = "-adobe-courier-bold-r-normal--14-100-100-100-m-90-iso8859-1";
+  fonts[17.] = "-adobe-courier-bold-r-normal--17-120-100-100-m-100-iso8859-1";
+  fonts[18.] = "-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1";
+  fonts[20.] = "-adobe-courier-bold-r-normal--20-140-100-100-m-110-iso8859-1";
+  fonts[24.] = "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1";
+  fonts[25.] = "-adobe-courier-bold-r-normal--25-180-100-100-m-150-iso8859-1";
+  fonts[34.] = "-adobe-courier-bold-r-normal--34-240-100-100-m-200-iso8859-1";
+  std::map<G4double,G4String>::const_iterator i;
+  for (i = fonts.begin(); i != fonts.end(); ++i) {
+    XFontStruct* font_info = XLoadQueryFont(dpy, i->second);
+    if (!font_info) {
+      G4cerr <<
+	"G4OpenGLXViewer: XLoadQueryFont failed for font\n  "
+	     << i->second
+	     << G4endl;
+      continue;
+    }
+    G4int font_base = glGenLists(256);
+    if (!font_base) {
+      G4cerr << "G4OpenGLXViewer: out of display lists for fonts." 
+	     << G4endl;
+      continue;
+    }
+    G4int first = font_info->min_char_or_byte2;
+    G4int last  = font_info->max_char_or_byte2;
+    glXUseXFont(font_info->fid, first, last-first+1,font_base+first);
+    G4OpenGLFontBaseStore::AddFontBase(this,font_base,i->first,i->second);
+  }
+}
+
+G4OpenGLXViewer::G4OpenGLXViewer (G4OpenGLSceneHandler& scene):
+G4VViewer (scene, -1),
+G4OpenGLViewer (scene),
+print_colour (true),
+vectored_ps (true),
+vi_immediate (0),
+vi_stored (0)
+{
+
+  strcpy (print_string, "G4OpenGL.eps");
+
+  GetXConnection ();
+  if (fViewId < 0) return;
+  
+  // Try for a visual suitable for OpenGLImmediate..
+  // first try for a single buffered RGB window
+  if (!vi_single_buffer) {
+    vi_single_buffer =
+      glXChooseVisual (dpy, XDefaultScreen (dpy), snglBuf_RGBA);
+  }
+  if (!vi_double_buffer) {
+    vi_double_buffer =
+      glXChooseVisual (dpy, XDefaultScreen (dpy), dblBuf_RGBA);
+  }
+
+  if (vi_single_buffer || vi_double_buffer) {
+    if (!vi_double_buffer) {
+      G4cout <<
+	"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual."
+	"\n  Working with a single buffer."
+	     << G4endl;
+    }
+  } else {
+    if (!vi_single_buffer) {
+      G4cout <<
+	"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a single buffer visual."
+	     << G4endl;
+    }
+    if (!vi_double_buffer) {
+      G4cout <<
+	"G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual."
+	     << G4endl;
+    }
+  }
+
+  if (vi_single_buffer) {
+    vi_immediate = vi_single_buffer;
+    attributeList = snglBuf_RGBA;
+  }
+  
+  if (!vi_immediate){
+    // next try for a double buffered RGB, but Draw to top buffer
+    if (vi_double_buffer) {
+      vi_immediate = vi_double_buffer;
+      attributeList = dblBuf_RGBA;
+    }
+  }
+
+  // Now try for a visual suitable for OpenGLStored...
+  // Try for a double buffered RGB window
+  if (vi_double_buffer) {
+    vi_stored = vi_double_buffer;
+    attributeList = dblBuf_RGBA;
+  }
+
+  if (!vi_immediate || !vi_stored) {
+    G4cout <<
+    "G4OpenGLXViewer::G4OpenGLXViewer: unable to get required visuals."
+	   << G4endl;
+    fViewId = -1;  // This flags an error.
+  }
+
+  //  glClearColor (0., 0., 0., 0.);
+  //  glClearDepth (1.);
+}
+
+G4OpenGLXViewer::~G4OpenGLXViewer () {
+  if (fViewId >= 0) {
+    //Close a window from here
+    glXMakeCurrent (dpy, None, NULL);
+    glXDestroyContext (dpy, cx);
+    if (win) XDestroyWindow (dpy, win); // ...if already deleted in
+    // sub-class G4OpenGLXmViewer.
+    XFlush (dpy);
+  }
+}
+
+void G4OpenGLXViewer::print() {
+  
+  //using namespace std;
+  //cout << "print_col_callback requested with file name: " << print_string << G4endl;
+  
+  if (vectored_ps) {
+    G4int size = 5000000;
+    
+    GLfloat* feedback_buffer;
+    GLint returned;
+    FILE* file;
+    
+    feedback_buffer = new GLfloat[size];
+    glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
+    glRenderMode (GL_FEEDBACK);
+    
+    DrawView();
+    returned = glRenderMode (GL_RENDER);
+    
+    if (print_string) {
+      file = fopen (print_string, "w");
+      if (file) {
+	spewWireframeEPS (file, returned, feedback_buffer, "rendereps");
+      } else {
+	printf("Could not open %s\n", print_string);
+      }
+    } else {
+      printBuffer (returned, feedback_buffer);
+    }
+    //  free (feedback_buffer);
+    delete[] feedback_buffer;
+
+  } else {
+
+    XVisualInfo* pvi;
+    GLXContext pcx = create_GL_print_context(pvi);
+    GLXContext tmp_cx;
+    tmp_cx = cx;
+    cx=pcx;
+    
+    Pixmap pmap = XCreatePixmap (dpy,
+				 XRootWindow (dpy, pvi->screen),
+				 WinSize_x, WinSize_y,
+				 pvi->depth);
+    
+    GLXPixmap glxpmap = glXCreateGLXPixmap (dpy, 
+					    pvi,
+					    pmap);
+    
+    GLXDrawable tmp_win;
+    tmp_win=win;
+    win=glxpmap;
+    
+    glXMakeCurrent (dpy,
+		    glxpmap,
+		    cx);
+    
+    glViewport (0, 0, WinSize_x, WinSize_y);
+    
+    ClearView ();
+    DrawView ();
+    
+    generateEPS (print_string,
+		 print_colour,
+		 WinSize_x, WinSize_y);
+    
+    win=tmp_win;
+    cx=tmp_cx;
+    
+    glXMakeCurrent (dpy,
+		    glxpmap,
+		    cx);
+    
+  }
+
+}
+
+void G4OpenGLXViewer::print3DcolorVertex(GLint size, GLint * count, GLfloat * buffer)
+{
+  G4int i;
+
+  printf("  ");
+  for (i = 0; i < 7; i++) {
+    printf("%4.2f ", buffer[size - (*count)]);
+    *count = *count - 1;
+  }
+  printf("\n");
+}
+
+void G4OpenGLXViewer::spewWireframeEPS (FILE* file, GLint size, GLfloat* buffer, const char* cr) {
+
+  GLfloat EPS_GOURAUD_THRESHOLD=0.1;
+
+  GLfloat clearColor[4], viewport[4];
+  GLfloat lineWidth;
+  G4int i;
+
+  glGetFloatv (GL_VIEWPORT, viewport);
+  glGetFloatv (GL_COLOR_CLEAR_VALUE, clearColor);
+  glGetFloatv (GL_LINE_WIDTH, &lineWidth);
+  glGetFloatv (GL_POINT_SIZE, &pointSize);
+
+  fputs ("%!PS-Adobe-2.0 EPSF-2.0\n", file);
+  fprintf (file, "%%%%Creator: %s (using OpenGL feedback)\n", cr);
+  fprintf (file, "%%%%BoundingBox: %g %g %g %g\n", viewport[0], viewport[1], viewport[2], viewport[3]);
+  fputs ("%%EndComments\n", file);
+  fputs ("\n", file);
+  fputs ("gsave\n", file);
+  fputs ("\n", file);
+
+  fputs ("% the gouraudtriangle PostScript fragment below is free\n", file);
+  fputs ("% written by Frederic Delhoume (delhoume@ilog.fr)\n", file);
+  fprintf (file, "/threshold %g def\n", EPS_GOURAUD_THRESHOLD);
+  for (i=0; gouraudtriangleEPS[i]; i++) {
+    fprintf (file, "%s\n", gouraudtriangleEPS[i]);
+  }
+
+  fprintf(file, "\n%g setlinewidth\n", lineWidth);
+  
+  fprintf (file, "%g %g %g setrgbcolor\n", clearColor[0], clearColor[1], clearColor[2]);
+  fprintf (file, "%g %g %g %g rectfill\n\n", viewport[0], viewport[1], viewport[2], viewport[3]);
+
+  spewSortedFeedback (file, size, buffer);
+
+  fputs ("grestore\n\n", file);
+  fputs ("showpage\n", file);
+
+  fclose(file);
+}
+
+void G4OpenGLXViewer::printBuffer (GLint size, GLfloat* buffer) {
+
+  GLint count;
+  G4int token, nvertices;
+
+  count=size;
+  while(count) {
+    token=G4int (buffer[size-count]);
+    count--;
+    switch (token) {
+
+    case GL_PASS_THROUGH_TOKEN:
+      printf ("GL_PASS_THROUGH_TOKEN\n");
+      printf ("  %4.2f\n", buffer[size-count]);
+      count--;
+      break;
+
+    case GL_POINT_TOKEN:
+      printf ("GL_POINT_TOKEN\n");
+      print3DcolorVertex (size, &count, buffer);
+      break;
+
+    case GL_LINE_TOKEN:
+      printf ("GL_LINE_TOKEN\n");
+      print3DcolorVertex (size, &count, buffer);
+      print3DcolorVertex (size, &count, buffer);
+      break;
+      
+    case GL_LINE_RESET_TOKEN:
+      printf ("GL_LINE_RESET_TOKEN\n");
+      print3DcolorVertex (size, &count, buffer);
+      print3DcolorVertex (size, &count, buffer);
+      break;
+
+    case GL_POLYGON_TOKEN:
+      printf ("GL_POLYGON_TOKEN\n");
+      nvertices=G4int (buffer[size-count]);
+      count--;
+      for (; nvertices>0; nvertices--) {
+	print3DcolorVertex (size, &count, buffer);
+      }
+    }
+  }
+}
+
+G4float* G4OpenGLXViewer::spewPrimitiveEPS (FILE* file, GLfloat* loc) {
+  
+  G4int token;
+  G4int nvertices, i;
+  GLfloat red, green, blue, intensity;
+  G4int smooth;
+  GLfloat dx, dy, dr, dg, db, absR, absG, absB, colormax;
+  G4int steps;
+  Feedback3Dcolor *vertex;
+  GLfloat xstep(0.), ystep(0.), rstep(0.), gstep(0.), bstep(0.);
+  GLfloat xnext(0.), ynext(0.), rnext(0.), gnext(0.), bnext(0.), distance(0.);
+
+  token=G4int (*loc);
+  loc++;
+  switch (token) {
+  case GL_LINE_RESET_TOKEN:
+  case GL_LINE_TOKEN:
+    vertex=(Feedback3Dcolor*)loc;
+    dr=vertex[1].red - vertex[0].red;
+    dg=vertex[1].green - vertex[0].green;
+    db=vertex[1].blue - vertex[0].blue;
+
+    if (!print_colour) {
+      dr+=(dg+db);
+      dr/=3.0;
+      dg=dr;
+      db=dr;
+    }
+
+    if (dr!=0 || dg!=0 || db!=0) {
+      dx=vertex[1].x - vertex[0].x;
+      dy=vertex[1].y - vertex[0].y;
+      distance=std::sqrt(dx*dx + dy*dy);
+
+      absR=std::fabs(dr);
+      absG=std::fabs(dg);
+      absB=std::fabs(db);
+
+      #define Max(a, b) (((a)>(b))?(a):(b))
+
+      #define EPS_SMOOTH_LINE_FACTOR 0.06
+
+      colormax=Max(absR, Max(absG, absB));
+      steps=Max(1, G4int (colormax*distance*EPS_SMOOTH_LINE_FACTOR));
+      
+      xstep=dx/steps;
+      ystep=dy/steps;
+
+      rstep=dr/steps;
+      gstep=dg/steps;
+      bstep=db/steps;
+
+      xnext=vertex[0].x;
+      ynext=vertex[0].y;
+      rnext=vertex[0].red;
+      gnext=vertex[0].green;
+      bnext=vertex[0].blue;
+
+      if (!print_colour) {
+	rnext+=(gnext+bnext);
+	rnext/=3.0;
+	gnext=rnext;
+	bnext=rnext;
+      }
+
+      xnext -= xstep/2.0;
+      ynext -= ystep/2.0;
+      rnext -= rstep/2.0;
+      gnext -= gstep/2.0;
+      bnext -= bstep/2.0;
+    } else {
+      steps=0;
+    }
+    if (print_colour) {
+      fprintf (file, "%g %g %g setrgbcolor\n",
+	       vertex[0].red, vertex[0].green, vertex[0].blue);
+    } else {
+      intensity = (vertex[0].red + vertex[0].green + vertex[0].blue) / 3.0;
+      fprintf (file, "%g %g %g setrgbcolor\n",
+	       intensity, intensity, intensity);
+    }      
+    fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
+
+    for (i=0; i<steps; i++) {
+
+      xnext += xstep;
+      ynext += ystep;
+      rnext += rstep;
+      gnext += gstep;
+      bnext += bstep;
+
+      fprintf (file, "%g %g lineto stroke\n", xnext, ynext);
+      fprintf (file, "%g %g %g setrgbcolor\n", rnext, gnext, bnext);
+      fprintf (file, "%g %g moveto\n", xnext, ynext);
+    }
+    fprintf (file, "%g %g lineto stroke\n", vertex[1].x, vertex[1].y);
+
+    loc += 14;
+    break;
+
+  case GL_POLYGON_TOKEN:
+    nvertices = G4int (*loc);
+    loc++;
+    vertex=(Feedback3Dcolor*)loc;
+    if (nvertices>0) {
+      red=vertex[0].red;
+      green=vertex[0].green;
+      blue=vertex[0].blue;
+      smooth=0;
+      
+      if (!print_colour) {
+	red+=(green+blue);
+	red/=3.0;
+	green=red;
+	blue=red;
+      }
+      
+      if (print_colour) {
+	for (i=1; i<nvertices; i++) {
+	  if (red!=vertex[i].red || green!=vertex[i].green || blue!=vertex[i].blue) {
+	    smooth=1;
+	    break;
+	  }
+	}
+      } else {
+	for (i=1; i<nvertices; i++) {
+	  intensity = vertex[i].red + vertex[i].green + vertex[i].blue;
+	  intensity/=3.0;
+	  if (red!=intensity) {
+	    smooth=1;
+	    break;
+	  }
+	}
+      }
+
+      if (smooth) {
+	G4int triOffset;
+	for (i=0; i<nvertices-2; i++) {
+	  triOffset = i*7;
+	  fprintf (file, "[%g %g %g %g %g %g]",
+		   vertex[0].x, vertex[i+1].x, vertex[i+2].x,
+		   vertex[0].y, vertex[i+1].y, vertex[i+2].y);
+	  if (print_colour) {
+	    fprintf (file, " [%g %g %g] [%g %g %g] [%g %g %g] gouraudtriangle\n",
+		     vertex[0].red, vertex[0].green, vertex[0].blue,
+		     vertex[i+1].red, vertex[i+1].green, vertex[i+1].blue,
+		     vertex[i+2].red, vertex[i+2].green, vertex[i+2].blue);
+	  } else {
+
+	    intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
+	    intensity/=3.0;
+	    fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
+
+	    intensity = vertex[1].red + vertex[1].green + vertex[1].blue;
+	    intensity/=3.0;
+	    fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
+
+	    intensity = vertex[2].red + vertex[2].green + vertex[2].blue;
+	    intensity/=3.0;
+	    fprintf (file, " [%g %g %g] gouraudtriangle\n", intensity, intensity, intensity);
+	  }
+	}
+      } else {
+	fprintf (file, "newpath\n");
+	fprintf (file, "%g %g %g setrgbcolor\n", red, green, blue);
+	fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
+	for (i=1; i<nvertices; i++) {
+	  fprintf (file, "%g %g lineto\n", vertex[i].x, vertex[i].y);
+	}
+	fprintf (file, "closepath fill\n\n");
+      }
+    }
+    loc += nvertices*7;
+    break;
+
+  case GL_POINT_TOKEN:
+    vertex=(Feedback3Dcolor*)loc;
+    if (print_colour) {
+      fprintf (file, "%g %g %g setrgbcolor\n", vertex[0].red, vertex[0].green, vertex[0].blue);
+    } else {
+      intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
+      intensity/=3.0;
+      fprintf (file, "%g %g %g setrgbcolor\n", intensity, intensity, intensity);
+    }      
+    fprintf(file, "%g %g %g 0 360 arc fill\n\n", vertex[0].x, vertex[0].y, pointSize / 2.0);
+    loc += 7;           /* Each vertex element in the feedback
+                           buffer is 7 GLfloats. */
+    break;
+  default:
+    /* XXX Left as an excersie to the reader. */
+    static G4bool spewPrimitiveEPSWarned = false;
+    if (!spewPrimitiveEPSWarned) {
+      std::ostringstream oss;
+      oss <<
+	"Incomplete implementation.  Unexpected token (" << token << ")."
+	"\n  (Seems to be caused by text.)";
+      G4Exception("G4OpenGLXViewer::spewPrimitiveEPS",
+		  "Unexpected token",
+		  JustWarning,
+		  oss.str().c_str());
+      spewPrimitiveEPSWarned = true;
+    }
+  }
+  return loc;
+}
+
+typedef struct G4OpenGLXViewerDepthIndex {
+  GLfloat *ptr;
+  GLfloat depth;
+} DepthIndex;
+
+extern "C" {
+  int G4OpenGLXViewercompare(const void *a, const void *b)
+  {
+    const DepthIndex *p1 = (DepthIndex *) a;
+    const DepthIndex *p2 = (DepthIndex *) b;
+    GLfloat diff = p2->depth - p1->depth;
+    
+    if (diff > 0.0) {
+      return 1;
+    } else if (diff < 0.0) {
+      return -1;
+    } else {
+      return 0;
+    }
+  }
+}
+
+void G4OpenGLXViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffer)
+{
+  int token;
+  GLfloat *loc, *end;
+  Feedback3Dcolor *vertex;
+  GLfloat depthSum;
+  int nprimitives, item;
+  DepthIndex *prims;
+  int nvertices, i;
+
+  end = buffer + size;
+
+  /* Count how many primitives there are. */
+  nprimitives = 0;
+  loc = buffer;
+  while (loc < end) {
+    token = int (*loc);
+    loc++;
+    switch (token) {
+    case GL_LINE_TOKEN:
+    case GL_LINE_RESET_TOKEN:
+      loc += 14;
+      nprimitives++;
+      break;
+    case GL_POLYGON_TOKEN:
+      nvertices = int (*loc);
+      loc++;
+      loc += (7 * nvertices);
+      nprimitives++;
+      break;
+    case GL_POINT_TOKEN:
+      loc += 7;
+      nprimitives++;
+      break;
+    default:
+      /* XXX Left as an excersie to the reader. */
+      static G4bool spewSortedFeedbackWarned = false;
+      if (!spewSortedFeedbackWarned) {
+	std::ostringstream oss;
+	oss <<
+	  "Incomplete implementation.  Unexpected token (" << token << ")."
+	  "\n  (Seems to be caused by text.)";
+	G4Exception("G4OpenGLXViewer::spewSortedFeedback",
+		    "Unexpected token",
+		    JustWarning,
+		    oss.str().c_str());
+	spewSortedFeedbackWarned = true;
+      }
+      nprimitives++;
+    }
+  }
+
+  /* Allocate an array of pointers that will point back at
+     primitives in the feedback buffer.  There will be one
+     entry per primitive.  This array is also where we keep the
+     primitive's average depth.  There is one entry per
+     primitive  in the feedback buffer. */
+  prims = (DepthIndex *) malloc(sizeof(DepthIndex) * nprimitives);
+
+  item = 0;
+  loc = buffer;
+  while (loc < end) {
+    prims[item].ptr = loc;  /* Save this primitive's location. */
+    token = int (*loc);
+    loc++;
+    switch (token) {
+    case GL_LINE_TOKEN:
+    case GL_LINE_RESET_TOKEN:
+      vertex = (Feedback3Dcolor *) loc;
+      depthSum = vertex[0].z + vertex[1].z;
+      prims[item].depth = depthSum / 2.0;
+      loc += 14;
+      break;
+    case GL_POLYGON_TOKEN:
+      nvertices = int (*loc);
+      loc++;
+      vertex = (Feedback3Dcolor *) loc;
+      depthSum = vertex[0].z;
+      for (i = 1; i < nvertices; i++) {
+        depthSum += vertex[i].z;
+      }
+      prims[item].depth = depthSum / nvertices;
+      loc += (7 * nvertices);
+      break;
+    case GL_POINT_TOKEN:
+      vertex = (Feedback3Dcolor *) loc;
+      prims[item].depth = vertex[0].z;
+      loc += 7;
+      break;
+    default:
+      /* XXX Left as an excersie to the reader. */
+      assert(1);
+    }
+    item++;
+  }
+  assert(item == nprimitives);
+
+  /* Sort the primitives back to front. */
+  qsort(prims, nprimitives, sizeof(DepthIndex), G4OpenGLXViewercompare);
+
+  /* Understand that sorting by a primitives average depth
+     doesn't allow us to disambiguate some cases like self
+     intersecting polygons.  Handling these cases would require
+     breaking up the primitives.  That's too involved for this
+     example.  Sorting by depth is good enough for lots of
+     applications. */
+
+  /* Emit the Encapsulated PostScript for the primitives in
+     back to front order. */
+  for (item = 0; item < nprimitives; item++) {
+    (void) spewPrimitiveEPS(file, prims[item].ptr);
+  }
+
+  free(prims);
+}
+
+GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi) {
+  
+  pvi = glXChooseVisual (dpy,
+			 XDefaultScreen (dpy),
+			 snglBuf_RGBA);
+
+  if (!pvi) {
+    pvi = glXChooseVisual (dpy,
+			   XDefaultScreen (dpy),
+			   dblBuf_RGBA);
+  }
+
+  return glXCreateContext (dpy,
+			   pvi,
+			   NULL,
+			   False);
+}
+
+int G4OpenGLXViewer::generateEPS (char* filnam,
+				int inColour,
+				unsigned int width,
+				unsigned int height) {
+
+  FILE* fp;
+  GLubyte* pixels;
+  GLubyte* curpix;
+  int components, pos, i;
+
+  pixels = grabPixels (inColour, width, height);
+
+  if (pixels == NULL)
+    return 1;
+  if (inColour) {
+    components = 3;
+  } else {
+    components = 1;
+  }
+  
+  fp = fopen (filnam, "w");
+  if (fp == NULL) {
+    return 2;
+  }
+  
+  fprintf (fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
+  fprintf (fp, "%%%%Title: %s\n", filnam);
+  fprintf (fp, "%%%%Creator: OpenGL pixmap render output\n");
+  fprintf (fp, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
+  fprintf (fp, "%%%%EndComments\n");
+  fprintf (fp, "gsave\n");
+  fprintf (fp, "/bwproc {\n");
+  fprintf (fp, "    rgbproc\n");
+  fprintf (fp, "    dup length 3 idiv string 0 3 0 \n");
+  fprintf (fp, "    5 -1 roll {\n");
+  fprintf (fp, "    add 2 1 roll 1 sub dup 0 eq\n");
+  fprintf (fp, "    { pop 3 idiv 3 -1 roll dup 4 -1 roll dup\n");
+  fprintf (fp, "       3 1 roll 5 -1 roll } put 1 add 3 0 \n");
+  fprintf (fp, "    { 2 1 roll } ifelse\n");
+  fprintf (fp, "    }forall\n");
+  fprintf (fp, "    pop pop pop\n");
+  fprintf (fp, "} def\n");
+  fprintf (fp, "systemdict /colorimage known not {\n");
+  fprintf (fp, "   /colorimage {\n");
+  fprintf (fp, "       pop\n");
+  fprintf (fp, "       pop\n");
+  fprintf (fp, "       /rgbproc exch def\n");
+  fprintf (fp, "       { bwproc } image\n");
+  fprintf (fp, "   }  def\n");
+  fprintf (fp, "} if\n");
+  fprintf (fp, "/picstr %d string def\n", width * components);
+  fprintf (fp, "%d %d scale\n", width, height);
+  fprintf (fp, "%d %d %d\n", width, height, 8);
+  fprintf (fp, "[%d 0 0 %d 0 0]\n", width, height);
+  fprintf (fp, "{currentfile picstr readhexstring pop}\n");
+  fprintf (fp, "false %d\n", components);
+  fprintf (fp, "colorimage\n");
+  
+  curpix = (GLubyte*) pixels;
+  pos = 0;
+  for (i = width*height*components; i>0; i--) {
+    fprintf (fp, "%02hx ", *(curpix++));
+    if (++pos >= 32) {
+      fprintf (fp, "\n");
+      pos = 0; 
+    }
+  }
+  if (pos)
+    fprintf (fp, "\n");
+
+  fprintf (fp, "grestore\n");
+  fprintf (fp, "showpage\n");
+  delete pixels;
+  fclose (fp);
+  return 0;
+}
+
+GLubyte* G4OpenGLXViewer::grabPixels (int inColor, unsigned int width, unsigned int height) {
+  
+  GLubyte* buffer;
+  GLint swapbytes, lsbfirst, rowlength;
+  GLint skiprows, skippixels, alignment;
+  GLenum format;
+  int size;
+
+  if (inColor) {
+    format = GL_RGB;
+    size = width*height*3;
+  } else {
+    format = GL_LUMINANCE;
+    size = width*height*1;
+  }
+
+  buffer = new GLubyte[size];
+  if (buffer == NULL)
+    return NULL;
+
+  glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
+  glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
+  glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
+
+  glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
+  glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
+  glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
+
+  glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
+  glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
+  glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
+
+  glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
+  glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
+  glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
+
+  glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
+
+  glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
+  glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
+  glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
+  
+  glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
+  glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
+  glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
+  
+  return buffer;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXViewerMessenger.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXViewerMessenger.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXViewerMessenger.cc	(revision 562)
@@ -0,0 +1,115 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXViewerMessenger.cc,v 1.5 2006/11/21 16:24:00 allison Exp $
+// GEANT4 tag $Name: geant4-08-02-patch-01 $
+
+#ifdef G4VIS_BUILD_OPENGLX_DRIVER
+
+#include "G4OpenGLXViewerMessenger.hh"
+
+#include "G4OpenGLXViewer.hh"
+
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithoutParameter.hh"
+#include "G4UIcmdWithABool.hh"
+#include "G4VisManager.hh"
+#include <sstream>
+
+G4OpenGLXViewerMessenger* G4OpenGLXViewerMessenger::fpInstance = 0;
+
+G4OpenGLXViewerMessenger* G4OpenGLXViewerMessenger::GetInstance()
+{
+  if (!fpInstance) fpInstance = new G4OpenGLXViewerMessenger;
+  return fpInstance;
+}
+
+G4OpenGLXViewerMessenger::G4OpenGLXViewerMessenger()
+{
+  fpDirectory = new G4UIdirectory("/vis/oglx/");
+  fpDirectory->SetGuidance("G4OpenGLXViewer commands.");
+
+  fpCommandPrintEPS =
+    new G4UIcmdWithoutParameter("/vis/oglx/printEPS", this);
+  fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file.");
+  fpCommandPrintEPS->SetGuidance
+    ("Generates files with names G4OpenGL_n.eps, where n is a sequence"
+     "\nnumber, starting at 0.");
+}
+
+G4OpenGLXViewerMessenger::~G4OpenGLXViewerMessenger ()
+{
+  delete fpCommandPrintEPS;
+  delete fpDirectory;
+}
+
+void G4OpenGLXViewerMessenger::SetNewValue
+(G4UIcommand* command, G4String)
+{
+  G4VisManager* pVisManager = G4VisManager::GetInstance();
+
+  G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
+
+  if (!pVViewer) {
+    G4cout <<
+      "G4OpenGLXViewerMessenger::SetNewValue: No current viewer."
+      "\n  \"/vis/open\", or similar, to get one."
+           << G4endl;
+    return;
+  }
+
+  G4OpenGLXViewer* pViewer = dynamic_cast<G4OpenGLXViewer*>(pVViewer);
+
+  if (!pViewer) {
+    G4cout <<
+      "G4OpenGLXViewerMessenger::SetNewValue: Current viewer is not of type"
+      "\n  OGL*X*.  This feature currently only available on X Windows."
+           << G4endl;
+    return;
+  }
+
+  if (command == fpCommandPrintEPS)
+    {
+      // Keep copy of print_string to preserve Xm behaviour...
+      char* tmp_string = new char[50];
+      strcpy (tmp_string, pViewer->print_string);
+      // Make new print string...
+      static G4int file_count = 0;
+      std::ostringstream oss;
+      oss << "G4OpenGL_" << file_count++ << ".eps";
+      strcpy (pViewer->print_string, oss.str().c_str());
+      // Print eps file...
+      pViewer->print();
+      // Restore print_string for Xm...
+      strcpy (pViewer->print_string, tmp_string);
+      delete tmp_string;
+    }
+
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmBox.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmBox.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmBox.cc	(revision 562)
@@ -0,0 +1,108 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmBox.cc,v 1.6 2006/06/29 21:19:40 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Box container class
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmFramedBox.hh"
+#include "G4OpenGLXmBox.hh"
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetShell.hh"
+
+G4OpenGLXmBox::G4OpenGLXmBox (const char* n, 
+			      G4bool r)
+{
+  name = n;
+  radio = r;
+  parent = NULL;
+  box_row_col = NULL;
+}
+
+G4OpenGLXmBox::~G4OpenGLXmBox () 
+{}
+
+void G4OpenGLXmBox::AddChild (G4OpenGLXmVWidgetComponent* component)
+{
+  component->AddYourselfTo(this);
+  Cardinal num_children;
+  XtVaGetValues (box_row_col,
+		 XmNnumChildren, &num_children,
+		 NULL);
+//  G4cout << name << " now parents " << num_children << " children." << G4endl;
+}
+
+void G4OpenGLXmBox::AddYourselfTo (G4OpenGLXmVWidgetShell* window)
+{
+
+  pView = window->GetView ();
+  ProcesspView ();
+  parent = window->GetPointerToWidget ();
+  
+  box_row_col =  XtVaCreateManagedWidget (name,
+					  xmRowColumnWidgetClass,
+					  *parent,
+					  
+					  XmNadjustMargin, True,
+					  XmNisHomogeneous, False,
+					  XmNlabelString, (XmString)name,
+					  XmNradioAlwaysOne, radio,
+					  XmNradioBehavior, radio,
+					  
+					  XtNvisual, visual,
+					  XtNdepth, depth,
+					  XtNcolormap, cmap,
+					  XtNborderColor, borcol,
+					  XtNbackground, bgnd,
+					  
+					  NULL);
+  
+}
+
+Widget* G4OpenGLXmBox::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmBox::GetPointerToWidget ()
+{
+  return &box_row_col;
+}
+
+const char* G4OpenGLXmBox::GetName ()
+{
+  return name;
+}
+
+void G4OpenGLXmBox::SetName (const char* n)
+{
+  name = n;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmConvenienceRoutines.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmConvenienceRoutines.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmConvenienceRoutines.cc	(revision 562)
@@ -0,0 +1,527 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.11 2006/06/29 21:19:42 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmConvenienceRoutines : 
+//                       Collection of routines to facilitate
+//                       the addition of simple push button boxes,
+//                       and slider bars to the control panel.
+//
+// See G4OpenGLXmConvenienceRoutines.hh for more information.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewer.hh"
+
+void G4OpenGLXmViewer::Add_four_arrow_buttons (G4OpenGLXmViewer* pView,
+					     XtCallbackRec** arrow_callbacks,
+					     Widget* parent_widget) {
+  
+  Widget arrow_form = XtVaCreateWidget 
+    ("arrow_form",
+     xmFormWidgetClass,
+     *parent_widget,
+     XmNfractionBase, 3,
+     XtNvisual, pView->vi->visual, 
+     XtNdepth, pView->vi->depth, 
+     XtNcolormap, pView->cmap, 
+     XtNborderColor, pView->borcol,
+     XtNbackground, pView->bgnd,
+     NULL);
+  
+  Widget arrow = XtVaCreateManagedWidget 
+    ("up_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 0,
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 1,
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 1,
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 2,
+     XmNarrowDirection, XmARROW_UP,
+     NULL);
+  
+  XtVaSetValues (arrow,
+		 XmNuserData, True,
+		 NULL);
+  
+  XtAddCallbacks (arrow, 
+		 XmNactivateCallback, 
+		 arrow_callbacks[0]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNarmCallback, 
+		 arrow_callbacks[0]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNdisarmCallback, 
+		 arrow_callbacks[0]);
+  
+  arrow = XtVaCreateManagedWidget 
+    ("down_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 2,
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 3,
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 1,
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 2,
+     XmNarrowDirection, XmARROW_DOWN,
+     NULL);
+  
+  XtVaSetValues (arrow,
+		 XmNuserData, False,
+		 NULL);
+  
+  XtAddCallbacks (arrow, 
+		 XmNactivateCallback, 
+		 arrow_callbacks[1]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNarmCallback,
+		 arrow_callbacks[1]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNdisarmCallback, 
+		 arrow_callbacks[1]);
+  
+  arrow = XtVaCreateManagedWidget 
+    ("left_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 1,
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 2,
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 0,
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 1,
+     XmNarrowDirection, XmARROW_LEFT,
+     NULL);
+  
+  XtVaSetValues (arrow,
+		 XmNuserData, False,
+		 NULL);
+
+  XtAddCallbacks (arrow, 
+		 XmNactivateCallback, 
+		 arrow_callbacks[2]);
+
+  XtAddCallbacks (arrow, 
+		 XmNarmCallback, 
+		 arrow_callbacks[2]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNdisarmCallback, 
+		 arrow_callbacks[2]);
+      
+  arrow = XtVaCreateManagedWidget 
+    ("right_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 1,
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 2,
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 2,
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 3,
+     XmNarrowDirection, XmARROW_RIGHT,
+     NULL);
+  
+  XtVaSetValues (arrow,
+		 XmNuserData, True,
+		 NULL);
+  
+  XtAddCallbacks (arrow, 
+		 XmNactivateCallback, 
+		 arrow_callbacks[3]);
+  
+  XtAddCallbacks (arrow, 
+		 XmNarmCallback, 
+		 arrow_callbacks[3]);
+
+  XtAddCallbacks (arrow, 
+		 XmNdisarmCallback, 
+		 arrow_callbacks[3]);
+  
+  XtManageChild (arrow_form);
+  
+}
+
+void G4OpenGLXmViewer::Add_radio_box (char* label_string,
+				    Widget* parent_widget,
+				    XtCallbackRec* radio_box_callback,
+				    G4int num_buttons,
+				    G4int default_button,
+				    char* radio_box_name,
+				    char** button_names,
+				    G4OpenGLXmViewer* pView)
+{
+  XmString button_str = XmStringCreateLocalized((char*) ""); // ...to
+  // initialise to something to avoid pedantic warning.
+  Arg** args;
+  args = new Arg* [num_buttons];
+  Widget button;
+
+  G4int i;
+  for (i = 0; i < num_buttons; i++) {
+
+    args[i] = new Arg[7];
+    button_str = XmStringCreateLocalized (button_names[i]);
+
+    XtSetArg (args[i][0], XtNvisual, pView->vi->visual);
+    XtSetArg (args[i][1], XtNdepth, pView->vi->depth);
+    XtSetArg (args[i][2], XtNcolormap, pView->cmap);
+    XtSetArg (args[i][3], XtNborderColor, pView->borcol);
+    XtSetArg (args[i][4], XtNbackground, pView->bgnd);
+    XtSetArg (args[i][5], XmNlabelString, button_str); 
+
+    if (i == default_button) {
+      XtSetArg (args[i][6], XmNset, True);
+    } else {
+      XtSetArg (args[i][6], XmNset, False);
+    }
+  }
+  
+  Widget radio_box = XtVaCreateWidget (radio_box_name,
+				       xmRowColumnWidgetClass,
+				       *parent_widget,
+				       XmNisHomogeneous, False,
+				       XmNradioBehavior, True,
+				       XmNradioAlwaysOne, True,
+				       XmNuserData, pView,
+				       XtNvisual, pView->vi->visual,
+				       XtNdepth, pView->vi->depth,
+				       XtNcolormap, pView->cmap,
+				       XtNborderColor, pView->borcol,
+				       XtNbackground, pView->bgnd,
+				       NULL);
+
+  XmString lab = XmStringCreateLocalized (label_string);
+
+  // Unused!
+  //Widget label = XtVaCreateManagedWidget ("radio_label",
+  //				  xmLabelWidgetClass,
+  //				  radio_box,
+  //				  XmNalignment, XmALIGNMENT_CENTER,
+  //				  XmNlabelString, lab,
+  //				  XtNvisual, pView->vi->visual,
+  //				  XtNdepth, pView->vi->depth,
+  //				  XtNcolormap, pView->cmap,
+  //				  XtNborderColor, pView->borcol,
+  //				  XtNbackground, pView->bgnd,
+  //				  NULL);
+
+  XmStringFree (lab);
+
+  for (i = 0; i < num_buttons; i++) {
+    button = XtCreateManagedWidget (button_names[i],
+				    xmToggleButtonWidgetClass,
+				    radio_box,
+				    args[i],
+				    7);
+    XtVaSetValues (button,
+		   XmNuserData, i,
+		   NULL);
+    
+    XtAddCallbacks (button,
+		   XmNarmCallback,
+		   radio_box_callback);
+  }
+
+  XtManageChild (radio_box);
+
+  XmStringFree (button_str);
+  
+  for (i = 0; i < num_buttons; i++) {
+
+    delete[] args[i];
+
+  }
+
+  delete[] args;
+}  
+
+void G4OpenGLXmViewer::Add_set_field (char* w_name, 
+				    char* w_text,
+				    Widget* row_col_box,
+				    Widget* wid,
+				    G4double* val,
+				    G4OpenGLXmViewer* pView)
+{
+
+  char local_w_text[50];
+  strcpy (local_w_text, w_text);
+
+  char label_name[50];
+  strcpy (label_name, w_name);
+  strcat (label_name, "_label");
+  
+  char text_field_name[50];
+  strcpy (text_field_name, w_name);
+  strcat (text_field_name, "_text_field");
+  
+  XmString local_text = XmStringCreateLocalized (local_w_text);
+
+  // Unused!
+  //  Widget label = XtVaCreateManagedWidget (label_name, 
+  //				  xmLabelWidgetClass,
+  //				  *row_col_box,
+  //				  XmNlabelString, local_text,
+  //				  XtNvisual, pView->vi->visual, 
+  //				  XtNdepth, pView->vi->depth, 
+  //				  XtNcolormap, pView->cmap, 
+  //				  XtNborderColor, pView->borcol,
+  //				  XtNbackground, pView->bgnd,
+  //				  NULL);
+
+  XmStringFree (local_text);
+
+  char initial[50];
+  sprintf (initial, "%6.2f", *val);
+  
+  *wid = XtVaCreateManagedWidget (text_field_name,
+				  xmTextFieldWidgetClass,
+				  *row_col_box,
+				  XmNvalue, (String)initial,
+				  XtNvisual, pView->vi->visual, 
+				  XtNdepth, pView->vi->depth, 
+				  XtNcolormap, pView->cmap, 
+				  XtNborderColor, pView->borcol,
+				  XtNbackground, pView->bgnd,
+				  NULL);
+
+  XtAddCallback (*wid, 
+		 XmNvalueChangedCallback,
+		 get_double_value_callback,
+		 val);
+
+  Widget sep = XtVaCreateManagedWidget ("sep",
+					xmSeparatorWidgetClass,
+					*row_col_box,
+					XmNorientation, XmHORIZONTAL,
+					XtNvisual, pView->vi->visual, 
+					XtNdepth, pView->vi->depth, 
+					XtNcolormap, pView->cmap, 
+					XtNborderColor, pView->borcol,
+					XtNbackground, pView->bgnd,
+					NULL);
+
+  sep = XtVaCreateManagedWidget ("sep",
+				 xmSeparatorWidgetClass,
+				 *row_col_box,
+				 XmNseparatorType, XmNO_LINE,
+				 XmNmargin, 1,
+				 XmNorientation, XmHORIZONTAL,
+				 XtNvisual, pView->vi->visual, 
+				 XtNdepth, pView->vi->depth, 
+				 XtNcolormap, pView->cmap, 
+				 XtNborderColor, pView->borcol,
+				 XtNbackground, pView->bgnd,
+				 NULL);
+}
+
+void G4OpenGLXmViewer::Add_slider_box (char* label_string,
+				     G4int num_sliders,
+				     char** slider_names,
+				     G4OpenGLXmViewer* pView,
+				     G4double* min_array,
+				     G4double* max_array,
+				     G4double* value_array,
+				     G4bool* show,
+				     short* decimals,
+				     unsigned char* orientation,
+				     unsigned char* direction,
+				     XtCallbackRec** slider_box_callbacks,
+				     Widget* parent_widget)
+{
+  XmString slider_name_str = XmStringCreateLocalized((char*) ""); // ...to
+  // initialise to something to avoid pedantic warning.
+  Arg** slider_args;
+  slider_args = new Arg*[num_sliders];
+  Widget slider;
+  G4int j = 0;
+
+  G4int i;
+  for (i = 0; i < num_sliders; i++) {
+    j = 0; 
+    slider_args[i] = new Arg[13];
+    slider_name_str = XmStringCreateLtoR (slider_names[i], 
+					  XmFONTLIST_DEFAULT_TAG);
+    
+    XtSetArg (slider_args[i][j], 
+	      XtNvisual, pView->vi->visual); j++;
+    XtSetArg (slider_args[i][j], 
+	      XtNdepth, pView->vi->depth); j++;
+    XtSetArg (slider_args[i][j], 
+	      XtNcolormap, pView->cmap); j++;
+    XtSetArg (slider_args[i][j], 
+	      XtNborderColor, pView->borcol); j++;
+    XtSetArg (slider_args[i][j], 
+	      XtNbackground, pView->bgnd); j++;
+    
+    XtSetArg (slider_args[i][j], 
+	      XmNtitleString, slider_name_str);  j++;
+    
+    XtSetArg (slider_args[i][j], 
+	      XmNmaximum, G4int(max_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNminimum, G4int(min_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNvalue, G4int(value_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNshowValue, show[i]); j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNdecimalPoints, decimals[i]); j++;
+    
+    XtSetArg (slider_args[i][j], 
+	      XmNorientation, orientation[i]);  j++;
+    XtSetArg (slider_args[i][j], 
+	      XmNprocessingDirection, direction[i]); j++;
+
+  }
+
+  Widget slider_box = XtVaCreateWidget ("slider_box",
+					xmRowColumnWidgetClass,
+					*parent_widget,
+					XmNisHomogeneous, False,
+					XtNvisual, pView->vi->visual,
+					XtNdepth, pView->vi->depth,
+					XtNcolormap, pView->cmap,
+					XtNborderColor, pView->borcol,
+					XtNbackground, pView->bgnd,
+					NULL);
+
+  XmString lab = XmStringCreateLocalized (label_string);
+
+  // Unused!
+  //Widget label = XtVaCreateManagedWidget ("slider_label",
+  //				  xmLabelWidgetClass,
+  //				  slider_box,
+  //				  XmNlabelString, lab,
+  //				  XmNalignment, XmALIGNMENT_CENTER,
+  //				  XtNvisual, pView->vi->visual,
+  //				  XtNdepth, pView->vi->depth,
+  //				  XtNcolormap, pView->cmap,
+  //				  XtNborderColor, pView->borcol,
+  //				  XtNbackground, pView->bgnd,
+  //				  NULL);
+
+  XmStringFree (lab);
+  
+  for (i = 0; i < num_sliders; i++) {
+    
+    slider = XtCreateManagedWidget (slider_names[i],
+				    xmScaleWidgetClass,
+				    slider_box,
+				    slider_args[i],
+				    j);
+
+    XtAddCallbacks (slider,
+		   XmNvalueChangedCallback,
+		   slider_box_callbacks[i]);
+    
+    XtAddCallbacks (slider,
+		   XmNdragCallback,
+		   slider_box_callbacks[i]);
+    
+  }
+
+  XtManageChild (slider_box);
+  XmStringFree (slider_name_str);
+
+  for (i = 0; i < num_sliders; i++) {
+
+    delete[] slider_args[i];
+
+  }
+
+  delete[] slider_args;
+
+}
+
+void G4OpenGLXmViewer::get_double_value_callback (Widget w, 
+						XtPointer clientData, 
+						XtPointer) 
+{
+  G4double* val = (G4double*) clientData;
+  String string;
+
+  XtVaGetValues (w,
+		 XmNvalue, &string,
+		 NULL);
+
+  sscanf (string, "%lg", val);
+
+}
+
+void G4OpenGLXmViewer::get_text_callback (Widget w, 
+					XtPointer clientData, 
+					XtPointer) 
+{
+  char* txt = (char*)clientData;
+  String string;
+
+  XtVaGetValues (w,
+		 XmNvalue, &string,
+		 NULL);
+
+  sscanf (string, "%s", txt);
+}
+
+G4bool G4OpenGLXmViewer::get_boolean_userData (Widget w)
+{
+  XtPointer userData;
+  XtVaGetValues (w,XmNuserData,&userData,NULL);
+  return (G4bool)(unsigned long)userData;
+}
+
+G4int G4OpenGLXmViewer::get_int_userData (Widget w)
+{
+  XtPointer userData;
+  XtVaGetValues (w,XmNuserData,&userData,NULL);
+  return (G4int)(unsigned long)userData;
+}
+
+#endif
+
+
+
+
+
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmFourArrowButtons.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmFourArrowButtons.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmFourArrowButtons.cc	(revision 562)
@@ -0,0 +1,219 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmFourArrowButtons.cc,v 1.5 2006/06/29 21:19:44 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmFourArrowButtons.hh"
+#include <X11/Intrinsic.h>
+#include "globals.hh"
+
+G4OpenGLXmFourArrowButtons::G4OpenGLXmFourArrowButtons (XtCallbackRec** c)
+{
+  callback = c;
+}
+
+G4OpenGLXmFourArrowButtons::~G4OpenGLXmFourArrowButtons ()
+{}
+
+void G4OpenGLXmFourArrowButtons::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+
+  parent = container->GetPointerToWidget ();
+
+  arrow_form = XtVaCreateManagedWidget 
+    ("arrow_form",
+     xmFormWidgetClass,
+     *parent,
+     XmNfractionBase, 3,
+
+     XtNvisual, visual, 
+     XtNdepth, depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+
+     NULL);
+
+
+///////////////`up' arrow///////////////  
+  arrow = XtVaCreateManagedWidget 
+    ("up_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 0,
+     
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 1,
+     
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 1,
+
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 2,
+
+     XmNarrowDirection, XmARROW_UP,
+     XmNuserData, True,
+     NULL);
+  
+  XtAddCallbacks (arrow, 
+		  XmNactivateCallback, 
+		  callback[0]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNarmCallback, 
+		  callback[0]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNdisarmCallback, 
+		  callback[0]);
+  
+///////////////`down' arrow///////////////  
+  arrow = XtVaCreateManagedWidget 
+    ("down_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 2,
+
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 3,
+
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 1,
+
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 2,
+
+     XmNarrowDirection, XmARROW_DOWN,
+     XmNuserData, False,
+     NULL);
+  
+  XtAddCallbacks (arrow, 
+		  XmNactivateCallback, 
+		  callback[1]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNarmCallback, 
+		  callback[1]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNdisarmCallback, 
+		  callback[1]);
+  
+///////////////`left' arrow///////////////  
+  arrow = XtVaCreateManagedWidget 
+    ("left_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 1,
+     
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 2,
+     
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 0,
+     
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 1,
+     
+     XmNarrowDirection, XmARROW_LEFT,
+     XmNuserData, False,
+     NULL);
+  
+  XtAddCallbacks (arrow, 
+		  XmNactivateCallback, 
+		  callback[2]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNarmCallback, 
+		  callback[2]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNdisarmCallback, 
+		  callback[2]);
+  
+///////////////`right' arrow///////////////  
+  arrow = XtVaCreateManagedWidget 
+    ("right_arrow",
+     xmArrowButtonGadgetClass, 
+     arrow_form,
+     
+     XmNtopAttachment, XmATTACH_POSITION,
+     XmNtopPosition, 1,
+     
+     XmNbottomAttachment, XmATTACH_POSITION,
+     XmNbottomPosition, 2,
+
+     XmNleftAttachment, XmATTACH_POSITION,
+     XmNleftPosition, 2,
+
+     XmNrightAttachment, XmATTACH_POSITION,
+     XmNrightPosition, 3,
+
+     XmNarrowDirection, XmARROW_RIGHT,
+     XmNuserData, True,
+     NULL);
+  
+  XtAddCallbacks (arrow, 
+		  XmNactivateCallback, 
+		  callback[3]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNarmCallback, 
+		  callback[3]);
+  
+  XtAddCallbacks (arrow, 
+		  XmNdisarmCallback, 
+		  callback[3]);
+
+}
+
+Widget* G4OpenGLXmFourArrowButtons::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmFourArrowButtons::GetPointerToWidget () 
+{
+  return &arrow_form;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmFramedBox.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmFramedBox.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmFramedBox.cc	(revision 562)
@@ -0,0 +1,103 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmFramedBox.cc,v 1.6 2006/06/29 21:19:46 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Framed box container class
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmBox.hh"
+#include "G4OpenGLXmFramedBox.hh"
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetShell.hh"
+
+G4OpenGLXmFramedBox::G4OpenGLXmFramedBox (const char* n, 
+					  G4bool r) :
+G4OpenGLXmBox (n, r)
+{
+  frame = NULL;
+}
+
+G4OpenGLXmFramedBox::~G4OpenGLXmFramedBox () 
+{}
+
+void G4OpenGLXmFramedBox::AddChild (G4OpenGLXmVWidgetComponent* component)
+{
+  component->AddYourselfTo(this);
+  Cardinal num_children;
+  XtVaGetValues (box_row_col,
+		 XmNnumChildren, &num_children,
+		 NULL);
+//  G4cout << name << " now parents " << num_children << " children." << G4endl;
+}
+
+void G4OpenGLXmFramedBox::AddYourselfTo (G4OpenGLXmVWidgetShell* window)
+{
+
+  pView = window->GetView ();
+  ProcesspView ();
+  char framename[50];
+  strcpy (framename, name);
+  strcat (framename, "_frame");
+
+  parent = window->GetPointerToWidget ();
+  frame = XtVaCreateManagedWidget (framename,
+				    xmFrameWidgetClass,
+				    *parent,
+				    
+				    XtNvisual, visual,
+				    XtNdepth, depth,
+				    XtNcolormap, cmap,
+				    XtNborderColor, borcol,
+				    XtNbackground, bgnd,
+				    
+				    NULL);
+  
+  
+  
+  box_row_col =  XtVaCreateManagedWidget (name,
+					  xmRowColumnWidgetClass,
+					  frame,
+					  
+					  XmNadjustMargin, True,
+					  XmNisHomogeneous, False,
+					  XmNlabelString, (XmString)name,
+					  XmNradioAlwaysOne, radio,
+					  XmNradioBehavior, radio,
+					  
+					  XtNvisual, visual,
+					  XtNdepth, depth,
+					  XtNcolormap, cmap,
+					  XtNborderColor, borcol,
+					  XtNbackground, bgnd,
+					  
+					  NULL);
+  
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmMainMenubarCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmMainMenubarCallbacks.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmMainMenubarCallbacks.cc	(revision 562)
@@ -0,0 +1,570 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmMainMenubarCallbacks : 
+//                       Collection of callback functions
+//                       to handle events generated by the
+//                       main OpenGLXm window menubar.
+//
+// See G4OpenGLXmMainMenubarCallbacks.hh for more information.
+
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4Xt.hh"
+
+#include "G4OpenGLXmViewer.hh"
+
+#include "G4Scene.hh"
+
+#include "G4OpenGLXmRadioButton.hh"
+#include "G4OpenGLXmSliderBar.hh"
+#include "G4OpenGLXmFourArrowButtons.hh"
+#include "G4OpenGLXmTextField.hh"
+#include "G4OpenGLXmPushButton.hh"
+#include "G4OpenGLXmBox.hh"
+#include "G4OpenGLXmFramedBox.hh"
+#include "G4OpenGLXmTopLevelShell.hh"
+#include "G4OpenGLXmSeparator.hh"
+
+#include <sstream>
+
+void G4OpenGLXmViewer::actions_callback (Widget w, 
+				       XtPointer clientData,
+				       XtPointer)
+{
+  
+  G4OpenGLXmViewer* pView;
+  G4long choice = (G4long)clientData;
+  
+  
+  XtVaGetValues (XtParent(w), 
+		 XmNuserData, &pView, 
+		 NULL);
+  
+  switch (choice) {
+    
+  case 0:
+    
+    {
+      
+      if (!pView->fprotation_top) {
+	std::ostringstream rot_Name;
+	rot_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fprotation_top = new G4OpenGLXmTopLevelShell (pView,
+							     (char*)rot_Name.str().c_str());
+	pView->fprotation_button_box = new G4OpenGLXmBox ("Rotation button box", True);
+	
+	pView->fprotation_top->AddChild (pView->fprotation_button_box);
+	
+	XtCallbackRec* rot_cb_list = new XtCallbackRec[2];
+	rot_cb_list[0].callback = set_rot_subject_callback;
+	rot_cb_list[0].closure = pView; 
+	rot_cb_list[1].callback = NULL;
+	
+	pView->fprotation_button1 = new G4OpenGLXmRadioButton
+	  ("Object",
+	   rot_cb_list,
+	   pView->GetViewParameters().GetLightsMoveWithCamera(),
+	   0);
+	
+	pView->fprotation_button2 = new G4OpenGLXmRadioButton
+	  ("Camera",
+	   rot_cb_list,
+	   !(pView->GetViewParameters().GetLightsMoveWithCamera()),
+	   1);
+	
+	pView->fprotation_button_box->AddChild (pView->fprotation_button1);
+	pView->fprotation_button_box->AddChild (pView->fprotation_button2);
+	
+	pView->fprotation_slider_box = new G4OpenGLXmBox ("Rotation slider box", False);
+	pView->fprotation_top->AddChild (pView->fprotation_slider_box);
+	
+	XtCallbackRec* rot_slider_list = new XtCallbackRec[2];
+	rot_slider_list[0].callback = set_rot_sens_callback;
+	rot_slider_list[0].closure = pView; 
+	rot_slider_list[1].callback = NULL;
+	
+	pView->fprotation_slider = new G4OpenGLXmSliderBar ("Rotation slider",
+							    rot_slider_list,
+							    True,
+							    2,
+							    pView->rot_sens,
+							    pView->rot_sens_limit,
+							    0);
+	pView->fprotation_slider_box->AddChild (pView->fprotation_slider);
+	
+	pView->fprotation_arrow_box = new G4OpenGLXmBox ("Rotation arrow box", False);
+	pView->fprotation_top->AddChild (pView->fprotation_arrow_box);
+	
+	XtCallbackRec** rotation_callbacks = new XtCallbackRec*[4];
+	for (G4int i = 0; i < 4; i++) {
+	  rotation_callbacks[i] = new XtCallbackRec[2];
+	}
+	rotation_callbacks[0][0].callback = phi_rotation_callback;
+	rotation_callbacks[0][0].closure =  pView;
+	rotation_callbacks[0][1].callback	= NULL;
+	
+	rotation_callbacks[1][0].callback = phi_rotation_callback;
+	rotation_callbacks[1][0].closure =  pView;
+	rotation_callbacks[1][1].callback	= NULL;
+	
+	rotation_callbacks[2][0].callback = theta_rotation_callback;
+	rotation_callbacks[2][0].closure =  pView;
+	rotation_callbacks[2][1].callback	= NULL;
+	
+	rotation_callbacks[3][0].callback = theta_rotation_callback;
+	rotation_callbacks[3][0].closure =  pView;
+	rotation_callbacks[3][1].callback	= NULL;
+	
+	pView->fprotation_arrow = new G4OpenGLXmFourArrowButtons (rotation_callbacks);
+	
+	pView->fprotation_arrow_box->AddChild (pView->fprotation_arrow);
+	
+	pView->fprotation_top->Realize ();
+      }
+      break;
+      
+    }
+  
+  
+  case 1:
+    {
+
+      if (!pView->fppanning_top) {
+	std::ostringstream pan_Name;
+	pan_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fppanning_top = new G4OpenGLXmTopLevelShell (pView, 
+							    (char*)pan_Name.str().c_str());
+	
+	pView->fppanning_box = new G4OpenGLXmFramedBox ("Pan up-down-left-right", 
+							False);
+	
+	pView->fppanning_top->AddChild (pView->fppanning_box);
+	
+	XtCallbackRec** pan_callbacks = new XtCallbackRec*[4];
+	for (G4int i = 0; i < 4; i++) {
+	  pan_callbacks[i] = new XtCallbackRec[2];
+	}
+	pan_callbacks[0][0].callback = pan_up_down_callback;
+	pan_callbacks[0][0].closure = pView; 
+	pan_callbacks[0][1].callback = NULL;
+	
+	pan_callbacks[1][0].callback = pan_up_down_callback;
+	pan_callbacks[1][0].closure = pView; 
+	pan_callbacks[1][1].callback = NULL;
+	
+	pan_callbacks[2][0].callback = pan_left_right_callback;
+	pan_callbacks[2][0].closure = pView; 
+	pan_callbacks[2][1].callback = NULL;
+	
+	pan_callbacks[3][0].callback = pan_left_right_callback;
+	pan_callbacks[3][0].closure = pView; 
+	pan_callbacks[3][1].callback = NULL;
+	
+	pView->fppanning_arrows = new G4OpenGLXmFourArrowButtons (pan_callbacks);
+	
+	pView->fppanning_box->AddChild (pView->fppanning_arrows);
+	
+	XtCallbackRec* pan_slider_list = new XtCallbackRec[2];
+	pan_slider_list[0].callback = set_pan_sens_callback;
+	pan_slider_list[0].closure = pView; 
+	pan_slider_list[1].callback = NULL;
+	
+	pView->fppanning_slider = new G4OpenGLXmSliderBar ("Panning slider",
+							   pan_slider_list,
+							   True,
+							   2,
+							   pView->pan_sens = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius() / 10.0,
+							   pView->pan_sens_limit = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius(),
+							   0);
+	pView->fppanning_box->AddChild (pView->fppanning_slider);
+	
+	pView->fpzoom_box = new G4OpenGLXmFramedBox ("Zoom", 
+						     False);      
+	pView->fppanning_top->AddChild (pView->fpzoom_box);
+	
+	XtCallbackRec* zoom_slider_list = new XtCallbackRec[2];
+	zoom_slider_list[0].callback = zoom_callback;
+	zoom_slider_list[0].closure = pView; 
+	zoom_slider_list[1].callback = NULL;
+	
+	pView->fpzoom_slider = new G4OpenGLXmSliderBar ("Zoom slider",
+							zoom_slider_list,
+							True,
+							2,
+							pView->fVP.GetZoomFactor(),
+							pView->zoom_high,
+							pView->zoom_low);
+	pView->fpzoom_box->AddChild (pView->fpzoom_slider);
+	
+	pView->fpdolly_box = new G4OpenGLXmFramedBox ("Dolly", 
+						      False);      
+	pView->fppanning_top->AddChild (pView->fpdolly_box);
+	
+	XtCallbackRec* dolly_slider_list = new XtCallbackRec[2];
+	dolly_slider_list[0].callback = dolly_callback;
+	dolly_slider_list[0].closure = pView; 
+	dolly_slider_list[1].callback = NULL;
+	
+	pView->fpdolly_slider = new G4OpenGLXmSliderBar ("Dolly slider",
+							 dolly_slider_list,
+							 True,
+							 2,
+							 pView->fVP.GetDolly(),
+							 pView->dolly_high = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius(),
+							 pView->dolly_low = -(pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius()));
+	//							 pView->dolly_high,
+	//							 pView->dolly_low);
+	pView->fpdolly_box->AddChild (pView->fpdolly_slider);
+	
+	pView->fppanning_top->Realize ();
+      }
+
+      break;
+      
+    }
+  case 2:
+    {
+      
+      if (!pView->fpsetting_top) {
+	std::ostringstream set_Name;
+	set_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fpsetting_top = new G4OpenGLXmTopLevelShell(pView,
+							   (char*)set_Name.str().c_str());
+	
+	pView->fpsetting_box = new G4OpenGLXmFramedBox ("Set values for control panels",
+							False);
+	pView->fpsetting_top->AddChild (pView->fpsetting_box);
+	
+	pView->fppan_set = new G4OpenGLXmTextField ("Upper limit of pan sensitivity",
+						    &(pView->pan_sens_limit));
+	
+	pView->fprot_set = new G4OpenGLXmTextField ("Upper limit of rotation sensitivity",
+						    &(pView->rot_sens_limit));
+	
+	pView->fpzoom_upper = new G4OpenGLXmTextField ("Upper limit of zoom",
+						       &(pView->zoom_high));
+	
+	pView->fpzoom_lower = new G4OpenGLXmTextField ("Lower limit of zoom",
+						       &(pView->zoom_low));
+	
+	pView->fpdolly_upper = new G4OpenGLXmTextField ("Upper limit of dolly",
+							&(pView->dolly_high));
+	
+	pView->fpdolly_lower = new G4OpenGLXmTextField ("Lower limit of dolly",
+							&(pView->dolly_low));
+	
+	XtCallbackRec* ok_list = new XtCallbackRec[2];
+	ok_list[0].callback = update_panels_callback;
+	ok_list[0].closure = pView; 
+	ok_list[1].callback = NULL;
+	
+	
+	pView->fpok_button = new G4OpenGLXmPushButton ("ok",
+						       ok_list);
+	
+	pView->fpsetting_box->AddChild (pView->fppan_set);
+	pView->fpsetting_box->AddChild (pView->fprot_set);
+	pView->fpsetting_box->AddChild (pView->fpzoom_upper);
+	pView->fpsetting_box->AddChild (pView->fpzoom_lower);
+	pView->fpsetting_box->AddChild (pView->fpdolly_upper);
+	pView->fpsetting_box->AddChild (pView->fpdolly_lower);
+	pView->fpsetting_box->AddChild (pView->fpok_button);
+	
+	pView->fpsetting_top->Realize ();
+	
+      }
+
+      break;
+    }
+  
+  default:
+    G4Exception("Unrecognised widget child of control_callback");
+  }
+  
+  return;
+}
+
+
+
+void G4OpenGLXmViewer::misc_callback (Widget w, 
+				    XtPointer clientData, 
+				    XtPointer) 
+{
+  G4OpenGLXmViewer* pView;
+  G4long choice = (G4long)clientData;
+  XtVaGetValues (XtParent(w), 
+		 XmNuserData, &pView, 
+		 NULL);
+  
+  switch (choice) {
+    
+  case 0:
+    {
+
+      if (!pView->fpmiscellany_top) {
+	
+	std::ostringstream misc_Name;
+	misc_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fpmiscellany_top = new G4OpenGLXmTopLevelShell (pView, 
+							       (char*)misc_Name.str().c_str());
+	pView->fpwobble_box = new G4OpenGLXmFramedBox ("Wobble view",
+						       True);
+	pView->fpmiscellany_top->AddChild (pView->fpwobble_box);
+	
+	XtCallbackRec* wob_cb_list = new XtCallbackRec[2];
+	wob_cb_list[0].callback = wobble_callback;
+	wob_cb_list[0].closure = pView; 
+	wob_cb_list[1].callback = NULL;
+	
+	
+	pView->fpwobble_button = new G4OpenGLXmPushButton ("Wobble",
+							   wob_cb_list);
+	
+	XtCallbackRec* wobble_slider_list = new XtCallbackRec[2];
+	wobble_slider_list[0].callback = set_wob_sens_callback;
+	wobble_slider_list[0].closure = pView; 
+	wobble_slider_list[1].callback = NULL;
+	
+	pView->fpwobble_slider = new G4OpenGLXmSliderBar ("Wobble slider",
+							  wobble_slider_list,
+							  True,
+							  0,
+							  20,
+							  50,
+							  0);
+	pView->fpwobble_box->AddChild (pView->fpwobble_button);
+	pView->fpwobble_box->AddChild (pView->fpwobble_slider);
+	
+	pView->fpreset_box = new G4OpenGLXmFramedBox ("Reset view",
+						      True);
+	pView->fpmiscellany_top->AddChild (pView->fpreset_box);
+	
+	XtCallbackRec* rst_cb_list = new XtCallbackRec[3];
+	rst_cb_list[0].callback = reset_callback;
+	rst_cb_list[0].closure = pView; 
+	rst_cb_list[1].callback = update_panels_callback;
+	rst_cb_list[1].closure = pView; 
+	rst_cb_list[2].callback = NULL;
+	
+	pView->fpreset_button = new G4OpenGLXmPushButton ("Reset",
+							  rst_cb_list);
+	
+	pView->fpreset_box->AddChild (pView->fpreset_button);
+	
+	pView->fpproj_style_box = new G4OpenGLXmFramedBox ("Projection style",
+							   True);
+	pView->fpmiscellany_top->AddChild (pView->fpproj_style_box);
+	
+	XtCallbackRec* proj_cb_list = new XtCallbackRec[2];
+	proj_cb_list[0].callback = projection_callback;
+	proj_cb_list[0].closure = pView; 
+	proj_cb_list[1].callback = NULL;
+	
+	pView->fporthogonal_button = new G4OpenGLXmRadioButton ("Orthographic",
+								proj_cb_list,
+								pView->fVP.GetFieldHalfAngle() > 0. ? False : True,
+								0);
+	
+	pView->fpperspective_button = new G4OpenGLXmRadioButton ("Perspective",
+								 proj_cb_list,
+								 pView->fVP.GetFieldHalfAngle() > 0. ? True : False,
+								 1);
+	
+	pView->fpfov_text = new G4OpenGLXmTextField ("Field of view 0.1 -> 89.5 degrees.",
+						     &(pView->fov));
+	
+	pView->fpproj_style_box->AddChild (pView->fpperspective_button);
+	pView->fpproj_style_box->AddChild (pView->fporthogonal_button);
+	pView->fpproj_style_box->AddChild (pView->fpfov_text);
+	
+	pView->fpmiscellany_top->Realize ();
+
+      }
+      
+      break;
+    }
+  
+  case 1:
+    {
+      G4Xt::getInstance () -> RequireExitSecondaryLoop (OGL_EXIT_CODE);
+      break;
+    }
+  
+  case 2:
+    {
+      if (!pView->fpprint_top) {
+	
+	std::ostringstream print_Name;
+	print_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
+	
+	pView->fpprint_top = new G4OpenGLXmTopLevelShell (pView, 
+							  (char*)print_Name.str().c_str());
+
+	pView->fpprint_box = new G4OpenGLXmFramedBox ("Create EPS file of current view",
+						       False);
+
+	pView->fpprint_top->AddChild (pView->fpprint_box);
+	
+	pView->fpprint_col_box = new G4OpenGLXmFramedBox ("Colour choice",
+							  True);
+	pView->fpprint_top->AddChild (pView->fpprint_col_box);
+
+	XtCallbackRec* prcol_cb_list = new XtCallbackRec[2];
+	prcol_cb_list[0].callback = set_print_colour_callback;
+	prcol_cb_list[0].closure = pView; 
+	prcol_cb_list[1].callback = NULL;
+	
+	pView->fpprint_col_radio1 = new G4OpenGLXmRadioButton ("Black and white",
+							       prcol_cb_list,
+							       pView->print_colour==false ? True : False,
+							       0);
+	
+	pView->fpprint_col_radio2 = new G4OpenGLXmRadioButton ("Colour",
+							       prcol_cb_list,
+							       pView->print_colour==true ? True : False,
+							       1);
+	
+	pView->fpprint_col_box->AddChild (pView->fpprint_col_radio1);
+	pView->fpprint_col_box->AddChild (pView->fpprint_col_radio2);
+
+	pView->fpprint_style_box = new G4OpenGLXmFramedBox ("File type",
+							    True);
+	pView->fpprint_top->AddChild (pView->fpprint_style_box);
+
+	XtCallbackRec* prsty_cb_list = new XtCallbackRec[2];
+	prsty_cb_list[0].callback = set_print_style_callback;
+	prsty_cb_list[0].closure = pView; 
+	prsty_cb_list[1].callback = NULL;
+	
+	pView->fpprint_style_radio1 = new G4OpenGLXmRadioButton ("Screen dump (pixmap)",
+								 prsty_cb_list,
+								 pView->vectored_ps==false ? True : False,
+								 0);
+	
+	pView->fpprint_style_radio2 = new G4OpenGLXmRadioButton ("PostScript",
+								 prsty_cb_list,
+								 pView->vectored_ps==true ? True : False,
+								 1);
+	
+	pView->fpprint_style_box->AddChild (pView->fpprint_style_radio1);
+	pView->fpprint_style_box->AddChild (pView->fpprint_style_radio2);
+	
+	pView->fpprint_text = new G4OpenGLXmTextField ("Name of .eps file to save",
+						       (pView->print_string));
+	pView->fpprint_box->AddChild (pView->fpprint_text);	
+	
+	pView->fpprint_line = new G4OpenGLXmSeparator ();
+	pView->fpprint_box->AddChild (pView->fpprint_line);
+
+	XtCallbackRec* pri_cb_list = new XtCallbackRec[2];
+	pri_cb_list[0].callback = print_callback;
+	pri_cb_list[0].closure = pView; 
+	pri_cb_list[1].callback = NULL;
+	
+	
+	pView->fpprint_button = new G4OpenGLXmPushButton ("Create EPS file",
+							  pri_cb_list);
+	
+	pView->fpprint_box->AddChild (pView->fpprint_button);
+	pView->fpprint_top->Realize ();
+
+      }
+      
+      ///ajw
+      break;
+    }
+  
+  default:
+    G4Exception("Unrecognised widget child of misc_callback.");
+  }
+  
+  return;
+  
+}
+
+void G4OpenGLXmViewer::set_wob_sens_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+  
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+  
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4Exception("Bad value returned for dp in set_rot_sens_callback");
+  }
+  
+  pView->wob_sens = (G4float)(cbs->value) / ten_to_the_dp;
+}  
+
+void G4OpenGLXmViewer::update_panels_callback (Widget, 
+					     XtPointer clientData, 
+					     XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  
+  if (pView->fppanning_slider) {
+    pView->fppanning_slider->SetMaxValue (pView->pan_sens_limit);
+  }
+  if (pView->fprotation_slider) {
+    pView->fprotation_slider->SetMaxValue (pView->rot_sens_limit);
+  }
+  
+  if (pView->fpzoom_slider) {
+    pView->fpzoom_slider->SetMaxValue (pView->zoom_high);
+    pView->fpzoom_slider->SetMinValue (pView->zoom_low);
+    pView->fpzoom_slider->SetInitialValue (pView->fVP.GetZoomFactor());
+  }
+  
+  if (pView->fpdolly_slider) {
+    pView->fpdolly_slider->SetMaxValue (pView->dolly_high);
+    pView->fpdolly_slider->SetMinValue (pView->dolly_low);
+  }
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmPanningCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmPanningCallbacks.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmPanningCallbacks.cc	(revision 562)
@@ -0,0 +1,246 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.8 2006/06/29 21:19:50 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmPanningCallbacks : 
+//                       Several callback functions used by
+//                       elements of the control panel to`pan' 
+//                       the view (i.e. move the viewpoint and 
+//                       camera positions by equal amounts).
+//                       Zoom callback is also here.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewer.hh"
+#include "G4Scene.hh"
+
+void G4OpenGLXmViewer::zoom_callback (Widget w, 
+				    XtPointer clientData, 
+				    XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4cout << "dp is " << dp << G4endl;
+    return;
+  }
+
+
+  G4double zoomBy = (G4double)(cbs->value) / ten_to_the_dp;
+  if (zoomBy <= 0.01) {
+    zoomBy = 0.01;
+  }
+
+  pView->fVP.SetZoomFactor (zoomBy);
+  pView->SetView ();
+  pView->ClearView ();
+  pView -> DrawView ();
+}  
+
+void G4OpenGLXmViewer::dolly_callback (Widget w, 
+				     XtPointer clientData, 
+				     XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4cout << "dp is " << dp << G4endl;
+    return;
+  }
+
+  G4double dolly = (G4double)(cbs->value) / ten_to_the_dp;
+
+  pView->fVP.SetDolly (dolly);
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+
+}  
+
+void G4OpenGLXmViewer::pan_left_right_callback (Widget w, 
+					      XtPointer clientData, 
+					      XtPointer callData) 
+{
+  XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  pView->pan_right = get_boolean_userData (w);
+
+  if (cbs->reason == XmCR_ARM) {
+    left_right_pan_callback (pView,NULL);
+  } else if (cbs->reason == XmCR_DISARM) {
+    XtRemoveTimeOut (pView->pan_timer);
+  }
+}
+
+void G4OpenGLXmViewer::left_right_pan_callback (XtPointer clientData,
+					      XtIntervalId* timer_id) 
+
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  G4double delta;
+  
+  if (pView->pan_right) {
+    delta = (G4double)pView->pan_sens;
+  } else {
+    delta = -((G4double)pView->pan_sens);
+  }
+  
+  G4Point3D stp
+    = pView -> GetSceneHandler()->GetScene()->GetStandardTargetPoint();
+
+  G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
+  
+  const G4Vector3D& upVector = pView->fVP.GetUpVector ();
+  const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
+  
+  G4Vector3D unitRight = (upVector.cross (vpVector)).unit();
+  G4Vector3D unitUp    = (vpVector.cross (unitRight)).unit();
+  
+  tp += delta * unitRight;
+  pView->fVP.SetCurrentTargetPoint (tp - stp);
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+
+  pView->pan_timer = XtAppAddTimeOut 
+    (pView->app,
+     timer_id == NULL ? 500 : 1,
+     left_right_pan_callback,
+     pView);
+}  
+
+void G4OpenGLXmViewer::pan_up_down_callback (Widget w, 
+					   XtPointer clientData, 
+					   XtPointer callData) 
+{
+  XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  pView->pan_up = get_boolean_userData (w);
+
+  if (cbs->reason == XmCR_ARM) {
+    up_down_pan_callback (pView,NULL);
+  } else if (cbs->reason == XmCR_DISARM) {
+    XtRemoveTimeOut (pView->pan_timer);
+  }
+}
+
+void G4OpenGLXmViewer::up_down_pan_callback (XtPointer clientData,
+					   XtIntervalId* timer_id) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  G4double delta;
+  
+  if (pView->pan_up) {
+    delta = (G4double)pView->pan_sens;
+  } else {
+    delta = -((G4double)pView->pan_sens);
+  }
+  
+  G4Point3D stp
+    = pView -> GetSceneHandler()->GetScene()->GetStandardTargetPoint();
+  G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
+  const G4Vector3D& upVector = pView->fVP.GetUpVector ();
+  const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
+  
+  G4Vector3D unitRight = (upVector.cross (vpVector)).unit();
+  G4Vector3D unitUp    = (vpVector.cross (unitRight)).unit();
+  tp += delta * unitUp;
+  pView->fVP.SetCurrentTargetPoint (tp - stp);
+  
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+
+  pView->pan_timer = XtAppAddTimeOut 
+    (pView->app,
+     timer_id == NULL ? 500 : 1,
+     up_down_pan_callback,
+     pView);
+}  
+
+void G4OpenGLXmViewer::set_pan_sens_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4cout << "dp is " << dp << G4endl;
+    return;
+  }
+  
+  pView->pan_sens = (G4double)((cbs->value) / ten_to_the_dp);
+}  
+
+#endif
+
+
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmPushButton.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmPushButton.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmPushButton.cc	(revision 562)
@@ -0,0 +1,108 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmPushButton.cc,v 1.6 2006/06/29 21:19:52 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Push button class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmPushButton.hh"
+#include <X11/Intrinsic.h>
+#include "globals.hh"
+
+G4OpenGLXmPushButton::G4OpenGLXmPushButton (const char* n,
+					    XtCallbackRec* c) 
+{
+  name = n;
+  callback = c;
+}
+
+G4OpenGLXmPushButton::~G4OpenGLXmPushButton ()
+{}
+
+void G4OpenGLXmPushButton::SetName (const char* n) 
+{
+  name = n;
+  XmString button_string = XmStringCreateLocalized ((char*)name);
+  XtVaSetValues (button,
+		 XmNlabelString, button_string,
+		 NULL);
+  XmStringFree (button_string);
+}
+
+const char* G4OpenGLXmPushButton::GetName () 
+{
+  return name;
+}
+
+void G4OpenGLXmPushButton::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+  parent = container->GetPointerToWidget ();
+
+  XmString button_str = XmStringCreateLocalized ((char*)name);
+  button = XtVaCreateManagedWidget 
+    (name,
+     xmPushButtonWidgetClass,
+     *parent,
+     XmNlabelString, button_str,
+     XmNalignment, XmALIGNMENT_CENTER,
+     XmNuserData, pView,
+
+     XtNvisual, visual, 
+     XtNdepth, depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     
+     NULL);
+  
+  XtAddCallbacks (button,
+		  XmNarmCallback,
+		  callback);
+  
+  XmStringFree (button_str);
+}
+
+Widget* G4OpenGLXmPushButton::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmPushButton::GetPointerToWidget () 
+{
+  return &button;
+}
+
+#endif
+
+
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmRadioButton.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmRadioButton.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmRadioButton.cc	(revision 562)
@@ -0,0 +1,109 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmRadioButton.cc,v 1.6 2006/06/29 21:19:54 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmRadioButton.hh"
+#include <X11/Intrinsic.h>
+#include "globals.hh"
+
+G4OpenGLXmRadioButton::G4OpenGLXmRadioButton (const char* n,
+					      XtCallbackRec* c,
+					      G4bool d,
+					      G4int num) 
+{
+  name = n;
+  callback = c;
+  default_button = d;
+  number = num;
+}
+
+G4OpenGLXmRadioButton::~G4OpenGLXmRadioButton ()
+{}
+
+void G4OpenGLXmRadioButton::SetName (const char* n) 
+{
+  name = n;
+  XmString button_string = XmStringCreateLocalized ((char*)name);
+  XtVaSetValues (button,
+		 XmNlabelString, button_string,
+		 NULL);
+  XmStringFree (button_string);
+}
+
+const char* G4OpenGLXmRadioButton::GetName () 
+{
+  return name;
+}
+
+void G4OpenGLXmRadioButton::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+  parent = container->GetPointerToWidget ();
+  XmString button_string = XmStringCreateLocalized ((char*)name);
+  button = XtVaCreateManagedWidget (name,
+				    xmToggleButtonWidgetClass,
+				    *parent,
+				    
+				    XmNlabelString, button_string,
+				    XmNset, default_button,
+				    XmNuserData, number,
+				    
+				    XtNvisual, visual,
+				    XtNdepth, depth,
+				    XtNcolormap, cmap,
+				    XtNborderColor, borcol,
+				    XtNbackground, bgnd,
+				    
+				    NULL);
+  
+  XtAddCallbacks (button,
+		  XmNarmCallback,
+		  callback);
+
+  XmStringFree (button_string);
+}
+
+Widget* G4OpenGLXmRadioButton::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmRadioButton::GetPointerToWidget () 
+{
+  return &button;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmRotationCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmRotationCallbacks.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmRotationCallbacks.cc	(revision 562)
@@ -0,0 +1,305 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.14 2006/06/29 21:19:56 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmRotationCallbacks : 
+//                       Several callback functions used by
+//                       elements of the control panel to
+//                       rotate the view.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewer.hh"
+
+#include "G4Scene.hh"
+#include "G4UImanager.hh"
+#include "G4ios.hh"
+
+void G4OpenGLXmViewer::theta_rotation_callback (Widget w, 
+					      XtPointer clientData, 
+					      XtPointer callData) 
+{
+  XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  pView->rotate_right = get_boolean_userData (w);
+
+  if (cbs->reason == XmCR_ARM) {
+    rotate_in_theta (pView, NULL);
+  } else if (cbs->reason == XmCR_DISARM) {
+    XtRemoveTimeOut (pView->rotation_timer);
+  }
+}
+
+void G4OpenGLXmViewer::rotate_in_theta (XtPointer clientData,
+				      XtIntervalId* timer_id) 
+{
+  //theta spin stuff here
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  G4double delta_theta;
+
+  if (pView->fVP.GetLightsMoveWithCamera()) {
+    if (pView->rotate_right) {
+      delta_theta = -((G4double)pView->rot_sens);
+    } else {
+      delta_theta = (G4double)pView->rot_sens;
+    }
+  } else {
+    if (pView->rotate_right) {
+      delta_theta = (G4double)pView->rot_sens;
+    } else {
+      delta_theta = -((G4double)pView->rot_sens);
+    }
+  }    
+  delta_theta *= deg;
+  // Rotates by fixed azimuthal angle delta_theta.
+
+  const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
+  const G4Vector3D& up = pView->fVP.GetUpVector ().unit ();
+  const G4Vector3D& zprime = up;
+  G4double cosalpha = up.dot (vp);
+  G4double sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
+  G4Vector3D yprime = (zprime.cross (vp)).unit ();
+  G4Vector3D xprime = yprime.cross (zprime);
+  // Projection of vp on plane perpendicular to up...
+  G4Vector3D a1 = sinalpha * xprime;
+  // Required new projection...
+  G4Vector3D a2 =
+    sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
+  // Required Increment vector...
+  G4Vector3D delta = a2 - a1;
+  // So new viewpoint is...
+  G4Vector3D viewPoint = vp + delta;
+
+  pView->fVP.SetViewAndLights (viewPoint);  
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+
+  pView->rotation_timer = XtAppAddTimeOut 
+    (pView->app,
+     timer_id == NULL ? 500 : 1,
+     rotate_in_theta,
+     pView);
+}  
+
+void G4OpenGLXmViewer::phi_rotation_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer callData) 
+{
+  XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  pView->rotate_up = get_boolean_userData (w);
+
+  if (cbs->reason == XmCR_ARM) {
+    rotate_in_phi (pView, NULL);
+  } else if (cbs->reason == XmCR_DISARM) {
+    XtRemoveTimeOut (pView->rotation_timer);
+  }
+}
+
+void G4OpenGLXmViewer::rotate_in_phi (XtPointer clientData,
+				    XtIntervalId* timer_id)
+{
+  //phi spin stuff here
+  G4double delta_alpha;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+
+  if (pView->fVP.GetLightsMoveWithCamera()) {
+    if (pView -> rotate_up) {
+      delta_alpha = -((G4double)pView->rot_sens);
+    } else {
+      delta_alpha = (G4double)pView->rot_sens;
+    }
+  } else {
+    if (pView -> rotate_up) {
+      delta_alpha = (G4double)pView->rot_sens;
+    } else {
+      delta_alpha = -((G4double)pView->rot_sens);
+    }
+  }    
+
+  delta_alpha *= deg;
+
+  const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
+  const G4Vector3D& up = pView->fVP.GetUpVector ().unit ();
+
+  const G4Vector3D& xprime = vp;
+  G4Vector3D yprime = (up.cross(xprime)).unit();
+  G4Vector3D zprime = (xprime.cross(yprime)).unit();
+
+  G4Vector3D new_vp = std::cos(delta_alpha) * xprime + std::sin(delta_alpha) * zprime;
+
+  pView->fVP.SetViewAndLights (new_vp.unit());
+
+  if (pView->fVP.GetLightsMoveWithCamera()) {
+    G4Vector3D new_up = (new_vp.cross(yprime)).unit();
+    pView->fVP.SetUpVector(new_up);
+  }
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+  
+  pView->rotation_timer = XtAppAddTimeOut 
+    (pView->app,
+     timer_id == NULL ? 500 : 1,
+     rotate_in_phi,
+     pView);
+}
+
+void G4OpenGLXmViewer::set_rot_sens_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer callData) 
+{
+  XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  short dp = -1;
+  G4float ten_to_the_dp = 10.;
+
+  XtVaGetValues (w, 
+		 XmNdecimalPoints, &dp,
+		 NULL);
+
+  if (dp == 0) {
+    ten_to_the_dp = 1.;
+  } else if ( dp > 0) {
+    for (G4int i = 1; i < (G4int)dp; i++) {
+      ten_to_the_dp *= 10.;
+    }
+  } else {
+    G4Exception("Bad value returned for dp in set_rot_sens_callback");
+  }
+
+  pView->rot_sens = (G4float)(cbs->value) / ten_to_the_dp;
+}  
+
+void G4OpenGLXmViewer::set_rot_subject_callback (Widget w, 
+					       XtPointer clientData, 
+					       XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+  
+  G4int choice = get_int_userData (w);
+  
+  switch (choice) {
+  case 0: 
+    {
+      pView->fVP.SetLightsMoveWithCamera (true);
+      break;
+    }
+  case 1:
+    {
+      pView->fVP.SetLightsMoveWithCamera (false);
+      break;
+    }
+  default:
+    {
+      G4Exception("Unrecognised choice made in set_rot_subject_callback"); 
+    }
+  }
+}  
+
+void G4OpenGLXmViewer::wobble_callback (Widget w, 
+				      XtPointer, 
+				      XtPointer) 
+{
+  G4OpenGLXmViewer* pView;
+  
+  XtVaGetValues (w,
+		 XmNuserData, &pView,
+		 NULL);
+  
+  pView->original_vp = pView->fVP.GetViewpointDirection();
+  pView->wobble_timer = XtAppAddTimeOut
+    (pView->app,
+     (long unsigned int) (1000. * (1. / pView->wob_sens)),
+     wobble_timer_callback,
+     pView);
+}  
+
+void G4OpenGLXmViewer::wobble_timer_callback (XtPointer clientData,
+					    XtIntervalId*) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+  const G4Vector3D& up = pView->fVP.GetUpVector();
+  G4Vector3D third_axis = up.cross(pView->original_vp);
+  G4double pi_div_by_ten = pi / 10.0;
+  G4Vector3D d_up = 0.1 * (std::sin ((G4double)pView->frameNo * pi_div_by_ten * 2.)) * up;
+  G4Vector3D d_third_axis = 0.1 * (std::sin ((G4double)pView->frameNo * (pi_div_by_ten))) * third_axis;
+
+  pView->fVP.SetViewAndLights (pView->original_vp + d_up + d_third_axis);
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+  
+  if (pView->frameNo++ == 20) {
+    if (pView->wobble_timer) {
+      XtRemoveTimeOut (pView->wobble_timer);
+      pView->frameNo = 0;
+      pView->fVP.SetViewAndLights (pView->original_vp);
+      pView->SetView ();
+      pView->ClearView ();
+      pView->DrawView ();
+   }
+  } else {
+    pView->wobble_timer = XtAppAddTimeOut
+      (pView->app,
+       (long unsigned int) (1000. * (1. / pView->wob_sens)),
+       wobble_timer_callback,
+       pView);
+  }
+}
+
+void G4OpenGLXmViewer::reset_callback (Widget w, 
+				     XtPointer, 
+				     XtPointer) 
+{
+  
+  G4OpenGLXmViewer* pView;
+  
+  XtVaGetValues (w,
+		 XmNuserData, &pView,
+		 NULL);
+  
+  pView->fVP.SetCurrentTargetPoint(G4Point3D());
+  pView->fVP.SetZoomFactor(1.0);
+  pView->fVP.SetDolly(0.0);
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+  pView->zoom_low = 0.1;
+  pView->zoom_high = 10.0;
+  
+}
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmSeparator.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmSeparator.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmSeparator.cc	(revision 562)
@@ -0,0 +1,82 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmSeparator.cc,v 1.5 2006/06/29 21:19:58 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Separator class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmSeparator.hh"
+#include <X11/Intrinsic.h>
+#include "globals.hh"
+
+G4OpenGLXmSeparator::G4OpenGLXmSeparator (unsigned char l) 
+{
+  line_type = l;
+}
+
+G4OpenGLXmSeparator::~G4OpenGLXmSeparator ()
+{}
+
+void G4OpenGLXmSeparator::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+
+  parent = container->GetPointerToWidget ();
+
+  line = XtVaCreateManagedWidget ("sep",
+				  xmSeparatorWidgetClass,
+				  *parent,
+				  XmNseparatorType, line_type,
+				  XmNmargin, 1,
+				  XmNorientation, XmHORIZONTAL,
+				  
+				  XtNvisual, visual, 
+				  XtNdepth, depth, 
+				  XtNcolormap, cmap, 
+				  XtNborderColor, borcol,
+				  XtNbackground, bgnd,
+				  
+				  NULL);
+}
+
+Widget* G4OpenGLXmSeparator::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmSeparator::GetPointerToWidget () 
+{
+  return &line;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmSliderBar.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmSliderBar.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmSliderBar.cc	(revision 562)
@@ -0,0 +1,227 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmSliderBar.hh"
+#include <X11/Intrinsic.h>
+#include <Xm/Scale.h>
+#include "globals.hh"
+
+G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (const char* n,
+					  XtCallbackRec* c,
+					  G4bool s,
+					  short dp,
+					  G4double v,
+					  G4double max,
+					  G4double min,
+					  unsigned char o,
+					  unsigned char d) 
+{
+  name = n;
+  callback = c;
+  show = s;
+  decimal_places = dp;
+  initial_value = int(v * std::pow(10.0, (G4double)dp));
+  max_value = int(max * std::pow(10.0, (G4double)dp));
+  min_value = int(min * std::pow(10.0, (G4double)dp));
+  orientation = o;
+  direction = d;
+}
+
+G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()
+{}
+
+const char* G4OpenGLXmSliderBar::GetName () 
+{
+  return name;
+}
+
+G4bool G4OpenGLXmSliderBar::GetShow () 
+{
+  return show;
+}
+
+short G4OpenGLXmSliderBar::GetDecimalPlaces () 
+{
+  return decimal_places;
+}
+
+G4double G4OpenGLXmSliderBar::GetInitialValue () 
+{
+  return (G4double)initial_value / std::pow(10.0, (G4double)GetDecimalPlaces());
+}
+
+G4double G4OpenGLXmSliderBar::GetMaxValue () 
+{
+  return (G4double)max_value / std::pow(10.0, (G4double)GetDecimalPlaces());
+}
+
+G4double G4OpenGLXmSliderBar::GetMinValue () 
+{
+  return (G4double)min_value / std::pow(10.0, (G4double)GetDecimalPlaces());
+}
+
+unsigned char G4OpenGLXmSliderBar::GetOrientation () 
+{
+  return orientation;
+}
+
+unsigned char G4OpenGLXmSliderBar::GetDirection () 
+{
+  return direction;
+}
+
+void G4OpenGLXmSliderBar::SetName (const char* n) 
+{
+  name = n;
+  XmString sliderbar_string = XmStringCreateLocalized ((char*)name);
+  XtVaSetValues (sliderbar,
+		 XmNlabelString, sliderbar_string,
+		 NULL);
+ XmStringFree (sliderbar_string);
+}
+
+void G4OpenGLXmSliderBar::SetShow (G4bool s) 
+{
+  show = s;
+  XtVaSetValues (sliderbar,
+		 XmNshowValue, show,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetDecimalPlaces (short dp) 
+{
+  decimal_places = dp;
+  XtVaSetValues (sliderbar,
+		 XmNdecimalPoints, decimal_places,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetInitialValue (G4double v) 
+{
+  initial_value = int(v * std::pow(10.0, (G4double)GetDecimalPlaces()));
+  XtVaSetValues (sliderbar,
+		 XmNvalue, initial_value,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetMaxValue (G4double v) 
+{
+  max_value = int(v * std::pow(10.0, (G4double)GetDecimalPlaces()));
+  XtVaSetValues (sliderbar,
+		 XmNmaximum, max_value,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetMinValue (G4double v) 
+{
+  min_value = int(v * std::pow(10.0, (G4double)GetDecimalPlaces()));
+  XtVaSetValues (sliderbar,
+		 XmNminimum, min_value,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetOrientation (unsigned char o) 
+{
+  orientation = o;
+  XtVaSetValues (sliderbar,
+		 XmNorientation, orientation,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::SetDirection (unsigned char d) 
+{
+  direction = d;
+  XtVaSetValues (sliderbar,
+		 XmNprocessingDirection, direction,
+		 NULL);
+  
+}
+
+void G4OpenGLXmSliderBar::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+
+  parent = container->GetPointerToWidget ();
+  XmString name_string = XmStringCreateLocalized ((char*)name);
+  sliderbar = XtVaCreateManagedWidget (name,
+				       xmScaleWidgetClass,
+				       *parent,
+				       
+				       XmNtitleString, name_string,
+				       XmNmaximum, max_value,
+				       XmNminimum, min_value,
+				       XmNvalue, initial_value,
+				       XmNshowValue, show,
+				       XmNdecimalPoints, decimal_places,
+				       XmNorientation, orientation,
+				       XmNprocessingDirection, direction,
+  
+				       XtNvisual, visual,
+				       XtNdepth, depth,
+				       XtNcolormap, cmap,
+				       XtNborderColor, borcol,
+				       XtNbackground, bgnd,
+
+				       NULL);
+				       
+  XtAddCallbacks (sliderbar,
+		  XmNvalueChangedCallback,
+		  callback);
+
+  XtAddCallbacks (sliderbar,
+		  XmNdragCallback,
+		  callback);
+  XmStringFree (name_string);
+}
+
+Widget* G4OpenGLXmSliderBar::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmSliderBar::GetPointerToWidget () 
+{
+  return &sliderbar;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmStyleCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmStyleCallbacks.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmStyleCallbacks.cc	(revision 562)
@@ -0,0 +1,314 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.14 2006/06/29 21:20:02 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// Andrew Walkden  16th April 1997
+// G4OpenGLXmStyleCallbacks : 
+//                       Several callback functions used by
+//                       elements of the control panel to
+//                       determine how to visualize the view.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewer.hh"
+
+void G4OpenGLXmViewer::drawing_style_callback (Widget w, 
+					     XtPointer clientData, 
+					     XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+  G4ViewParameters::DrawingStyle style;
+
+  switch (choice) {
+    
+  case 0:
+    style = G4ViewParameters::wireframe;
+    break;
+
+  case 1:
+    style = G4ViewParameters::hlr;
+    break;
+
+  case 2:
+    style = G4ViewParameters::hsr;
+    break;
+
+  case 3:
+    style = G4ViewParameters::hlhsr;
+    break;
+
+  default:
+    style = G4ViewParameters::wireframe;
+    G4Exception("Unrecognised case in drawing_style_callback.");
+  }
+
+  pView->fVP.SetDrawingStyle (style);
+  
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::rep_style_callback (Widget w, 
+					 XtPointer clientData, 
+					 XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+  G4ViewParameters::RepStyle style;
+
+  switch (choice) {
+    
+  case 0:
+    style = G4ViewParameters::polyhedron;
+    break;
+
+  case 1:
+    style = G4ViewParameters::nurbs;
+    break;
+
+  default:
+    style = G4ViewParameters::polyhedron;
+    G4Exception("Unrecognised case in rep_style_callback.");
+  }
+
+  pView->fVP.SetRepStyle (style);
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::background_color_callback (Widget w, 
+						XtPointer clientData, 
+						XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+
+  //I need to revisit the kernel if the background colour changes and
+  //hidden line removal is enabled, because hlr drawing utilises the
+  //background colour in its drawing...
+  // (Note added by JA 13/9/2005) Background now handled in view
+  // parameters.  A kernel visit is triggered on change of background.
+  switch (choice) {
+    
+  case 0:
+    ((G4ViewParameters&)pView->GetViewParameters()).
+      SetBackgroundColour(G4Colour(1.,1.,1.));  // White
+    break;
+
+  case 1:
+    ((G4ViewParameters&)pView->GetViewParameters()).
+      SetBackgroundColour(G4Colour(0.,0.,0.));  // Black
+    break;
+
+  default:
+    G4Exception("Unrecognised case in background_color_callback.");
+  }
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::transparency_callback (Widget w, 
+					    XtPointer clientData, 
+					    XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+  switch (choice) {
+    
+  case 0:
+    pView->transparency_enabled = false;
+    break;
+
+  case 1:
+    pView->transparency_enabled = true;
+    break;
+
+  default:
+    G4Exception("Unrecognised case in transparency_callback.");
+  }
+
+  pView->SetNeedKernelVisit (true);
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::antialias_callback (Widget w, 
+					 XtPointer clientData, 
+					 XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+  switch (choice) {
+    
+  case 0:
+    pView->antialiasing_enabled = false;
+    glDisable (GL_LINE_SMOOTH);
+    glDisable (GL_POLYGON_SMOOTH);
+    break;
+
+  case 1:
+    pView->antialiasing_enabled = true;
+    glEnable (GL_LINE_SMOOTH);
+    glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
+    glEnable (GL_POLYGON_SMOOTH);
+    glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+    break;
+
+  default:
+    G4Exception("Unrecognised case in antialiasing_callback.");
+  }
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::haloing_callback (Widget w, 
+				       XtPointer clientData, 
+				       XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+  switch (choice) {
+    
+  case 0:
+    pView->haloing_enabled = false;
+    break;
+
+  case 1:
+    pView->haloing_enabled = true;
+    break;
+
+  default:
+    G4Exception("Unrecognised case in haloing_callback.");
+  }
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::aux_edge_callback (Widget w, 
+				       XtPointer clientData, 
+				       XtPointer) 
+{
+  G4long choice = (G4long)clientData;
+  G4OpenGLXmViewer* pView;
+  XtVaGetValues (XtParent(w),
+		 XmNuserData, &pView,
+		 NULL);
+
+  switch (choice) {
+    
+  case 0:
+    pView->fVP.SetAuxEdgeVisible(false);
+    break;
+
+  case 1:
+    pView->fVP.SetAuxEdgeVisible(true);
+    break;
+
+  default:
+    G4Exception("Unrecognised case in aux_edge_callback.");
+  }
+
+  pView->SetNeedKernelVisit (true);
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::projection_callback (Widget w, 
+					  XtPointer clientData, 
+					  XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+
+  G4int choice = get_int_userData (w);
+
+  switch (choice) {
+  case 0:
+    {
+      pView->fVP.SetFieldHalfAngle (0.);
+      break;
+    }
+
+  case 1:
+    {
+      if (pView->fov > 89.5 || pView->fov <= 0.0) {
+	G4cout << "Field half angle should be 0 < angle <= 89.5 degrees.";
+	G4cout << G4endl;
+      }
+      else {
+	pView->fVP.SetFieldHalfAngle (pView->fov * deg);
+      }
+      break;
+    }
+  default:
+    {
+      G4Exception("Unrecognised choice made in projection_callback");
+    }
+  }
+
+  pView->SetView ();
+  pView->ClearView ();
+  pView->DrawView ();
+}  
+
+#endif
+
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmTextField.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmTextField.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmTextField.cc	(revision 562)
@@ -0,0 +1,178 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmTextField.cc,v 1.7 2006/06/29 21:20:04 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Text field class. Inherits from G4OpenGLXmVWidgetComponent
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+#include "G4OpenGLXmTextField.hh"
+#include <X11/Intrinsic.h>
+#include "globals.hh"
+
+G4OpenGLXmTextField::G4OpenGLXmTextField (const char* n,
+					  G4double* val)
+{
+  name = n;
+  initial = new char[50];
+  sprintf (initial, "%6.2f", *val);
+  value = (void*)val;
+  text=false;
+}
+
+G4OpenGLXmTextField::G4OpenGLXmTextField (const char* n,
+					  const char* val)
+{
+  name = n;
+  initial = new char[50];
+  sprintf (initial, "%s", val);
+  value = (void*)val;
+  text=true;
+  //  strcpy (initial, val);
+}
+
+G4OpenGLXmTextField::~G4OpenGLXmTextField ()
+{
+  delete[] initial;
+}
+
+void G4OpenGLXmTextField::SetName (const char* n) 
+{
+  name = n;
+  XmString text_string = XmStringCreateLocalized ((char*)name);
+  XtVaSetValues (text_label,
+		 XmNlabelString, text_string,
+		 NULL);
+  XmStringFree (text_string);
+}
+
+const char* G4OpenGLXmTextField::GetName () 
+{
+  return name;
+}
+
+void G4OpenGLXmTextField::SetValue (G4double val)
+{
+  sprintf (initial, "%6.2f", val);
+  
+  XtVaSetValues (text_field,
+		 XmNvalue, (String)initial,
+		 NULL);
+  
+}
+
+void G4OpenGLXmTextField::SetValue (const char* val)
+{
+  sprintf (initial, "%s", val);
+  //  strcpy (initial, val);
+
+  XtVaSetValues (text_field,
+		 XmNvalue, (String)initial,
+		 NULL);
+  
+}
+
+const char* G4OpenGLXmTextField::GetValue ()
+{
+  return initial;
+}
+
+void G4OpenGLXmTextField::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
+{
+
+  pView = container->GetView ();
+  ProcesspView ();
+  parent = container->GetPointerToWidget ();
+
+  char local_w_text[50];
+  strcpy (local_w_text, name);
+
+  char label_name[50];
+  strcpy (label_name, name);
+  strcat (label_name, "_label");
+  
+  char text_field_name[50];
+  strcpy (text_field_name, name);
+  strcat (text_field_name, "_text_field");
+  
+  XmString local_text = XmStringCreateLocalized (local_w_text);
+  text_label = XtVaCreateManagedWidget (label_name, 
+					xmLabelWidgetClass,
+					*parent,
+
+					XmNlabelString, local_text,
+					
+					XtNvisual, visual, 
+					XtNdepth, depth, 
+					XtNcolormap, cmap, 
+					XtNborderColor, borcol,
+					XtNbackground, bgnd,
+					
+					NULL);
+  XmStringFree (local_text);
+
+  text_field = XtVaCreateManagedWidget (text_field_name,
+					xmTextFieldWidgetClass,
+					*parent,
+
+					XmNvalue, (String)initial, 
+					
+					XtNvisual, visual, 
+					XtNdepth, depth, 
+					XtNcolormap, cmap, 
+					XtNborderColor, borcol,
+					XtNbackground, bgnd,
+					
+					NULL);
+
+  if (!text) {
+    XtAddCallback (text_field, 
+		   XmNvalueChangedCallback,
+		   G4OpenGLXmViewer::get_double_value_callback,
+		   value);
+  } else {
+    XtAddCallback (text_field, 
+		   XmNvalueChangedCallback,
+		   G4OpenGLXmViewer::get_text_callback,
+		   value);
+  }
+}
+
+Widget* G4OpenGLXmTextField::GetPointerToParent ()
+{
+  return parent;
+}
+
+Widget* G4OpenGLXmTextField::GetPointerToWidget () 
+{
+  return &text_field;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmTopLevelShell.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmTopLevelShell.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmTopLevelShell.cc	(revision 562)
@@ -0,0 +1,123 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmTopLevelShell.cc,v 1.5 2006/06/29 21:20:06 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Top level shell class
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmTopLevelShell.hh"
+#include "G4OpenGLXmVWidgetContainer.hh"
+
+G4OpenGLXmTopLevelShell::G4OpenGLXmTopLevelShell (G4OpenGLXmViewer* v,
+						  char* n) 
+{
+  pView = v;
+  ProcesspView ();
+  name = n;
+  toplevel = XtVaCreatePopupShell 
+    (name,
+     topLevelShellWidgetClass,
+     top,
+     
+     XtNiconName, name,
+     XtNtitle, name,
+     XmNdeleteResponse, XmDO_NOTHING,
+     XmNisHomogeneous, False,
+     
+     XtNvisual, visual, 
+     XtNdepth, depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+
+  frame = XtVaCreateManagedWidget (name,
+				   xmFrameWidgetClass,
+				   toplevel,
+				   
+				   XtNvisual, visual,
+				   XtNdepth, depth,
+				   XtNcolormap, cmap,
+				   XtNborderColor, borcol,
+				   XtNbackground, bgnd,
+				   
+				   NULL);
+  
+  
+  
+  top_box =  XtVaCreateManagedWidget (name,
+				      xmRowColumnWidgetClass,
+				      frame,
+				      
+				      XmNadjustMargin, True,
+				      XmNisHomogeneous, False,
+				      
+				      XtNvisual, visual,
+				      XtNdepth, depth,
+				      XtNcolormap, cmap,
+				      XtNborderColor, borcol,
+				      XtNbackground, bgnd,
+				      
+				      NULL);  
+
+}
+
+G4OpenGLXmTopLevelShell::~G4OpenGLXmTopLevelShell ()
+{
+  XtDestroyWidget (toplevel);
+}
+
+void G4OpenGLXmTopLevelShell::AddChild (G4OpenGLXmVWidgetContainer* container)
+{
+  container->AddYourselfTo (this);
+}
+
+void G4OpenGLXmTopLevelShell::Realize () 
+{
+  Cardinal num_children;
+  XtVaGetValues (toplevel,
+		 XmNnumChildren, &num_children,
+		 NULL);
+//  G4cout << name << " now parents " << num_children << " children." << G4endl;
+  XtManageChild (toplevel);
+  XtRealizeWidget (toplevel);
+  XtPopup (toplevel, XtGrabNonexclusive);
+}
+
+Widget* G4OpenGLXmTopLevelShell::GetPointerToWidget ()
+{
+  return &top_box;
+}
+
+char* G4OpenGLXmTopLevelShell::GetName ()
+{
+  return name;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetComponent.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetComponent.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetComponent.cc	(revision 562)
@@ -0,0 +1,42 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Base class for all Motif component widgets
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetComponent.hh"
+
+G4OpenGLXmVWidgetComponent::G4OpenGLXmVWidgetComponent ()
+{}
+
+G4OpenGLXmVWidgetComponent::~G4OpenGLXmVWidgetComponent ()
+{}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetContainer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetContainer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetContainer.cc	(revision 562)
@@ -0,0 +1,42 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Base class for all Motif container widgets
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetContainer.hh"
+
+G4OpenGLXmVWidgetContainer::G4OpenGLXmVWidgetContainer ()
+{}
+
+G4OpenGLXmVWidgetContainer::~G4OpenGLXmVWidgetContainer ()
+{}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetObject.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetObject.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetObject.cc	(revision 562)
@@ -0,0 +1,57 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetObject.cc,v 1.5 2006/06/29 21:20:12 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Virtual base class for all Motif widgets.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetObject.hh"
+
+G4OpenGLXmVWidgetObject::G4OpenGLXmVWidgetObject ()
+{}
+
+G4OpenGLXmVWidgetObject::~G4OpenGLXmVWidgetObject ()
+{}
+
+G4OpenGLXmViewer* G4OpenGLXmVWidgetObject::GetView ()
+{
+  return pView;
+}
+
+void G4OpenGLXmVWidgetObject::ProcesspView () 
+{
+  cmap = pView->cmap;
+  depth = pView->vi->depth;
+  visual = pView->vi->visual;
+  borcol = pView->borcol;
+  bgnd = pView->bgnd;
+  top = pView->toplevel;
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetShell.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetShell.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmVWidgetShell.cc	(revision 562)
@@ -0,0 +1,42 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+//Base class for all Motif shell widgets
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmVWidgetShell.hh"
+
+G4OpenGLXmVWidgetShell::G4OpenGLXmVWidgetShell ()
+{}
+
+G4OpenGLXmVWidgetShell::~G4OpenGLXmVWidgetShell ()
+{}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmViewer.cc	(revision 562)
@@ -0,0 +1,666 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmViewer.cc,v 1.23 2006/06/29 21:20:16 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// Andrew Walkden  10th February 1997
+// G4OpenGLXmViewer : Class derived from G4OpenGLXViewer, to provide
+//                  (Motif) widget OpenGL functionality for GEANT4.
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "globals.hh"
+
+#include "G4OpenGLXmViewer.hh"
+
+#include "G4VisExtent.hh"
+#include "G4LogicalVolume.hh"
+#include "G4VSolid.hh"
+#include "G4Point3D.hh"
+#include "G4Normal3D.hh"
+
+#include "G4OpenGLXmSliderBar.hh"
+
+#include "G4Xt.hh"
+#include <X11/Shell.h>
+
+#include <sstream>
+
+void G4OpenGLXmViewer::ShowView () {
+
+  G4Xt::getInstance () -> SecondaryLoop ();
+
+}
+
+void G4OpenGLXmViewer::GetXmConnection () {
+  
+  G4Xt* interactorManager = G4Xt::getInstance ();
+  toplevel = (Widget)interactorManager->GetMainInteractor();
+  app      = XtWidgetToApplicationContext(toplevel);
+
+  if (!toplevel) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to Initialize"
+      " application context." << G4endl;
+    return;
+  }
+
+  // Better to put this in an X11 resource file !!!
+  std::ostringstream oss;
+  oss <<
+    "*glxarea*width: " << fVP.GetWindowSizeHintX() << "\n"
+    "*glxarea*height: " << fVP.GetWindowSizeHintY() << "\n"
+    /*
+    // Tried this as a replacement for the above two lines, but
+    // sub-windows (rotation, etc.) came same size!!
+    "*geometry: " << fVP.GetXGeometryString() << "\n"
+    */
+    "*frame*x: 10\n"
+    "*frame*y: 10\n"
+    "*frame*topOffset: 10\n"
+    "*frame*bottomOffset: 10\n"
+    "*frame*rightOffset: 10\n"
+    "*frame*leftOffset: 10\n"
+    "*frame*shadowType: SHADOW_IN\n"
+    "*frame*useColorObj: False\n"
+    "*frame*primaryColorSetId: 3\n"
+    "*frame*secondaryColorSetId: 3\n"
+    "*menubar*useColorObj: False\n"
+    "*menubar*primaryColorSetId: 3\n"
+    "*menubar*secondaryColorSetId: 3\n"
+    "*toplevel*useColorObj: False\n"
+    "*toplevel*primaryColorSetId: 3\n"
+    "*toplevel*secondaryColorSetId: 3\n";
+  interactorManager->PutStringInResourceDatabase ((char*)oss.str().c_str());
+
+  //  interactorManager->AddSecondaryLoopPostAction ((G4SecondaryLoopAction)G4OpenGLXmViewerSecondaryLoopPostAction);
+  
+  shell = XtAppCreateShell ((String)fName.data(),(String)fName.data(),topLevelShellWidgetClass,XtDisplay(toplevel),NULL,0); 
+  interactorManager->AddShell (shell);
+
+  dpy = XtDisplay (shell);
+
+  if (!dpy) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to connect to display."
+	 << G4endl;
+    return;
+  }
+
+  if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLXmViewer::GetXmConnection. X Server has no GLX extension."
+	 << G4endl;;
+    return;
+  }
+}
+
+void G4OpenGLXmViewer::CreateMainWindow () {
+
+  bgnd = XWhitePixelOfScreen (XtScreen(shell));
+  borcol = XBlackPixelOfScreen (XtScreen(shell));
+  
+  XtVaSetValues (shell, 
+		 XtNvisual, vi -> visual, 
+       		 XtNdepth, vi -> depth, 
+       		 XtNcolormap, cmap, 
+		 XtNborderColor, &borcol,
+		 XtNbackground, &bgnd,
+		 XmNtitle, fName.data(),
+		 NULL);
+
+  main_win = XtVaCreateManagedWidget ("main_win", 
+				      xmMainWindowWidgetClass,
+				      shell,
+				      XtNvisual, vi -> visual, 
+				      XtNdepth, vi -> depth, 
+				      XtNcolormap, cmap, 
+				      XtNborderColor, borcol,
+				      XtNbackground, bgnd,
+				      NULL);
+
+  //*********Create a menu bar for the window********
+  style_str = XmStringCreateLocalized ((char*)"Style");
+  actions_str = XmStringCreateLocalized ((char*)"Actions");
+  misc_str = XmStringCreateLocalized ((char*)"Miscellany");
+  spec_str = XmStringCreateLocalized ((char*)"Special");
+
+  menubar = XmVaCreateSimpleMenuBar (main_win,
+				     (char*)"menubar",
+				     XmVaCASCADEBUTTON, style_str, 'S',
+				     XmVaCASCADEBUTTON, actions_str, 'A',
+				     XmVaCASCADEBUTTON, misc_str, 'M',
+				     XmVaCASCADEBUTTON, spec_str, 'p',
+				     XtNvisual, vi -> visual, 
+				     XtNdepth, vi -> depth, 
+				     XtNcolormap, cmap, 
+				     XtNborderColor, borcol,
+				     XtNbackground, bgnd,
+				     NULL);
+
+  XmStringFree (style_str);
+  XmStringFree (actions_str);
+  XmStringFree (misc_str);
+  XmStringFree (spec_str);
+
+  G4cout << "Created menubar" << G4endl;
+
+
+  //*********Create style pulldown menu on menubar*********
+  rep_str = XmStringCreateLocalized ((char*)"Representation");
+  draw_str = XmStringCreateLocalized ((char*)"Drawing");
+  bgnd_str = XmStringCreateLocalized ((char*)"Background color");
+
+  style_cascade = XmVaCreateSimplePulldownMenu
+    (menubar,
+     (char*)"style",
+     0,
+     NULL,
+     XmVaCASCADEBUTTON, rep_str, 'R',
+     XmVaCASCADEBUTTON, draw_str, 'D',
+     XmVaCASCADEBUTTON, bgnd_str, 'B',
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  XmStringFree (rep_str);
+  XmStringFree (draw_str);
+  XmStringFree (bgnd_str);
+
+  //  G4cout << "Created Style pulldown menu" << G4endl;
+
+  //Add Representation pullright menu to style cascade...
+  polyhedron_str = XmStringCreateLocalized ((char*)"Polyhedron");
+  nurbs_str = XmStringCreateLocalized ((char*)"NURBS");
+
+  rep_style_pullright = XmVaCreateSimplePulldownMenu 
+    (style_cascade,
+     (char*)"rep_style",
+     0,
+     rep_style_callback,
+     XmVaRADIOBUTTON, polyhedron_str, 'P', NULL, NULL,
+     XmVaRADIOBUTTON, nurbs_str, 'N', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this, 
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  Widget special_widget;
+
+  G4ViewParameters::RepStyle style;
+  style = fVP.GetRepStyle();
+  
+  if (style == G4ViewParameters::polyhedron) {
+    special_widget = XtNameToWidget(rep_style_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (style == G4ViewParameters::nurbs) {
+    special_widget = XtNameToWidget(rep_style_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("Invalid Representation style in G4OpenGLXmViewer::CreateContext");
+  }
+  XmStringFree (polyhedron_str);
+  XmStringFree (nurbs_str);
+  
+  //  G4cout << "Created Representation pulldown menu" << G4endl;
+
+  //Add Drawing pullright menu to style cascade...
+  wireframe_str = XmStringCreateLocalized ((char*)"Wireframe");
+  hlr_str = XmStringCreateLocalized ((char*)"Hidden line removal");
+  hsr_str = XmStringCreateLocalized ((char*)"Hidden surface removal");
+  hlhsr_str = XmStringCreateLocalized ((char*)"Hidden line and surface removal");
+
+  drawing_style_pullright = XmVaCreateSimplePulldownMenu 
+    (style_cascade,
+     (char*)"drawing_style",
+     1,
+     drawing_style_callback,
+     XmVaRADIOBUTTON, wireframe_str, 'W', NULL, NULL,
+     XmVaRADIOBUTTON, hlr_str, 'L', NULL, NULL,
+     XmVaRADIOBUTTON, hsr_str, 'S', NULL, NULL,
+     XmVaRADIOBUTTON, hlhsr_str, 'H', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  G4ViewParameters::DrawingStyle d_style;
+  d_style = fVP.GetDrawingStyle();
+  
+  if (d_style == G4ViewParameters::wireframe) {
+    special_widget = XtNameToWidget(drawing_style_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (d_style == G4ViewParameters::hlr) {
+    special_widget = XtNameToWidget(drawing_style_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (d_style == G4ViewParameters::hsr) {
+    special_widget = XtNameToWidget(drawing_style_pullright, "button_2");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (d_style == G4ViewParameters::hlhsr) {
+    special_widget = XtNameToWidget(drawing_style_pullright, "button_3");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("Invalid Drawing style in G4OpenGLXmViewer::CreateContext");
+  }
+
+  XmStringFree (wireframe_str);
+  XmStringFree (hlr_str);
+  XmStringFree (hsr_str);
+  XmStringFree (hlhsr_str);
+
+  //  G4cout << "Created Drawing pullright menu" << G4endl;
+
+  //Add Drawing pullright menu to style cascade...
+  white_str = XmStringCreateLocalized ((char*)"White");
+  black_str = XmStringCreateLocalized ((char*)"Black");
+
+  background_color_pullright = XmVaCreateSimplePulldownMenu 
+    (style_cascade,
+     (char*)"background_color",
+     2,
+     background_color_callback,
+     XmVaRADIOBUTTON, white_str, 'W', NULL, NULL,
+     XmVaRADIOBUTTON, black_str, 'B', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (background.GetRed() == 1. &&
+      background.GetGreen() == 1. &&
+      background.GetBlue() == 1.) {
+    special_widget = XtNameToWidget(background_color_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    special_widget = XtNameToWidget(background_color_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  }
+
+  XmStringFree (white_str);
+  XmStringFree (black_str);
+
+  //  G4cout << "Created Background color pullright menu" << G4endl;
+
+  //*********Create actions pulldown menu on menubar*********
+  rot_str = XmStringCreateLocalized ((char*)"Rotation control panel");
+  pan_str = XmStringCreateLocalized ((char*)"Panning control panel");
+  set_str = XmStringCreateLocalized ((char*)"Set control panel limits");
+
+  actions_cascade = XmVaCreateSimplePulldownMenu
+    (menubar,
+     (char*)"actions",
+     1,
+     actions_callback,
+     XmVaPUSHBUTTON, rot_str, 'R', NULL, NULL,
+     XmVaPUSHBUTTON, pan_str, 'P', NULL, NULL,
+     XmVaPUSHBUTTON, set_str, 'S', NULL, NULL,
+     XmNuserData, this, 
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  XmStringFree (rot_str);
+  XmStringFree (pan_str);
+  XmStringFree (set_str);
+  G4cout << "Created Actions pulldown menu" << G4endl;
+
+  misc_str = XmStringCreateLocalized ((char*)"Miscellany control panel");
+  exit_str = XmStringCreateLocalized ((char*)"Exit to G4Vis>");
+  print_str = XmStringCreateLocalized ((char*)"Create .eps file");
+
+  //*********Create miscellany pulldown menu on menubar*********
+  misc_cascade = XmVaCreateSimplePulldownMenu
+    (menubar,
+     (char*)"miscellany",
+     2,
+     misc_callback,
+     XmVaPUSHBUTTON, misc_str, 'M', NULL, NULL,
+     XmVaPUSHBUTTON, exit_str, 'E', NULL, NULL,
+     XmVaPUSHBUTTON, print_str, 'P', NULL, NULL,
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  XmStringFree (misc_str);
+  XmStringFree (exit_str);
+  XmStringFree (print_str);
+  G4cout << "Created Miscellany pulldown menu" << G4endl;
+
+  trans_str = XmStringCreateLocalized ((char*)"Transparency");
+  anti_str = XmStringCreateLocalized ((char*)"Antialiasing");
+  halo_str = XmStringCreateLocalized ((char*)"Haloing");
+  aux_edge_str = XmStringCreateLocalized ((char*)"Auxiliary edges");
+
+  //*********Create special pulldown menu on menubar*********
+  spec_cascade = XmVaCreateSimplePulldownMenu
+    (menubar,
+     (char*)"special",
+     3,
+     NULL,
+     XmVaCASCADEBUTTON, trans_str, 'T',
+     XmVaCASCADEBUTTON, anti_str, 'A',
+     XmVaCASCADEBUTTON, halo_str, 'H',
+     XmVaCASCADEBUTTON, aux_edge_str, 'E',
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  XmStringFree (trans_str);
+  XmStringFree (anti_str);
+  XmStringFree (halo_str);
+  XmStringFree (aux_edge_str);
+
+  //  G4cout << "Created Special pulldown menu" << G4endl;
+
+  //Add Transparency pullright menu to special cascade...
+  off_str = XmStringCreateLocalized ((char*)"Off");
+  on_str = XmStringCreateLocalized ((char*)"On");
+
+  transparency_pullright = XmVaCreateSimplePulldownMenu 
+    (spec_cascade,
+     (char*)"transparency",
+     0,
+     transparency_callback,
+     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
+     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (transparency_enabled == false) {
+    special_widget = XtNameToWidget(transparency_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (transparency_enabled == true) {
+    special_widget = XtNameToWidget(transparency_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("transparency_enabled in G4OpenGLXmViewer is neither true nor false!!");
+  }
+
+  //Add antialias pullright menu to special cascade...
+  antialias_pullright = XmVaCreateSimplePulldownMenu 
+    (spec_cascade,
+     (char*)"antialias",
+     1,
+     antialias_callback,
+     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
+     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (antialiasing_enabled == false) {
+    special_widget = XtNameToWidget(antialias_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (antialiasing_enabled == true) {
+    special_widget = XtNameToWidget(antialias_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("antialiasing_enabled in G4OpenGLXmViewer is neither true nor false!!");
+  }
+
+  //Add Haloing pullright menu to special cascade...
+  haloing_pullright = XmVaCreateSimplePulldownMenu 
+    (spec_cascade,
+     (char*)"haloing",
+     2,
+     haloing_callback,
+     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
+     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (haloing_enabled == false) {
+    special_widget = XtNameToWidget(haloing_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else if (haloing_enabled == true) {
+    special_widget = XtNameToWidget(haloing_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    G4Exception("haloing_enabled in G4OpenGLXmViewer is neither true nor false!!");
+  }
+
+  //Add Aux_Edge pullright menu to special cascade...
+  aux_edge_pullright = XmVaCreateSimplePulldownMenu 
+    (spec_cascade,
+     (char*)"aux_edge",
+     3,
+     aux_edge_callback,
+     XmVaRADIOBUTTON, off_str, 'f', NULL, NULL,
+     XmVaRADIOBUTTON, on_str, 'n', NULL, NULL,
+     XmNradioBehavior, True, 
+     XmNradioAlwaysOne, True, 
+     XmNuserData, this,
+     XtNvisual, vi -> visual, 
+     XtNdepth, vi -> depth, 
+     XtNcolormap, cmap, 
+     XtNborderColor, borcol,
+     XtNbackground, bgnd,
+     NULL);
+  
+  if (!fVP.IsAuxEdgeVisible()) {
+    special_widget = XtNameToWidget(aux_edge_pullright, "button_0");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  } else {
+    special_widget = XtNameToWidget(aux_edge_pullright, "button_1");
+    if(special_widget) {
+      XtVaSetValues (special_widget, XmNset, True, NULL);
+    }
+  }
+
+  XtManageChild (menubar);
+  frame = XtVaCreateManagedWidget ((char*)"frame",
+				   xmFrameWidgetClass, main_win,
+				   XtNvisual, vi -> visual, 
+				   XtNdepth, vi -> depth, 
+				   XtNcolormap, cmap, 
+				   XtNborderColor, borcol,
+				   XtNbackground, bgnd,
+				   NULL);
+
+  glxarea = XtVaCreateManagedWidget ((char*)"glxarea", 
+				     xmDrawingAreaWidgetClass,
+				     frame,
+				     XtNvisual, vi -> visual, 
+				     XtNdepth, vi -> depth, 
+				     XtNcolormap, cmap, 
+				     XtNborderColor, borcol,
+				     XtNbackground, bgnd,
+				     NULL);
+  
+  XtAddCallback (glxarea, 
+		 XmNexposeCallback, 
+		 expose_callback, 
+		 this);
+
+  XtAddCallback (glxarea, 
+		 XmNresizeCallback, 
+		 resize_callback, 
+		 this);
+
+  XmMainWindowSetAreas (main_win,  // main widget, children are specified 
+			menubar,   // widget to use as menu bar
+			NULL,      // widget to use as command window
+			NULL,      // widget for horizontal scroll bar
+			NULL,      // widget for vertical scroll bar
+			frame      // widget to be used for work window
+			);
+
+  XtRealizeWidget(shell);
+  
+  // Once widget is realized (ie, associated with a created X window), we
+  // can bind the OpenGL rendering context to the window.
+
+  Dimension width, height;
+  XtVaGetValues (glxarea,XmNwidth,&width,XmNheight,&height,NULL);
+  WinSize_x = (G4int) width;
+  WinSize_y = (G4int) height;
+
+  win = XtWindow (glxarea);
+
+  glXMakeCurrent (dpy, win, cx);
+
+}
+
+G4OpenGLXmViewer::G4OpenGLXmViewer (G4OpenGLSceneHandler& scene):
+G4VViewer (scene, -1),
+G4OpenGLViewer (scene),
+G4OpenGLXViewer (scene),
+zoom_high (fVP.GetZoomFactor() * 10.0),
+zoom_low (fVP.GetZoomFactor() / 10.0),
+dolly_low (fVP.GetDolly() - 1000.0),
+dolly_high (fVP.GetDolly() + 1000.0),
+fov (0.0),
+rot_sens_limit (90.),
+pan_sens_limit (100.),
+rot_sens (4.),
+wob_sens (20.),
+original_vp(fVP.GetViewpointDirection()),
+frameNo (0),
+fprotation_top (0),
+fprotation_slider (0),
+fppanning_top (0),
+fppanning_slider (0),
+fpzoom_slider (0),
+fpdolly_slider (0),
+fpsetting_top (0),
+fpmiscellany_top (0),
+fpprint_top (0)
+{
+  WinSize_x = 100;
+  WinSize_y = 100;
+  
+  GetXmConnection ();
+  if (fViewId < 0) return;
+}
+
+G4OpenGLXmViewer::~G4OpenGLXmViewer ()
+{
+  XtDestroyWidget  (shell);
+  win = 0; // ...to avoid XDestroyWindow in G4OpenGLXViewer base class
+  // because XtDestroyWidget has already destroyed it.
+  G4Xt::getInstance () ->RemoveShell (shell);
+
+/******************************
+  if (fprotation_top) {
+    delete fprotation_top;
+  }
+
+  if (fppanning_top) {
+    delete fppanning_top;
+  }
+
+  if (fpsetting_top) {
+    delete fpsetting_top;
+  }
+
+  if (fpmiscellany_top) {
+    delete fpmiscellany_top;
+  }
+******************************/
+
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmViewerMessenger.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmViewerMessenger.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmViewerMessenger.cc	(revision 562)
@@ -0,0 +1,280 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewerMessenger.hh"
+
+#include "G4OpenGLXmViewer.hh"
+#include "G4OpenGLXmSliderBar.hh"
+
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithADoubleAndUnit.hh"
+#include "G4UIcmdWithADouble.hh"
+
+#include "G4VisManager.hh"
+
+G4OpenGLXmViewerMessenger* G4OpenGLXmViewerMessenger::fpInstance = 0;
+
+G4OpenGLXmViewerMessenger* G4OpenGLXmViewerMessenger::GetInstance()
+{
+  if (!fpInstance) fpInstance = new G4OpenGLXmViewerMessenger;
+  return fpInstance;
+}
+
+G4OpenGLXmViewerMessenger::G4OpenGLXmViewerMessenger()
+{
+  G4bool omitable;
+
+  fpDirectory = new G4UIdirectory("/vis/oglxm/");
+  fpDirectory->SetGuidance("G4OpenGLXmViewer commands.");
+
+  fpDirectorySet = new G4UIdirectory ("/vis/oglxm/set/");
+  fpDirectorySet->SetGuidance("G4OpenGLXmViewer set commands.");
+
+  fpCommandSetDollyHigh =
+    new G4UIcmdWithADoubleAndUnit("/vis/oglxm/set/dolly-high", this);
+  fpCommandSetDollyHigh->SetGuidance("Higher limit of dolly slider.");
+  fpCommandSetDollyHigh->SetParameterName("dolly-high", omitable = false);
+
+  fpCommandSetDollyLow =
+    new G4UIcmdWithADoubleAndUnit("/vis/oglxm/set/dolly-low", this);
+  fpCommandSetDollyLow->SetGuidance("Lower limit of dolly slider.");
+  fpCommandSetDollyLow->SetParameterName("dolly-low", omitable = false);
+
+  fpCommandSetPanHigh =
+    new G4UIcmdWithADoubleAndUnit("/vis/oglxm/set/pan-high", this);
+  fpCommandSetPanHigh->SetGuidance("Higher limit of pan slider.");
+  fpCommandSetPanHigh->SetParameterName("pan-high", omitable = false);
+
+  fpCommandSetRotationHigh =
+    new G4UIcmdWithADoubleAndUnit("/vis/oglxm/set/rotation-high", this);
+  fpCommandSetRotationHigh->SetGuidance("Higher limit of rotation slider.");
+  fpCommandSetRotationHigh->SetParameterName("rotation-high", omitable = false);
+
+  fpCommandSetZoomHigh =
+    new G4UIcmdWithADouble("/vis/oglxm/set/zoom-high", this);
+  fpCommandSetZoomHigh->SetGuidance("Higher limit of zoom slider.");
+  fpCommandSetZoomHigh->SetParameterName("zoom-high", omitable = false);
+
+  fpCommandSetZoomLow =
+    new G4UIcmdWithADouble("/vis/oglxm/set/zoom-low", this);
+  fpCommandSetZoomLow->SetGuidance("Lower limit of zoom slider.");
+  fpCommandSetZoomLow->SetParameterName("zoom-low", omitable = false);
+}
+
+G4OpenGLXmViewerMessenger::~G4OpenGLXmViewerMessenger ()
+{
+  delete fpCommandSetZoomLow;
+  delete fpCommandSetZoomHigh;
+  delete fpCommandSetRotationHigh;
+  delete fpCommandSetPanHigh;
+  delete fpCommandSetDollyLow;
+  delete fpCommandSetDollyHigh;
+  delete fpDirectorySet;
+  delete fpDirectory;
+}
+
+void G4OpenGLXmViewerMessenger::SetNewValue
+(G4UIcommand* command, G4String newValue)
+{
+  G4VisManager* pVisManager = G4VisManager::GetInstance();
+
+  G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
+
+  if (!pVViewer) {
+    G4cout <<
+      "G4OpenGLXmViewerMessenger::SetNewValue: No current viewer."
+      "\n  \"/vis/open\", or similar, to get one."
+           << G4endl;
+    return;
+  }
+
+  G4OpenGLXmViewer* pViewer = dynamic_cast<G4OpenGLXmViewer*>(pVViewer);
+
+  if (!pViewer) {
+    G4cout <<
+      "G4OpenGLXmViewerMessenger::SetNewValue: Current viewer is not of type"
+      "\n  OGLIXm or OGLSXm.  Use \"/vis/viewer/select\" or \"/vis/open\"."
+           << G4endl;
+    return;
+  }
+
+  G4bool panningControlPanel = true;
+  G4bool rotationControlPanel = true;
+
+  if (command == fpCommandSetDollyHigh)
+    {
+      if (pViewer->fpdolly_slider)
+	{
+	  pViewer->dolly_high =
+	    fpCommandSetDollyHigh->GetNewDoubleValue(newValue);
+	  pViewer->fpdolly_slider->SetMaxValue (pViewer->dolly_high);
+	  if (pViewer->fVP.GetDolly() > pViewer->dolly_high)
+	    {
+	      pViewer->fpdolly_slider->SetInitialValue (pViewer->dolly_high);
+	      pViewer->fVP.SetDolly(pViewer->dolly_high);
+	    }
+	  else
+	    {
+	      pViewer->fpdolly_slider->SetInitialValue (pViewer->fVP.GetDolly());
+	    }
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetDollyLow)
+    {
+      if (pViewer->fpdolly_slider)
+	{
+	  pViewer->dolly_low =
+	    fpCommandSetDollyLow->GetNewDoubleValue(newValue);
+	  pViewer->fpdolly_slider->SetMinValue (pViewer->dolly_low);
+	  if (pViewer->fVP.GetDolly() < pViewer->dolly_low)
+	    {
+	      pViewer->fpdolly_slider->SetInitialValue (pViewer->dolly_low);
+	      pViewer->fVP.SetDolly(pViewer->dolly_low);
+	    }
+	  else
+	    {
+	      pViewer->fpdolly_slider->SetInitialValue (pViewer->fVP.GetDolly());
+	    }
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetPanHigh)
+    {
+      if (pViewer->fppanning_slider)
+	{
+	  pViewer->pan_sens_limit =
+	    fpCommandSetPanHigh->GetNewDoubleValue(newValue);
+	  pViewer->fppanning_slider->SetMaxValue (pViewer->pan_sens_limit);
+	  pViewer->fppanning_slider->SetInitialValue (pViewer->pan_sens_limit / 2.);
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetRotationHigh)
+    {
+      if (pViewer->fprotation_slider)
+	{
+	  // Internally in OpenGLXm, it's in degrees...
+	  pViewer->rot_sens_limit =
+	    fpCommandSetRotationHigh->GetNewDoubleValue(newValue) / deg;
+	  pViewer->fprotation_slider->SetMaxValue (pViewer->rot_sens_limit);
+	  pViewer->fprotation_slider->SetInitialValue (pViewer->rot_sens_limit / 2.);
+	}
+      else
+	{
+	  rotationControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetZoomHigh)
+    {
+      if (pViewer->fpzoom_slider)
+	{
+	  pViewer->zoom_high =
+	    fpCommandSetZoomHigh->GetNewDoubleValue(newValue);
+	  pViewer->fpzoom_slider->SetMaxValue (pViewer->zoom_high);
+	  pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
+	  if (pViewer->fVP.GetZoomFactor() > pViewer->zoom_high)
+	    {
+	      pViewer->fpzoom_slider->SetInitialValue (pViewer->zoom_high);
+	      pViewer->fVP.SetZoomFactor(pViewer->zoom_high);
+	    }
+	  else
+	    {
+	      pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
+	    }
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  else if (command == fpCommandSetZoomLow)
+    {
+      if (pViewer->fpzoom_slider)
+	{
+	  pViewer->zoom_low =
+	    fpCommandSetZoomLow->GetNewDoubleValue(newValue);
+	  pViewer->fpzoom_slider->SetMinValue (pViewer->zoom_low);
+	  pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
+	  if (pViewer->fVP.GetZoomFactor() < pViewer->zoom_low)
+	    {
+	      pViewer->fpzoom_slider->SetInitialValue (pViewer->zoom_low);
+	      pViewer->fVP.SetZoomFactor(pViewer->zoom_low);
+	    }
+	  else
+	    {
+	      pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
+	    }
+	}
+      else
+	{
+	  panningControlPanel = false;
+	}
+    }
+
+  if (!panningControlPanel)
+    {
+	  G4cout << 
+	    "G4OpenGLXmViewerMessenger::SetNewValue: pull down panning"
+	    "\n  control panel and re-issue command."
+		 << G4endl;
+	  return;
+    }
+
+  if (!rotationControlPanel)
+    {
+	  G4cout << 
+	    "G4OpenGLXmViewerMessenger::SetNewValue: pull down rotation"
+	    "\n  control panel and re-issue command."
+		 << G4endl;
+	  return;
+    }
+
+  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmWindowHandlingCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmWindowHandlingCallbacks.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/G4OpenGLXmWindowHandlingCallbacks.cc	(revision 562)
@@ -0,0 +1,114 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.6 2006/06/29 21:20:20 gunter Exp $
+// GEANT4 tag $Name: geant4-08-01-patch-01 $
+//
+// 
+// Andrew Walkden  16th June 1997
+// G4OpenGLXmWindowHandlingCallbacks : Callback functions for
+//                                     (Motif) widgets to use.
+//                                     in handling (Xm) windows
+
+#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
+
+#include "G4OpenGLXmViewer.hh"
+
+void G4OpenGLXmViewer::resize_callback (Widget w, 
+				      XtPointer clientData, 
+				      XtPointer) 
+{
+  Dimension width, height;
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  
+  XtVaGetValues (w, 
+		 XmNwidth, &width, 
+		 XmNheight, &height, 
+		 NULL);
+  
+  pView->WinSize_x = (G4int) width;
+  pView->WinSize_y = (G4int) height;
+}
+
+
+
+void G4OpenGLXmViewer::expose_callback (Widget w, 
+				      XtPointer clientData, 
+				      XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
+  Dimension width, height;
+
+  XtVaGetValues (w, 
+		 XmNwidth, &width, 
+		 XmNheight, &height, 
+		 NULL);
+
+  pView->WinSize_x = (G4int) width;
+  pView->WinSize_y = (G4int) height;
+
+  glXMakeCurrent (pView->dpy, XtWindow(pView->glxarea), pView->cx);
+  glViewport (0, 0, width, height);
+
+  pView->ClearView ();
+  pView->DrawView ();
+}
+
+void G4OpenGLXmViewer::print_callback (Widget, 
+				    XtPointer clientData, 
+				    XtPointer) 
+{
+  G4OpenGLXViewer* pView = (G4OpenGLXmViewer*) clientData;
+  pView->print();
+}
+
+void G4OpenGLXmViewer::set_print_colour_callback (Widget w,
+						XtPointer clientData,
+						XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+  
+  G4int choice = get_int_userData (w);
+  
+  pView->print_colour=(G4bool)choice;
+  G4cout << "Print colour set to " << pView->print_colour;
+  
+}
+
+void G4OpenGLXmViewer::set_print_style_callback (Widget w,
+					       XtPointer clientData,
+					       XtPointer) 
+{
+  G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
+  
+  G4int choice = get_int_userData (w);
+  
+  pView->vectored_ps=(G4bool)choice;
+  G4cout << "`Produce vectored PostScript ?' set to : " << pView->print_colour;
+  
+}
+
+#endif
Index: trunk/geant4/visualization/OpenGL/old-src/moc_G4OpenGLQtViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/old-src/moc_G4OpenGLQtViewer.cc	(revision 562)
+++ trunk/geant4/visualization/OpenGL/old-src/moc_G4OpenGLQtViewer.cc	(revision 562)
@@ -0,0 +1,104 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'G4OpenGLQtViewer.hh'
+**
+** Created: Mon Aug 13 11:44:23 2007
+**      by: The Qt Meta Object Compiler version 59 (Qt 4.2.2)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "../include/G4OpenGLQtViewer.hh"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'G4OpenGLQtViewer.hh' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 59
+#error "This file was generated using the moc from 4.2.2. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+static const uint qt_meta_data_G4OpenGLQtViewer[] = {
+
+ // content:
+       1,       // revision
+       0,       // classname
+       0,    0, // classinfo
+      13,   10, // methods
+       0,    0, // properties
+       0,    0, // enums/sets
+
+ // slots: signature, parameters, type, tag, flags
+      17,   42,   42,   42, 0x08,
+      43,   42,   42,   42, 0x08,
+      70,   42,   42,   42, 0x08,
+     100,   42,   42,   42, 0x08,
+     134,   42,   42,   42, 0x08,
+     159,   42,   42,   42, 0x08,
+     183,   42,   42,   42, 0x08,
+     210,   42,   42,   42, 0x08,
+     233,   42,   42,   42, 0x08,
+     258,   42,   42,   42, 0x08,
+     283,   42,   42,   42, 0x08,
+     303,   42,   42,   42, 0x08,
+     319,   42,   42,   42, 0x08,
+
+       0        // eod
+};
+
+static const char qt_meta_stringdata_G4OpenGLQtViewer[] = {
+    "G4OpenGLQtViewer\0actionDrawingWireframe()\0"
+    "\0actionDrawingLineRemoval()\0"
+    "actionDrawingSurfaceRemoval()\0"
+    "actionDrawingLineSurfaceRemoval()\0"
+    "toggleDrawingAction(int)\0"
+    "toggleMouseAction(bool)\0"
+    "toggleRepresentation(bool)\0"
+    "toggleBackground(bool)\0toggleTransparency(bool)\0"
+    "toggleAntialiasing(bool)\0toggleHaloing(bool)\0"
+    "toggleAux(bool)\0toggleFullScreen(bool)\0"
+};
+
+const QMetaObject G4OpenGLQtViewer::staticMetaObject = {
+    { &QObject::staticMetaObject, qt_meta_stringdata_G4OpenGLQtViewer,
+      qt_meta_data_G4OpenGLQtViewer, 0 }
+};
+
+const QMetaObject *G4OpenGLQtViewer::metaObject() const
+{
+    return &staticMetaObject;
+}
+
+void *G4OpenGLQtViewer::qt_metacast(const char *_clname)
+{
+    if (!_clname) return 0;
+    if (!strcmp(_clname, qt_meta_stringdata_G4OpenGLQtViewer))
+	return static_cast<void*>(const_cast<G4OpenGLQtViewer*>(this));
+    if (!strcmp(_clname, "G4OpenGLViewer"))
+	return static_cast<G4OpenGLViewer*>(const_cast<G4OpenGLQtViewer*>(this));
+    return QObject::qt_metacast(_clname);
+}
+
+int G4OpenGLQtViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+    _id = QObject::qt_metacall(_c, _id, _a);
+    if (_id < 0)
+        return _id;
+    if (_c == QMetaObject::InvokeMetaMethod) {
+        switch (_id) {
+        case 0: actionDrawingWireframe(); break;
+        case 1: actionDrawingLineRemoval(); break;
+        case 2: actionDrawingSurfaceRemoval(); break;
+        case 3: actionDrawingLineSurfaceRemoval(); break;
+        case 4: toggleDrawingAction((*reinterpret_cast< int(*)>(_a[1]))); break;
+        case 5: toggleMouseAction((*reinterpret_cast< bool(*)>(_a[1]))); break;
+        case 6: toggleRepresentation((*reinterpret_cast< bool(*)>(_a[1]))); break;
+        case 7: toggleBackground((*reinterpret_cast< bool(*)>(_a[1]))); break;
+        case 8: toggleTransparency((*reinterpret_cast< bool(*)>(_a[1]))); break;
+        case 9: toggleAntialiasing((*reinterpret_cast< bool(*)>(_a[1]))); break;
+        case 10: toggleHaloing((*reinterpret_cast< bool(*)>(_a[1]))); break;
+        case 11: toggleAux((*reinterpret_cast< bool(*)>(_a[1]))); break;
+        case 12: toggleFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
+        }
+        _id -= 13;
+    }
+    return _id;
+}
Index: trunk/geant4/visualization/currentEvent.rndm
===================================================================
--- trunk/geant4/visualization/currentEvent.rndm	(revision 562)
+++ trunk/geant4/visualization/currentEvent.rndm	(revision 562)
@@ -0,0 +1,5 @@
+Uvec
+1878463799
+0
+9876
+54321
Index: trunk/geant4/visualization/currentRun.rndm
===================================================================
--- trunk/geant4/visualization/currentRun.rndm	(revision 562)
+++ trunk/geant4/visualization/currentRun.rndm	(revision 562)
@@ -0,0 +1,5 @@
+Uvec
+1878463799
+0
+1180857998
+122938492
Index: trunk/geant4/visualization/externals/zlib/GNUmakefile
===================================================================
--- trunk/geant4/visualization/externals/zlib/GNUmakefile	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/GNUmakefile	(revision 562)
@@ -0,0 +1,12 @@
+# $Id: GNUmakefile,v 1.1 2005/05/12 19:39:31 allison Exp $
+# -------------------------------------------------------------
+# GNUmakefile for zlib.  John Allison, 5/5/05.
+
+name := G4zlib
+
+ifndef G4INSTALL
+  G4INSTALL = ../../../..
+endif
+
+include $(G4INSTALL)/config/architecture.gmk
+include $(G4INSTALL)/config/common.gmk
Index: trunk/geant4/visualization/externals/zlib/History
===================================================================
--- trunk/geant4/visualization/externals/zlib/History	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/History	(revision 562)
@@ -0,0 +1,24 @@
+.$Id: History,v 1.1 2005/05/25 23:18:52 duns Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+History file for visualization/HepRep sub-category
+--------------------------------------------------
+25 May 2005 Mark Donszelmann (vis-zlib-V07-00-00 against geant4-07-00-ref-03)
+- zlib version 1.2.2
+
Index: trunk/geant4/visualization/externals/zlib/README
===================================================================
--- trunk/geant4/visualization/externals/zlib/README	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/README	(revision 562)
@@ -0,0 +1,138 @@
+Mark Donszelmann - 4 May 2005
+=============================
+Files renamed to .cc
+Removed all files for reading zlib format.
+Functions were modified to compile with C++ compiler, "type-name" rather than 
+"name { type", in:
+
+adler32.cc, compress.cc, crc32.cc, deflate.cc, trees.cc
+
+In: deflate.cc and trees.cc all strings are casted to (char*) to avoid warnings.
+=============================================================
+
+ZLIB DATA COMPRESSION LIBRARY
+
+zlib 1.2.1 is a general purpose data compression library.  All the code is
+thread safe.  The data format used by the zlib library is described by RFCs
+(Request for Comments) 1950 to 1952 in the files
+http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
+and rfc1952.txt (gzip format). These documents are also available in other
+formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
+
+All functions of the compression library are documented in the file zlib.h
+(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
+of the library is given in the file example.c which also tests that the library
+is working correctly. Another example is given in the file minigzip.c. The
+compression library itself is composed of all source files except example.c and
+minigzip.c.
+
+To compile all files and run the test program, follow the instructions given at
+the top of Makefile. In short "make test; make install" should work for most
+machines. For Unix: "./configure; make test; make install" For MSDOS, use one
+of the special makefiles such as Makefile.msc. For VMS, use Make_vms.com or
+descrip.mms.
+
+Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
+<info@winimage.com> for the Windows DLL version. The zlib home page is
+http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem,
+please check this site to verify that you have the latest version of zlib;
+otherwise get the latest version and check whether the problem still exists or
+not.
+
+PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking
+for help.
+
+Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
+issue of  Dr. Dobb's Journal; a copy of the article is available in
+http://dogma.net/markn/articles/zlibtool/zlibtool.htm
+
+The changes made in version 1.2.1 are documented in the file ChangeLog.
+
+Unsupported third party contributions are provided in directory "contrib".
+
+A Java implementation of zlib is available in the Java Development Kit
+http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html
+See the zlib home page http://www.zlib.org for details.
+
+A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the
+CPAN (Comprehensive Perl Archive Network) sites
+http://www.cpan.org/modules/by-module/Compress/
+
+A Python interface to zlib written by A.M. Kuchling <amk@magnet.com> is
+available in Python 1.5 and later versions, see
+http://www.python.org/doc/lib/module-zlib.html
+
+A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is
+availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
+
+An experimental package to read and write files in .zip format, written on top
+of zlib by Gilles Vollant <info@winimage.com>, is available in the
+contrib/minizip directory of zlib.
+
+
+Notes for some targets:
+
+- For Windows DLL versions, please see win32/DLL_FAQ.txt
+
+- For 64-bit Irix, deflate.c must be compiled without any optimization. With
+  -O, one libpng test fails. The test works in 32 bit mode (with the -n32
+  compiler flag). The compiler bug has been reported to SGI.
+
+- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
+  when compiled with cc.
+
+- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
+  necessary to get gzprintf working correctly. This is done by configure.
+
+- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
+  other compilers. Use "make test" to check your compiler.
+
+- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
+
+- For PalmOs, see http://palmzlib.sourceforge.net/
+
+- When building a shared, i.e. dynamic library on Mac OS X, the library must be
+  installed before testing (do "make install" before "make test"), since the
+  library location is specified in the library.
+
+
+Acknowledgments:
+
+  The deflate format used by zlib was defined by Phil Katz. The deflate
+  and zlib specifications were written by L. Peter Deutsch. Thanks to all the
+  people who reported problems and suggested various improvements in zlib;
+  they are too numerous to cite here.
+
+Copyright notice:
+
+ (C) 1995-2003 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup@gzip.org          madler@alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not*
+receiving lengthy legal documents to sign. The sources are provided
+for free but without warranty of any kind.  The library has been
+entirely written by Jean-loup Gailly and Mark Adler; it does not
+include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include
+in the file ChangeLog history information documenting your changes. Please
+read the FAQ for more information on the distribution of modified source
+versions.
Index: trunk/geant4/visualization/externals/zlib/include/crc32.h
===================================================================
--- trunk/geant4/visualization/externals/zlib/include/crc32.h	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/include/crc32.h	(revision 562)
@@ -0,0 +1,441 @@
+/* crc32.h -- tables for rapid CRC calculation
+ * Generated automatically by crc32.c
+ */
+
+local const unsigned long FAR crc_table[TBLS][256] =
+{
+  {
+    0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
+    0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
+    0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
+    0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
+    0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
+    0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
+    0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
+    0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
+    0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
+    0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
+    0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
+    0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
+    0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
+    0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
+    0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
+    0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
+    0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
+    0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
+    0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
+    0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
+    0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
+    0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
+    0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
+    0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
+    0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
+    0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
+    0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
+    0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
+    0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
+    0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
+    0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
+    0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
+    0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
+    0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
+    0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
+    0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
+    0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
+    0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
+    0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
+    0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
+    0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
+    0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
+    0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
+    0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
+    0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
+    0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
+    0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
+    0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
+    0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
+    0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
+    0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
+    0x2d02ef8dUL
+#ifdef BYFOUR
+  },
+  {
+    0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
+    0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
+    0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
+    0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
+    0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
+    0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
+    0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
+    0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
+    0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
+    0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
+    0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
+    0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
+    0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
+    0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
+    0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
+    0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
+    0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
+    0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
+    0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
+    0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
+    0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
+    0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
+    0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
+    0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
+    0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
+    0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
+    0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
+    0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
+    0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
+    0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
+    0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
+    0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
+    0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
+    0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
+    0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
+    0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
+    0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
+    0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
+    0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
+    0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
+    0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
+    0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
+    0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
+    0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
+    0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
+    0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
+    0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
+    0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
+    0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
+    0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
+    0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
+    0x9324fd72UL
+  },
+  {
+    0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
+    0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
+    0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
+    0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
+    0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
+    0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
+    0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
+    0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
+    0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
+    0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
+    0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
+    0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
+    0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
+    0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
+    0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
+    0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
+    0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
+    0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
+    0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
+    0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
+    0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
+    0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
+    0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
+    0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
+    0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
+    0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
+    0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
+    0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
+    0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
+    0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
+    0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
+    0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
+    0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
+    0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
+    0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
+    0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
+    0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
+    0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
+    0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
+    0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
+    0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
+    0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
+    0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
+    0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
+    0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
+    0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
+    0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
+    0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
+    0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
+    0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
+    0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
+    0xbe9834edUL
+  },
+  {
+    0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
+    0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
+    0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
+    0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
+    0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
+    0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
+    0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
+    0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
+    0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
+    0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
+    0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
+    0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
+    0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
+    0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
+    0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
+    0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
+    0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
+    0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
+    0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
+    0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
+    0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
+    0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
+    0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
+    0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
+    0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
+    0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
+    0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
+    0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
+    0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
+    0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
+    0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
+    0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
+    0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
+    0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
+    0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
+    0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
+    0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
+    0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
+    0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
+    0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
+    0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
+    0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
+    0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
+    0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
+    0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
+    0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
+    0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
+    0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
+    0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
+    0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
+    0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
+    0xde0506f1UL
+  },
+  {
+    0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
+    0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
+    0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
+    0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
+    0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
+    0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
+    0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
+    0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
+    0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
+    0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
+    0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
+    0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
+    0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
+    0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
+    0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
+    0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
+    0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
+    0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
+    0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
+    0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
+    0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
+    0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
+    0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
+    0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
+    0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
+    0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
+    0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
+    0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
+    0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
+    0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
+    0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
+    0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
+    0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
+    0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
+    0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
+    0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
+    0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
+    0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
+    0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
+    0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
+    0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
+    0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
+    0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
+    0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
+    0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
+    0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
+    0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
+    0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
+    0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
+    0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
+    0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
+    0x8def022dUL
+  },
+  {
+    0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
+    0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
+    0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
+    0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
+    0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
+    0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
+    0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
+    0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
+    0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
+    0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
+    0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
+    0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
+    0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
+    0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
+    0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
+    0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
+    0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
+    0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
+    0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
+    0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
+    0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
+    0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
+    0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
+    0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
+    0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
+    0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
+    0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
+    0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
+    0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
+    0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
+    0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
+    0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
+    0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
+    0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
+    0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
+    0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
+    0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
+    0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
+    0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
+    0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
+    0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
+    0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
+    0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
+    0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
+    0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
+    0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
+    0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
+    0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
+    0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
+    0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
+    0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
+    0x72fd2493UL
+  },
+  {
+    0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
+    0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
+    0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
+    0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
+    0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
+    0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
+    0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
+    0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
+    0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
+    0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
+    0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
+    0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
+    0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
+    0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
+    0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
+    0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
+    0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
+    0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
+    0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
+    0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
+    0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
+    0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
+    0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
+    0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
+    0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
+    0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
+    0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
+    0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
+    0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
+    0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
+    0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
+    0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
+    0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
+    0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
+    0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
+    0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
+    0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
+    0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
+    0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
+    0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
+    0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
+    0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
+    0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
+    0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
+    0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
+    0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
+    0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
+    0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
+    0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
+    0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
+    0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
+    0xed3498beUL
+  },
+  {
+    0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
+    0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
+    0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
+    0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
+    0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
+    0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
+    0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
+    0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
+    0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
+    0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
+    0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
+    0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
+    0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
+    0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
+    0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
+    0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
+    0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
+    0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
+    0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
+    0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
+    0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
+    0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
+    0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
+    0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
+    0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
+    0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
+    0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
+    0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
+    0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
+    0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
+    0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
+    0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
+    0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
+    0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
+    0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
+    0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
+    0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
+    0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
+    0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
+    0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
+    0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
+    0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
+    0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
+    0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
+    0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
+    0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
+    0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
+    0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
+    0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
+    0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
+    0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
+    0xf10605deUL
+#endif
+  }
+};
Index: trunk/geant4/visualization/externals/zlib/include/deflate.h
===================================================================
--- trunk/geant4/visualization/externals/zlib/include/deflate.h	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/include/deflate.h	(revision 562)
@@ -0,0 +1,325 @@
+/* deflate.h -- internal compression state
+ * Copyright (C) 1995-2002 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: deflate.h,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#ifndef DEFLATE_H
+#define DEFLATE_H
+
+#include "zutil.h"
+
+/* define NO_GZIP when compiling if you want to disable gzip header and
+   trailer creation by deflate().  NO_GZIP would be used to avoid linking in
+   the crc code when it is not needed.  For shared libraries, gzip encoding
+   should be left enabled. */
+#ifndef NO_GZIP
+#  define GZIP
+#endif
+
+/* ===========================================================================
+ * Internal compression state.
+ */
+
+#define LENGTH_CODES 29
+/* number of length codes, not counting the special END_BLOCK code */
+
+#define LITERALS  256
+/* number of literal bytes 0..255 */
+
+#define L_CODES (LITERALS+1+LENGTH_CODES)
+/* number of Literal or Length codes, including the END_BLOCK code */
+
+#define D_CODES   30
+/* number of distance codes */
+
+#define BL_CODES  19
+/* number of codes used to transfer the bit lengths */
+
+#define HEAP_SIZE (2*L_CODES+1)
+/* maximum heap size */
+
+#define MAX_BITS 15
+/* All codes must not exceed MAX_BITS bits */
+
+#define INIT_STATE    42
+#define BUSY_STATE   113
+#define FINISH_STATE 666
+/* Stream status */
+
+
+/* Data structure describing a single value and its code string. */
+typedef struct ct_data_s {
+    union {
+        ush  freq;       /* frequency count */
+        ush  code;       /* bit string */
+    } fc;
+    union {
+        ush  dad;        /* father node in Huffman tree */
+        ush  len;        /* length of bit string */
+    } dl;
+} FAR ct_data;
+
+#define Freq fc.freq
+#define Code fc.code
+#define Dad  dl.dad
+#define Len  dl.len
+
+typedef struct static_tree_desc_s  static_tree_desc;
+
+typedef struct tree_desc_s {
+    ct_data *dyn_tree;           /* the dynamic tree */
+    int     max_code;            /* largest code with non zero frequency */
+    static_tree_desc *stat_desc; /* the corresponding static tree */
+} FAR tree_desc;
+
+typedef ush Pos;
+typedef Pos FAR Posf;
+typedef unsigned IPos;
+
+/* A Pos is an index in the character window. We use short instead of int to
+ * save space in the various tables. IPos is used only for parameter passing.
+ */
+
+typedef struct internal_state {
+    z_streamp strm;      /* pointer back to this zlib stream */
+    int   status;        /* as the name implies */
+    Bytef *pending_buf;  /* output still pending */
+    ulg   pending_buf_size; /* size of pending_buf */
+    Bytef *pending_out;  /* next pending byte to output to the stream */
+    int   pending;       /* nb of bytes in the pending buffer */
+    int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
+    Byte  method;        /* STORED (for zip only) or DEFLATED */
+    int   last_flush;    /* value of flush param for previous deflate call */
+
+                /* used by deflate.c: */
+
+    uInt  w_size;        /* LZ77 window size (32K by default) */
+    uInt  w_bits;        /* log2(w_size)  (8..16) */
+    uInt  w_mask;        /* w_size - 1 */
+
+    Bytef *window;
+    /* Sliding window. Input bytes are read into the second half of the window,
+     * and move to the first half later to keep a dictionary of at least wSize
+     * bytes. With this organization, matches are limited to a distance of
+     * wSize-MAX_MATCH bytes, but this ensures that IO is always
+     * performed with a length multiple of the block size. Also, it limits
+     * the window size to 64K, which is quite useful on MSDOS.
+     * To do: use the user input buffer as sliding window.
+     */
+
+    ulg window_size;
+    /* Actual size of window: 2*wSize, except when the user input buffer
+     * is directly used as sliding window.
+     */
+
+    Posf *prev;
+    /* Link to older string with same hash index. To limit the size of this
+     * array to 64K, this link is maintained only for the last 32K strings.
+     * An index in this array is thus a window index modulo 32K.
+     */
+
+    Posf *head; /* Heads of the hash chains or NIL. */
+
+    uInt  ins_h;          /* hash index of string to be inserted */
+    uInt  hash_size;      /* number of elements in hash table */
+    uInt  hash_bits;      /* log2(hash_size) */
+    uInt  hash_mask;      /* hash_size-1 */
+
+    uInt  hash_shift;
+    /* Number of bits by which ins_h must be shifted at each input
+     * step. It must be such that after MIN_MATCH steps, the oldest
+     * byte no longer takes part in the hash key, that is:
+     *   hash_shift * MIN_MATCH >= hash_bits
+     */
+
+    long block_start;
+    /* Window position at the beginning of the current output block. Gets
+     * negative when the window is moved backwards.
+     */
+
+    uInt match_length;           /* length of best match */
+    IPos prev_match;             /* previous match */
+    int match_available;         /* set if previous match exists */
+    uInt strstart;               /* start of string to insert */
+    uInt match_start;            /* start of matching string */
+    uInt lookahead;              /* number of valid bytes ahead in window */
+
+    uInt prev_length;
+    /* Length of the best match at previous step. Matches not greater than this
+     * are discarded. This is used in the lazy match evaluation.
+     */
+
+    uInt max_chain_length;
+    /* To speed up deflation, hash chains are never searched beyond this
+     * length.  A higher limit improves compression ratio but degrades the
+     * speed.
+     */
+
+    uInt max_lazy_match;
+    /* Attempt to find a better match only when the current match is strictly
+     * smaller than this value. This mechanism is used only for compression
+     * levels >= 4.
+     */
+#   define max_insert_length  max_lazy_match
+    /* Insert new strings in the hash table only if the match length is not
+     * greater than this length. This saves time but degrades compression.
+     * max_insert_length is used only for compression levels <= 3.
+     */
+
+    int level;    /* compression level (1..9) */
+    int strategy; /* favor or force Huffman coding*/
+
+    uInt good_match;
+    /* Use a faster search when the previous match is longer than this */
+
+    int nice_match; /* Stop searching when current match exceeds this */
+
+                /* used by trees.c: */
+    /* Didn't use ct_data typedef below to supress compiler warning */
+    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
+    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
+    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
+
+    struct tree_desc_s l_desc;               /* desc. for literal tree */
+    struct tree_desc_s d_desc;               /* desc. for distance tree */
+    struct tree_desc_s bl_desc;              /* desc. for bit length tree */
+
+    ush bl_count[MAX_BITS+1];
+    /* number of codes at each bit length for an optimal tree */
+
+    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
+    int heap_len;               /* number of elements in the heap */
+    int heap_max;               /* element of largest frequency */
+    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+     * The same heap array is used to build all trees.
+     */
+
+    uch depth[2*L_CODES+1];
+    /* Depth of each subtree used as tie breaker for trees of equal frequency
+     */
+
+    uchf *l_buf;          /* buffer for literals or lengths */
+
+    uInt  lit_bufsize;
+    /* Size of match buffer for literals/lengths.  There are 4 reasons for
+     * limiting lit_bufsize to 64K:
+     *   - frequencies can be kept in 16 bit counters
+     *   - if compression is not successful for the first block, all input
+     *     data is still in the window so we can still emit a stored block even
+     *     when input comes from standard input.  (This can also be done for
+     *     all blocks if lit_bufsize is not greater than 32K.)
+     *   - if compression is not successful for a file smaller than 64K, we can
+     *     even emit a stored file instead of a stored block (saving 5 bytes).
+     *     This is applicable only for zip (not gzip or zlib).
+     *   - creating new Huffman trees less frequently may not provide fast
+     *     adaptation to changes in the input data statistics. (Take for
+     *     example a binary file with poorly compressible code followed by
+     *     a highly compressible string table.) Smaller buffer sizes give
+     *     fast adaptation but have of course the overhead of transmitting
+     *     trees more frequently.
+     *   - I can't count above 4
+     */
+
+    uInt last_lit;      /* running index in l_buf */
+
+    ushf *d_buf;
+    /* Buffer for distances. To simplify the code, d_buf and l_buf have
+     * the same number of elements. To use different lengths, an extra flag
+     * array would be necessary.
+     */
+
+    ulg opt_len;        /* bit length of current block with optimal trees */
+    ulg static_len;     /* bit length of current block with static trees */
+    uInt matches;       /* number of string matches in current block */
+    int last_eob_len;   /* bit length of EOB code for last block */
+
+#ifdef DEBUG
+    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
+#endif
+
+    ush bi_buf;
+    /* Output buffer. bits are inserted starting at the bottom (least
+     * significant bits).
+     */
+    int bi_valid;
+    /* Number of valid bits in bi_buf.  All bits above the last valid bit
+     * are always zero.
+     */
+
+} FAR deflate_state;
+
+/* Output a byte on the stream.
+ * IN assertion: there is enough room in pending_buf.
+ */
+#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
+
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
+/* In order to simplify the code, particularly on 16 bit machines, match
+ * distances are limited to MAX_DIST instead of WSIZE.
+ */
+
+        /* in trees.c */
+void _tr_init         OF((deflate_state *s));
+int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
+void _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
+                          int eof));
+void _tr_align        OF((deflate_state *s));
+void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
+                          int eof));
+
+#define d_code(dist) \
+   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * used.
+ */
+
+#ifndef DEBUG
+/* Inline versions of _tr_tally for speed: */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+  extern uch _length_code[];
+  extern uch _dist_code[];
+#else
+  extern const uch _length_code[];
+  extern const uch _dist_code[];
+#endif
+
+# define _tr_tally_lit(s, c, flush) \
+  { uch cc = (c); \
+    s->d_buf[s->last_lit] = 0; \
+    s->l_buf[s->last_lit++] = cc; \
+    s->dyn_ltree[cc].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+   }
+# define _tr_tally_dist(s, distance, length, flush) \
+  { uch len = (length); \
+    ush dist = (distance); \
+    s->d_buf[s->last_lit] = dist; \
+    s->l_buf[s->last_lit++] = len; \
+    dist--; \
+    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+    s->dyn_dtree[d_code(dist)].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+  }
+#else
+# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
+# define _tr_tally_dist(s, distance, length, flush) \
+              flush = _tr_tally(s, distance, length)
+#endif
+
+#endif /* DEFLATE_H */
Index: trunk/geant4/visualization/externals/zlib/include/trees.h
===================================================================
--- trunk/geant4/visualization/externals/zlib/include/trees.h	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/include/trees.h	(revision 562)
@@ -0,0 +1,128 @@
+/* header created automatically with -DGEN_TREES_H */
+
+local const ct_data static_ltree[L_CODES+2] = {
+{{ 12},{  8}}, {{140},{  8}}, {{ 76},{  8}}, {{204},{  8}}, {{ 44},{  8}},
+{{172},{  8}}, {{108},{  8}}, {{236},{  8}}, {{ 28},{  8}}, {{156},{  8}},
+{{ 92},{  8}}, {{220},{  8}}, {{ 60},{  8}}, {{188},{  8}}, {{124},{  8}},
+{{252},{  8}}, {{  2},{  8}}, {{130},{  8}}, {{ 66},{  8}}, {{194},{  8}},
+{{ 34},{  8}}, {{162},{  8}}, {{ 98},{  8}}, {{226},{  8}}, {{ 18},{  8}},
+{{146},{  8}}, {{ 82},{  8}}, {{210},{  8}}, {{ 50},{  8}}, {{178},{  8}},
+{{114},{  8}}, {{242},{  8}}, {{ 10},{  8}}, {{138},{  8}}, {{ 74},{  8}},
+{{202},{  8}}, {{ 42},{  8}}, {{170},{  8}}, {{106},{  8}}, {{234},{  8}},
+{{ 26},{  8}}, {{154},{  8}}, {{ 90},{  8}}, {{218},{  8}}, {{ 58},{  8}},
+{{186},{  8}}, {{122},{  8}}, {{250},{  8}}, {{  6},{  8}}, {{134},{  8}},
+{{ 70},{  8}}, {{198},{  8}}, {{ 38},{  8}}, {{166},{  8}}, {{102},{  8}},
+{{230},{  8}}, {{ 22},{  8}}, {{150},{  8}}, {{ 86},{  8}}, {{214},{  8}},
+{{ 54},{  8}}, {{182},{  8}}, {{118},{  8}}, {{246},{  8}}, {{ 14},{  8}},
+{{142},{  8}}, {{ 78},{  8}}, {{206},{  8}}, {{ 46},{  8}}, {{174},{  8}},
+{{110},{  8}}, {{238},{  8}}, {{ 30},{  8}}, {{158},{  8}}, {{ 94},{  8}},
+{{222},{  8}}, {{ 62},{  8}}, {{190},{  8}}, {{126},{  8}}, {{254},{  8}},
+{{  1},{  8}}, {{129},{  8}}, {{ 65},{  8}}, {{193},{  8}}, {{ 33},{  8}},
+{{161},{  8}}, {{ 97},{  8}}, {{225},{  8}}, {{ 17},{  8}}, {{145},{  8}},
+{{ 81},{  8}}, {{209},{  8}}, {{ 49},{  8}}, {{177},{  8}}, {{113},{  8}},
+{{241},{  8}}, {{  9},{  8}}, {{137},{  8}}, {{ 73},{  8}}, {{201},{  8}},
+{{ 41},{  8}}, {{169},{  8}}, {{105},{  8}}, {{233},{  8}}, {{ 25},{  8}},
+{{153},{  8}}, {{ 89},{  8}}, {{217},{  8}}, {{ 57},{  8}}, {{185},{  8}},
+{{121},{  8}}, {{249},{  8}}, {{  5},{  8}}, {{133},{  8}}, {{ 69},{  8}},
+{{197},{  8}}, {{ 37},{  8}}, {{165},{  8}}, {{101},{  8}}, {{229},{  8}},
+{{ 21},{  8}}, {{149},{  8}}, {{ 85},{  8}}, {{213},{  8}}, {{ 53},{  8}},
+{{181},{  8}}, {{117},{  8}}, {{245},{  8}}, {{ 13},{  8}}, {{141},{  8}},
+{{ 77},{  8}}, {{205},{  8}}, {{ 45},{  8}}, {{173},{  8}}, {{109},{  8}},
+{{237},{  8}}, {{ 29},{  8}}, {{157},{  8}}, {{ 93},{  8}}, {{221},{  8}},
+{{ 61},{  8}}, {{189},{  8}}, {{125},{  8}}, {{253},{  8}}, {{ 19},{  9}},
+{{275},{  9}}, {{147},{  9}}, {{403},{  9}}, {{ 83},{  9}}, {{339},{  9}},
+{{211},{  9}}, {{467},{  9}}, {{ 51},{  9}}, {{307},{  9}}, {{179},{  9}},
+{{435},{  9}}, {{115},{  9}}, {{371},{  9}}, {{243},{  9}}, {{499},{  9}},
+{{ 11},{  9}}, {{267},{  9}}, {{139},{  9}}, {{395},{  9}}, {{ 75},{  9}},
+{{331},{  9}}, {{203},{  9}}, {{459},{  9}}, {{ 43},{  9}}, {{299},{  9}},
+{{171},{  9}}, {{427},{  9}}, {{107},{  9}}, {{363},{  9}}, {{235},{  9}},
+{{491},{  9}}, {{ 27},{  9}}, {{283},{  9}}, {{155},{  9}}, {{411},{  9}},
+{{ 91},{  9}}, {{347},{  9}}, {{219},{  9}}, {{475},{  9}}, {{ 59},{  9}},
+{{315},{  9}}, {{187},{  9}}, {{443},{  9}}, {{123},{  9}}, {{379},{  9}},
+{{251},{  9}}, {{507},{  9}}, {{  7},{  9}}, {{263},{  9}}, {{135},{  9}},
+{{391},{  9}}, {{ 71},{  9}}, {{327},{  9}}, {{199},{  9}}, {{455},{  9}},
+{{ 39},{  9}}, {{295},{  9}}, {{167},{  9}}, {{423},{  9}}, {{103},{  9}},
+{{359},{  9}}, {{231},{  9}}, {{487},{  9}}, {{ 23},{  9}}, {{279},{  9}},
+{{151},{  9}}, {{407},{  9}}, {{ 87},{  9}}, {{343},{  9}}, {{215},{  9}},
+{{471},{  9}}, {{ 55},{  9}}, {{311},{  9}}, {{183},{  9}}, {{439},{  9}},
+{{119},{  9}}, {{375},{  9}}, {{247},{  9}}, {{503},{  9}}, {{ 15},{  9}},
+{{271},{  9}}, {{143},{  9}}, {{399},{  9}}, {{ 79},{  9}}, {{335},{  9}},
+{{207},{  9}}, {{463},{  9}}, {{ 47},{  9}}, {{303},{  9}}, {{175},{  9}},
+{{431},{  9}}, {{111},{  9}}, {{367},{  9}}, {{239},{  9}}, {{495},{  9}},
+{{ 31},{  9}}, {{287},{  9}}, {{159},{  9}}, {{415},{  9}}, {{ 95},{  9}},
+{{351},{  9}}, {{223},{  9}}, {{479},{  9}}, {{ 63},{  9}}, {{319},{  9}},
+{{191},{  9}}, {{447},{  9}}, {{127},{  9}}, {{383},{  9}}, {{255},{  9}},
+{{511},{  9}}, {{  0},{  7}}, {{ 64},{  7}}, {{ 32},{  7}}, {{ 96},{  7}},
+{{ 16},{  7}}, {{ 80},{  7}}, {{ 48},{  7}}, {{112},{  7}}, {{  8},{  7}},
+{{ 72},{  7}}, {{ 40},{  7}}, {{104},{  7}}, {{ 24},{  7}}, {{ 88},{  7}},
+{{ 56},{  7}}, {{120},{  7}}, {{  4},{  7}}, {{ 68},{  7}}, {{ 36},{  7}},
+{{100},{  7}}, {{ 20},{  7}}, {{ 84},{  7}}, {{ 52},{  7}}, {{116},{  7}},
+{{  3},{  8}}, {{131},{  8}}, {{ 67},{  8}}, {{195},{  8}}, {{ 35},{  8}},
+{{163},{  8}}, {{ 99},{  8}}, {{227},{  8}}
+};
+
+local const ct_data static_dtree[D_CODES] = {
+{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
+{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
+{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
+{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
+{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
+{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
+};
+
+const uch _dist_code[DIST_CODE_LEN] = {
+ 0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,
+ 8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,
+10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,  0, 16, 17,
+18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
+};
+
+const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
+ 0,  1,  2,  3,  4,  5,  6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 12, 12,
+13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
+17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
+19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
+22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
+};
+
+local const int base_length[LENGTH_CODES] = {
+0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
+64, 80, 96, 112, 128, 160, 192, 224, 0
+};
+
+local const int base_dist[D_CODES] = {
+    0,     1,     2,     3,     4,     6,     8,    12,    16,    24,
+   32,    48,    64,    96,   128,   192,   256,   384,   512,   768,
+ 1024,  1536,  2048,  3072,  4096,  6144,  8192, 12288, 16384, 24576
+};
+
Index: trunk/geant4/visualization/externals/zlib/include/zconf.h
===================================================================
--- trunk/geant4/visualization/externals/zlib/include/zconf.h	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/include/zconf.h	(revision 562)
@@ -0,0 +1,326 @@
+/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-2004 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zconf.h,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#ifndef _ZCONF_H
+#define _ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ */
+#ifdef Z_PREFIX
+#  define deflateInit_          z_deflateInit_
+#  define deflate               z_deflate
+#  define deflateEnd            z_deflateEnd
+#  define inflateInit_          z_inflateInit_
+#  define inflate               z_inflate
+#  define inflateEnd            z_inflateEnd
+#  define deflateInit2_         z_deflateInit2_
+#  define deflateSetDictionary  z_deflateSetDictionary
+#  define deflateCopy           z_deflateCopy
+#  define deflateReset          z_deflateReset
+#  define deflateParams         z_deflateParams
+#  define deflateBound          z_deflateBound
+#  define deflatePrime          z_deflatePrime
+#  define inflateInit2_         z_inflateInit2_
+#  define inflateSetDictionary  z_inflateSetDictionary
+#  define inflateSync           z_inflateSync
+#  define inflateSyncPoint      z_inflateSyncPoint
+#  define inflateCopy           z_inflateCopy
+#  define inflateReset          z_inflateReset
+#  define inflateBack           z_inflateBack
+#  define inflateBackEnd        z_inflateBackEnd
+#  define compress              z_compress
+#  define compress2             z_compress2
+#  define compressBound         z_compressBound
+#  define uncompress            z_uncompress
+#  define adler32               z_adler32
+#  define crc32                 z_crc32
+#  define get_crc_table         z_get_crc_table
+#  define zError               	z_zError
+
+#  define Byte                  z_Byte
+#  define uInt                  z_uInt
+#  define uLong                 z_uLong
+#  define Bytef                 z_Bytef
+#  define charf                 z_charf
+#  define intf                  z_intf
+#  define uIntf                 z_uIntf
+#  define uLongf                z_uLongf
+#  define voidpf                z_voidpf
+#  define voidp                 z_voidp
+#endif
+
+#if defined(__MSDOS__) && !defined(MSDOS)
+#  define MSDOS
+#endif
+#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
+#  define OS2
+#endif
+#if defined(_WINDOWS) && !defined(WINDOWS)
+#  define WINDOWS
+#endif
+#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
+#  define WIN32
+#endif
+#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
+#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
+#    ifndef SYS16BIT
+#      define SYS16BIT
+#    endif
+#  endif
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#ifdef SYS16BIT
+#  define MAXSEG_64K
+#endif
+#ifdef MSDOS
+#  define UNALIGNED_OK
+#endif
+
+#ifdef __STDC_VERSION__
+#  ifndef STDC
+#    define STDC
+#  endif
+#  if __STDC_VERSION__ >= 199901L
+#    ifndef STDC99
+#      define STDC99
+#    endif
+#  endif
+#endif
+#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
+#  define STDC
+#endif
+
+#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
+#  define STDC
+#endif
+
+#ifndef STDC
+#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+#    define const       /* note: need a more gentle solution here */
+#  endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
+#  define NO_DUMMY_DECL
+#endif
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+#  ifdef MAXSEG_64K
+#    define MAX_MEM_LEVEL 8
+#  else
+#    define MAX_MEM_LEVEL 9
+#  endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+#  define MAX_WBITS   15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+            (1 << (windowBits+2)) +  (1 << (memLevel+9))
+ that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+   The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+                        /* Type declarations */
+
+#ifndef OF /* function prototypes */
+#  ifdef STDC
+#    define OF(args)  args
+#  else
+#    define OF(args)  ()
+#  endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#ifdef SYS16BIT
+#  if defined(M_I86SM) || defined(M_I86MM)
+     /* MSC small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef _MSC_VER
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#  if (defined(__SMALL__) || defined(__MEDIUM__))
+     /* Turbo C small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef __BORLANDC__
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#endif
+
+#if defined(WINDOWS) || defined(WIN32)
+   /* If building or using zlib as a DLL, define ZLIB_DLL.
+    * This is not mandatory, but it offers a little performance increase.
+    */
+#  ifdef ZLIB_DLL
+#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
+#      ifdef ZLIB_INTERNAL
+#        define ZEXTERN extern __declspec(dllexport)
+#      else
+#        define ZEXTERN extern __declspec(dllimport)
+#      endif
+#    endif
+#  endif  /* ZLIB_DLL */
+   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
+    * define ZLIB_WINAPI.
+    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
+    */
+#  ifdef ZLIB_WINAPI
+#    ifdef FAR
+#      undef FAR
+#    endif
+#    include <windows.h>
+     /* No need for _export, use ZLIB.DEF instead. */
+     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
+#    define ZEXPORT WINAPI
+#    ifdef WIN32
+#      define ZEXPORTVA WINAPIV
+#    else
+#      define ZEXPORTVA FAR CDECL
+#    endif
+#  endif
+#endif
+
+#if defined (__BEOS__)
+#  ifdef ZLIB_DLL
+#    ifdef ZLIB_INTERNAL
+#      define ZEXPORT   __declspec(dllexport)
+#      define ZEXPORTVA __declspec(dllexport)
+#    else
+#      define ZEXPORT   __declspec(dllimport)
+#      define ZEXPORTVA __declspec(dllimport)
+#    endif
+#  endif
+#endif
+
+#ifndef ZEXTERN
+#  define ZEXTERN extern
+#endif
+#ifndef ZEXPORT
+#  define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+#  define ZEXPORTVA
+#endif
+
+#ifndef FAR
+#  define FAR
+#endif
+
+#if !defined(__MACTYPES__)
+typedef unsigned char  Byte;  /* 8 bits */
+#endif
+typedef unsigned int   uInt;  /* 16 bits or more */
+typedef unsigned long  uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+#  define Bytef Byte FAR
+#else
+   typedef Byte  FAR Bytef;
+#endif
+typedef char  FAR charf;
+typedef int   FAR intf;
+typedef uInt  FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+   typedef void const *voidpc;
+   typedef void FAR   *voidpf;
+   typedef void       *voidp;
+#else
+   typedef Byte const *voidpc;
+   typedef Byte FAR   *voidpf;
+   typedef Byte       *voidp;
+#endif
+
+#if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */
+#  include <sys/types.h> /* for off_t */
+#  include <unistd.h>    /* for SEEK_* and off_t */
+#  ifdef VMS
+#    include <unixio.h>   /* for off_t */
+#  endif
+#  define z_off_t off_t
+#endif
+#ifndef SEEK_SET
+#  define SEEK_SET        0       /* Seek from beginning of file.  */
+#  define SEEK_CUR        1       /* Seek from current position.  */
+#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
+#endif
+#ifndef z_off_t
+#  define z_off_t long
+#endif
+
+#if defined(__OS400__)
+#  define NO_vsnprintf
+#endif
+
+#if defined(__MVS__)
+#  define NO_vsnprintf
+#  ifdef FAR
+#    undef FAR
+#  endif
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+#   pragma map(deflateInit_,"DEIN")
+#   pragma map(deflateInit2_,"DEIN2")
+#   pragma map(deflateEnd,"DEEND")
+#   pragma map(deflateBound,"DEBND")
+#   pragma map(inflateInit_,"ININ")
+#   pragma map(inflateInit2_,"ININ2")
+#   pragma map(inflateEnd,"INEND")
+#   pragma map(inflateSync,"INSY")
+#   pragma map(inflateSetDictionary,"INSEDI")
+#   pragma map(compressBound,"CMBND")
+#   pragma map(inflate_table,"INTABL")
+#   pragma map(inflate_fast,"INFA")
+#   pragma map(inflate_copyright,"INCOPY")
+#endif
+
+#endif /* _ZCONF_H */
Index: trunk/geant4/visualization/externals/zlib/include/zlib.h
===================================================================
--- trunk/geant4/visualization/externals/zlib/include/zlib.h	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/include/zlib.h	(revision 562)
@@ -0,0 +1,1199 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+  version 1.2.2, October 3rd, 2004
+
+  Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup@gzip.org          madler@alumni.caltech.edu
+
+
+  The data format used by the zlib library is described by RFCs (Request for
+  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
+  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef _ZLIB_H
+#define _ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.2.2"
+#define ZLIB_VERNUM 0x1220
+
+/*
+     The 'zlib' compression library provides in-memory compression and
+  decompression functions, including integrity checks of the uncompressed
+  data.  This version of the library supports only one compression method
+  (deflation) but other algorithms will be added later and will have the same
+  stream interface.
+
+     Compression can be done in a single step if the buffers are large
+  enough (for example if an input file is mmap'ed), or can be done by
+  repeated calls of the compression function.  In the latter case, the
+  application must provide more input and/or consume the output
+  (providing more output space) before each call.
+
+     The compressed data format used by default by the in-memory functions is
+  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
+  around a deflate stream, which is itself documented in RFC 1951.
+
+     The library also supports reading and writing files in gzip (.gz) format
+  with an interface similar to that of stdio using the functions that start
+  with "gz".  The gzip format is different from the zlib format.  gzip is a
+  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
+
+     This library can optionally read and write gzip streams in memory as well.
+
+     The zlib format was designed to be compact and fast for use in memory
+  and on communications channels.  The gzip format was designed for single-
+  file compression on file systems, has a larger header than zlib to maintain
+  directory information, and uses a different, slower check method than zlib.
+
+     The library does not install any signal handler. The decoder checks
+  the consistency of the compressed data, so the library should never
+  crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+    Bytef    *next_in;  /* next input byte */
+    uInt     avail_in;  /* number of bytes available at next_in */
+    uLong    total_in;  /* total nb of input bytes read so far */
+
+    Bytef    *next_out; /* next output byte should be put there */
+    uInt     avail_out; /* remaining free space at next_out */
+    uLong    total_out; /* total nb of bytes output so far */
+
+    char     *msg;      /* last error message, NULL if no error */
+    struct internal_state FAR *state; /* not visible by applications */
+
+    alloc_func zalloc;  /* used to allocate the internal state */
+    free_func  zfree;   /* used to free the internal state */
+    voidpf     opaque;  /* private data object passed to zalloc and zfree */
+
+    int     data_type;  /* best guess about the data type: ascii or binary */
+    uLong   adler;      /* adler32 value of the uncompressed data */
+    uLong   reserved;   /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+   The application must update next_in and avail_in when avail_in has
+   dropped to zero. It must update next_out and avail_out when avail_out
+   has dropped to zero. The application must initialize zalloc, zfree and
+   opaque before calling the init function. All other fields are set by the
+   compression library and must not be updated by the application.
+
+   The opaque value provided by the application will be passed as the first
+   parameter for calls of zalloc and zfree. This can be useful for custom
+   memory management. The compression library attaches no meaning to the
+   opaque value.
+
+   zalloc must return Z_NULL if there is not enough memory for the object.
+   If zlib is used in a multi-threaded application, zalloc and zfree must be
+   thread safe.
+
+   On 16-bit systems, the functions zalloc and zfree must be able to allocate
+   exactly 65536 bytes, but will not be required to allocate more than this
+   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+   pointers returned by zalloc for objects of exactly 65536 bytes *must*
+   have their offset normalized to zero. The default allocation function
+   provided by this library ensures this (see zutil.c). To reduce memory
+   requirements and avoid any allocation of 64K objects, at the expense of
+   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+   The fields total_in and total_out can be used for statistics or
+   progress reports. After compression, total_in holds the total size of
+   the uncompressed data and may be saved for use in the decompressor
+   (particularly if the decompressor wants to decompress everything in
+   a single step).
+*/
+
+                        /* constants */
+
+#define Z_NO_FLUSH      0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH    2
+#define Z_FULL_FLUSH    3
+#define Z_FINISH        4
+#define Z_BLOCK         5
+/* Allowed flush values; see deflate() and inflate() below for details */
+
+#define Z_OK            0
+#define Z_STREAM_END    1
+#define Z_NEED_DICT     2
+#define Z_ERRNO        (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR   (-3)
+#define Z_MEM_ERROR    (-4)
+#define Z_BUF_ERROR    (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION         0
+#define Z_BEST_SPEED             1
+#define Z_BEST_COMPRESSION       9
+#define Z_DEFAULT_COMPRESSION  (-1)
+/* compression levels */
+
+#define Z_FILTERED            1
+#define Z_HUFFMAN_ONLY        2
+#define Z_RLE                 3
+#define Z_DEFAULT_STRATEGY    0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY   0
+#define Z_ASCII    1
+#define Z_UNKNOWN  2
+/* Possible values of the data_type field (though see inflate()) */
+
+#define Z_DEFLATED   8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+                        /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+   If the first character differs, the library code actually used is
+   not compatible with the zlib.h header file used by the application.
+   This check is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+     Initializes the internal stream state for compression. The fields
+   zalloc, zfree and opaque must be initialized before by the caller.
+   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+   use default allocation functions.
+
+     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+   1 gives best speed, 9 gives best compression, 0 gives no compression at
+   all (the input data is simply copied a block at a time).
+   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+   compression (currently equivalent to level 6).
+
+     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+   with the version assumed by the caller (ZLIB_VERSION).
+   msg is set to null if there is no error message.  deflateInit does not
+   perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+    deflate compresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may introduce some
+  output latency (reading input without producing any output) except when
+  forced to flush.
+
+    The detailed semantics are as follows. deflate performs one or both of the
+  following actions:
+
+  - Compress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in and avail_in are updated and
+    processing will resume at this point for the next call of deflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly. This action is forced if the parameter flush is non zero.
+    Forcing flush frequently degrades the compression ratio, so this parameter
+    should be set only when necessary (in interactive applications).
+    Some output may be provided even if flush is not set.
+
+  Before the call of deflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating avail_in or avail_out accordingly; avail_out
+  should never be zero before the call. The application can consume the
+  compressed output when it wants, for example when the output buffer is full
+  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+  and with zero avail_out, it must be called again after making room in the
+  output buffer because there might be more output pending.
+
+    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+  flushed to the output buffer and the output is aligned on a byte boundary, so
+  that the decompressor can get all input data available so far. (In particular
+  avail_in is zero after the call if enough output space has been provided
+  before the call.)  Flushing may degrade compression for some compression
+  algorithms and so it should be used only when necessary.
+
+    If flush is set to Z_FULL_FLUSH, all output is flushed as with
+  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+  restart from this point if previous compressed data has been damaged or if
+  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+  the compression.
+
+    If deflate returns with avail_out == 0, this function must be called again
+  with the same value of the flush parameter and more output space (updated
+  avail_out), until the flush is complete (deflate returns with non-zero
+  avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
+  avail_out is greater than six to avoid repeated flush markers due to
+  avail_out == 0 on return.
+
+    If the parameter flush is set to Z_FINISH, pending input is processed,
+  pending output is flushed and deflate returns with Z_STREAM_END if there
+  was enough output space; if deflate returns with Z_OK, this function must be
+  called again with Z_FINISH and more output space (updated avail_out) but no
+  more input data, until it returns with Z_STREAM_END or an error. After
+  deflate has returned Z_STREAM_END, the only possible operations on the
+  stream are deflateReset or deflateEnd.
+
+    Z_FINISH can be used immediately after deflateInit if all the compression
+  is to be done in a single step. In this case, avail_out must be at least
+  the value returned by deflateBound (see below). If deflate does not return
+  Z_STREAM_END, then it must be called again as described above.
+
+    deflate() sets strm->adler to the adler32 checksum of all input read
+  so far (that is, total_in bytes).
+
+    deflate() may update data_type if it can make a good guess about
+  the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
+  binary. This field is only for information purposes and does not affect
+  the compression algorithm in any manner.
+
+    deflate() returns Z_OK if some progress has been made (more input
+  processed or more output produced), Z_STREAM_END if all input has been
+  consumed and all output has been produced (only when flush is set to
+  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+  (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
+  fatal, and deflate() can be called again with more input and more output
+  space to continue compressing.
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+   prematurely (some input or output was discarded). In the error case,
+   msg may be set but then points to a static string (which must not be
+   deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+     Initializes the internal stream state for decompression. The fields
+   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+   value depends on the compression method), inflateInit determines the
+   compression method from the zlib header and allocates all data structures
+   accordingly; otherwise the allocation will be deferred to the first call of
+   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+   use default allocation functions.
+
+     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+   version assumed by the caller.  msg is set to null if there is no error
+   message. inflateInit does not perform any decompression apart from reading
+   the zlib header if present: this will be done by inflate().  (So next_in and
+   avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+    inflate decompresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full. It may introduce
+  some output latency (reading input without producing any output) except when
+  forced to flush.
+
+  The detailed semantics are as follows. inflate performs one or both of the
+  following actions:
+
+  - Decompress more input starting at next_in and update next_in and avail_in
+    accordingly. If not all input can be processed (because there is not
+    enough room in the output buffer), next_in is updated and processing
+    will resume at this point for the next call of inflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly.  inflate() provides as much output as possible, until there
+    is no more input data or no more space in the output buffer (see below
+    about the flush parameter).
+
+  Before the call of inflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming
+  more output, and updating the next_* and avail_* values accordingly.
+  The application can consume the uncompressed output when it wants, for
+  example when the output buffer is full (avail_out == 0), or after each
+  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+  must be called again after making room in the output buffer because there
+  might be more output pending.
+
+    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
+  Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
+  output as possible to the output buffer. Z_BLOCK requests that inflate() stop
+  if and when it get to the next deflate block boundary. When decoding the zlib
+  or gzip format, this will cause inflate() to return immediately after the
+  header and before the first block. When doing a raw inflate, inflate() will
+  go ahead and process the first block, and will return when it gets to the end
+  of that block, or when it runs out of data.
+
+    The Z_BLOCK option assists in appending to or combining deflate streams.
+  Also to assist in this, on return inflate() will set strm->data_type to the
+  number of unused bits in the last byte taken from strm->next_in, plus 64
+  if inflate() is currently decoding the last block in the deflate stream,
+  plus 128 if inflate() returned immediately after decoding an end-of-block
+  code or decoding the complete header up to just before the first byte of the
+  deflate stream. The end-of-block will not be indicated until all of the
+  uncompressed data from that block has been written to strm->next_out.  The
+  number of unused bits may in general be greater than seven, except when
+  bit 7 of data_type is set, in which case the number of unused bits will be
+  less than eight.
+
+    inflate() should normally be called until it returns Z_STREAM_END or an
+  error. However if all decompression is to be performed in a single step
+  (a single call of inflate), the parameter flush should be set to
+  Z_FINISH. In this case all pending input is processed and all pending
+  output is flushed; avail_out must be large enough to hold all the
+  uncompressed data. (The size of the uncompressed data may have been saved
+  by the compressor for this purpose.) The next operation on this stream must
+  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+  is never required, but can be used to inform inflate that a faster approach
+  may be used for the single inflate() call.
+
+     In this implementation, inflate() always flushes as much output as
+  possible to the output buffer, and always uses the faster approach on the
+  first call. So the only effect of the flush parameter in this implementation
+  is on the return value of inflate(), as noted below, or when it returns early
+  because Z_BLOCK is used.
+
+     If a preset dictionary is needed after this call (see inflateSetDictionary
+  below), inflate sets strm->adler to the adler32 checksum of the dictionary
+  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
+  strm->adler to the adler32 checksum of all output produced so far (that is,
+  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
+  below. At the end of the stream, inflate() checks that its computed adler32
+  checksum is equal to that saved by the compressor and returns Z_STREAM_END
+  only if the checksum is correct.
+
+    inflate() will decompress and check either zlib-wrapped or gzip-wrapped
+  deflate data.  The header type is detected automatically.  Any information
+  contained in the gzip header is not retained, so applications that need that
+  information should instead use raw inflate, see inflateInit2() below, or
+  inflateBack() and perform their own processing of the gzip header and
+  trailer.
+
+    inflate() returns Z_OK if some progress has been made (more input processed
+  or more output produced), Z_STREAM_END if the end of the compressed data has
+  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+  corrupted (input stream not conforming to the zlib format or incorrect check
+  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
+  if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
+  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
+  output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
+  inflate() can be called again with more input and more output space to
+  continue decompressing. If Z_DATA_ERROR is returned, the application may then
+  call inflateSync() to look for a good compression block if a partial recovery
+  of the data is desired.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any
+   pending output.
+
+     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+   was inconsistent. In the error case, msg may be set but then points to a
+   static string (which must not be deallocated).
+*/
+
+                        /* Advanced functions */
+
+/*
+    The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+                                     int  level,
+                                     int  method,
+                                     int  windowBits,
+                                     int  memLevel,
+                                     int  strategy));
+
+     This is another version of deflateInit with more compression options. The
+   fields next_in, zalloc, zfree and opaque must be initialized before by
+   the caller.
+
+     The method parameter is the compression method. It must be Z_DEFLATED in
+   this version of the library.
+
+     The windowBits parameter is the base two logarithm of the window size
+   (the size of the history buffer). It should be in the range 8..15 for this
+   version of the library. Larger values of this parameter result in better
+   compression at the expense of memory usage. The default value is 15 if
+   deflateInit is used instead.
+
+     windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
+   determines the window size. deflate() will then generate raw deflate data
+   with no zlib header or trailer, and will not compute an adler32 check value.
+
+     windowBits can also be greater than 15 for optional gzip encoding. Add
+   16 to windowBits to write a simple gzip header and trailer around the
+   compressed data instead of a zlib wrapper. The gzip header will have no
+   file name, no extra data, no comment, no modification time (set to zero),
+   no header crc, and the operating system will be set to 255 (unknown).  If a
+   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
+
+     The memLevel parameter specifies how much memory should be allocated
+   for the internal compression state. memLevel=1 uses minimum memory but
+   is slow and reduces compression ratio; memLevel=9 uses maximum memory
+   for optimal speed. The default value is 8. See zconf.h for total memory
+   usage as a function of windowBits and memLevel.
+
+     The strategy parameter is used to tune the compression algorithm. Use the
+   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
+   string match), or Z_RLE to limit match distances to one (run-length
+   encoding). Filtered data consists mostly of small values with a somewhat
+   random distribution. In this case, the compression algorithm is tuned to
+   compress them better. The effect of Z_FILTERED is to force more Huffman
+   coding and less string matching; it is somewhat intermediate between
+   Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
+   Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
+   parameter only affects the compression ratio but not the correctness of the
+   compressed output even if it is not set appropriately.
+
+      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+   method). msg is set to null if there is no error message.  deflateInit2 does
+   not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the compression dictionary from the given byte sequence
+   without producing any compressed output. This function must be called
+   immediately after deflateInit, deflateInit2 or deflateReset, before any
+   call of deflate. The compressor and decompressor must use exactly the same
+   dictionary (see inflateSetDictionary).
+
+     The dictionary should consist of strings (byte sequences) that are likely
+   to be encountered later in the data to be compressed, with the most commonly
+   used strings preferably put towards the end of the dictionary. Using a
+   dictionary is most useful when the data to be compressed is short and can be
+   predicted with good accuracy; the data can then be compressed better than
+   with the default empty dictionary.
+
+     Depending on the size of the compression data structures selected by
+   deflateInit or deflateInit2, a part of the dictionary may in effect be
+   discarded, for example if the dictionary is larger than the window size in
+   deflate or deflate2. Thus the strings most likely to be useful should be
+   put at the end of the dictionary, not at the front.
+
+     Upon return of this function, strm->adler is set to the adler32 value
+   of the dictionary; the decompressor may later use this value to determine
+   which dictionary has been used by the compressor. (The adler32 value
+   applies to the whole dictionary even if only a subset of the dictionary is
+   actually used by the compressor.) If a raw deflate was requested, then the
+   adler32 value is not computed and strm->adler is not set.
+
+     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent (for example if deflate has already been called for this stream
+   or if the compression method is bsort). deflateSetDictionary does not
+   perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when several compression strategies will be
+   tried, for example when there are several ways of pre-processing the input
+   data with a filter. The streams that will be discarded should then be freed
+   by calling deflateEnd.  Note that deflateCopy duplicates the internal
+   compression state which can be quite large, so this strategy is slow and
+   can consume lots of memory.
+
+     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being NULL). msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to deflateEnd followed by deflateInit,
+   but does not free and reallocate all the internal compression state.
+   The stream will keep the same compression level and any other attributes
+   that may have been set by deflateInit2.
+
+      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+                                      int level,
+                                      int strategy));
+/*
+     Dynamically update the compression level and compression strategy.  The
+   interpretation of level and strategy is as in deflateInit2.  This can be
+   used to switch between compression and straight copy of the input data, or
+   to switch to a different kind of input data requiring a different
+   strategy. If the compression level is changed, the input available so far
+   is compressed with the old level (and may be flushed); the new level will
+   take effect only at the next call of deflate().
+
+     Before the call of deflateParams, the stream state must be set as for
+   a call of deflate(), since the currently available input may have to
+   be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+   if strm->avail_out was zero.
+*/
+
+ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
+                                       uLong sourceLen));
+/*
+     deflateBound() returns an upper bound on the compressed size after
+   deflation of sourceLen bytes.  It must be called after deflateInit()
+   or deflateInit2().  This would be used to allocate an output buffer
+   for deflation in a single pass, and so would be called before deflate().
+*/
+
+ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     deflatePrime() inserts bits in the deflate output stream.  The intent
+  is that this function is used to start off the deflate output with the
+  bits leftover from a previous deflate stream when appending to it.  As such,
+  this function can only be used for raw deflate, and must be used before the
+  first deflate() call after a deflateInit2() or deflateReset().  bits must be
+  less than or equal to 16, and that many of the least significant bits of
+  value will be inserted in the output.
+
+      deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+                                     int  windowBits));
+
+     This is another version of inflateInit with an extra parameter. The
+   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+   before by the caller.
+
+     The windowBits parameter is the base two logarithm of the maximum window
+   size (the size of the history buffer).  It should be in the range 8..15 for
+   this version of the library. The default value is 15 if inflateInit is used
+   instead. windowBits must be greater than or equal to the windowBits value
+   provided to deflateInit2() while compressing, or it must be equal to 15 if
+   deflateInit2() was not used. If a compressed stream with a larger window
+   size is given as input, inflate() will return with the error code
+   Z_DATA_ERROR instead of trying to allocate a larger window.
+
+     windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
+   determines the window size. inflate() will then process raw deflate data,
+   not looking for a zlib or gzip header, not generating a check value, and not
+   looking for any check values for comparison at the end of the stream. This
+   is for use with other formats that use the deflate compressed data format
+   such as zip.  Those formats provide their own check values. If a custom
+   format is developed using the raw deflate format for compressed data, it is
+   recommended that a check value such as an adler32 or a crc32 be applied to
+   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
+   most applications, the zlib format should be used as is. Note that comments
+   above on the use in deflateInit2() applies to the magnitude of windowBits.
+
+     windowBits can also be greater than 15 for optional gzip decoding. Add
+   32 to windowBits to enable zlib and gzip decoding with automatic header
+   detection, or add 16 to decode only the gzip format (the zlib format will
+   return a Z_DATA_ERROR.  If a gzip stream is being decoded, strm->adler is
+   a crc32 instead of an adler32.
+
+     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
+   memLevel). msg is set to null if there is no error message.  inflateInit2
+   does not perform any decompression apart from reading the zlib header if
+   present: this will be done by inflate(). (So next_in and avail_in may be
+   modified, but next_out and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the decompression dictionary from the given uncompressed byte
+   sequence. This function must be called immediately after a call of inflate
+   if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
+   can be determined from the adler32 value returned by this call of
+   inflate. The compressor and decompressor must use exactly the same
+   dictionary (see deflateSetDictionary).
+
+     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+   parameter is invalid (such as NULL dictionary) or the stream state is
+   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+   expected one (incorrect adler32 value). inflateSetDictionary does not
+   perform any decompression: this will be done by subsequent calls of
+   inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+    Skips invalid compressed data until a full flush point (see above the
+  description of deflate with Z_FULL_FLUSH) can be found, or until all
+  available input is skipped. No output is provided.
+
+    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+  case, the application may save the current current value of total_in which
+  indicates where valid compressed data was found. In the error case, the
+  application may repeatedly call inflateSync, providing more input each time,
+  until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when randomly accessing a large stream.  The
+   first pass through the stream can periodically record the inflate state,
+   allowing restarting inflate at those points when randomly accessing the
+   stream.
+
+     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being NULL). msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to inflateEnd followed by inflateInit,
+   but does not free and reallocate all the internal decompression state.
+   The stream will keep attributes that may have been set by inflateInit2.
+
+      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits,
+                                        unsigned char FAR *window));
+
+     Initialize the internal stream state for decompression using inflateBack()
+   calls.  The fields zalloc, zfree and opaque in strm must be initialized
+   before the call.  If zalloc and zfree are Z_NULL, then the default library-
+   derived memory allocation routines are used.  windowBits is the base two
+   logarithm of the window size, in the range 8..15.  window is a caller
+   supplied buffer of that size.  Except for special applications where it is
+   assured that deflate was used with small window sizes, windowBits must be 15
+   and a 32K byte window must be supplied to be able to decompress general
+   deflate streams.
+
+     See inflateBack() for the usage of these routines.
+
+     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
+   the paramaters are invalid, Z_MEM_ERROR if the internal state could not
+   be allocated, or Z_VERSION_ERROR if the version of the library does not
+   match the version of the header file.
+*/
+
+typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
+typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+
+ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
+                                    in_func in, void FAR *in_desc,
+                                    out_func out, void FAR *out_desc));
+/*
+     inflateBack() does a raw inflate with a single call using a call-back
+   interface for input and output.  This is more efficient than inflate() for
+   file i/o applications in that it avoids copying between the output and the
+   sliding window by simply making the window itself the output buffer.  This
+   function trusts the application to not change the output buffer passed by
+   the output function, at least until inflateBack() returns.
+
+     inflateBackInit() must be called first to allocate the internal state
+   and to initialize the state with the user-provided window buffer.
+   inflateBack() may then be used multiple times to inflate a complete, raw
+   deflate stream with each call.  inflateBackEnd() is then called to free
+   the allocated state.
+
+     A raw deflate stream is one with no zlib or gzip header or trailer.
+   This routine would normally be used in a utility that reads zip or gzip
+   files and writes out uncompressed files.  The utility would decode the
+   header and process the trailer on its own, hence this routine expects
+   only the raw deflate stream to decompress.  This is different from the
+   normal behavior of inflate(), which expects either a zlib or gzip header and
+   trailer around the deflate stream.
+
+     inflateBack() uses two subroutines supplied by the caller that are then
+   called by inflateBack() for input and output.  inflateBack() calls those
+   routines until it reads a complete deflate stream and writes out all of the
+   uncompressed data, or until it encounters an error.  The function's
+   parameters and return types are defined above in the in_func and out_func
+   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
+   number of bytes of provided input, and a pointer to that input in buf.  If
+   there is no input available, in() must return zero--buf is ignored in that
+   case--and inflateBack() will return a buffer error.  inflateBack() will call
+   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
+   should return zero on success, or non-zero on failure.  If out() returns
+   non-zero, inflateBack() will return with an error.  Neither in() nor out()
+   are permitted to change the contents of the window provided to
+   inflateBackInit(), which is also the buffer that out() uses to write from.
+   The length written by out() will be at most the window size.  Any non-zero
+   amount of input may be provided by in().
+
+     For convenience, inflateBack() can be provided input on the first call by
+   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
+   in() will be called.  Therefore strm->next_in must be initialized before
+   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
+   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
+   must also be initialized, and then if strm->avail_in is not zero, input will
+   initially be taken from strm->next_in[0 .. strm->avail_in - 1].
+
+     The in_desc and out_desc parameters of inflateBack() is passed as the
+   first parameter of in() and out() respectively when they are called.  These
+   descriptors can be optionally used to pass any information that the caller-
+   supplied in() and out() functions need to do their job.
+
+     On return, inflateBack() will set strm->next_in and strm->avail_in to
+   pass back any unused input that was provided by the last in() call.  The
+   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
+   if in() or out() returned an error, Z_DATA_ERROR if there was a format
+   error in the deflate stream (in which case strm->msg is set to indicate the
+   nature of the error), or Z_STREAM_ERROR if the stream was not properly
+   initialized.  In the case of Z_BUF_ERROR, an input or output error can be
+   distinguished using strm->next_in which will be Z_NULL only if in() returned
+   an error.  If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
+   out() returning non-zero.  (in() will always be called before out(), so
+   strm->next_in is assured to be defined if out() returns non-zero.)  Note
+   that inflateBack() cannot return Z_OK.
+*/
+
+ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm));
+/*
+     All memory allocated by inflateBackInit() is freed.
+
+     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
+   state was inconsistent.
+*/
+
+ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+/* Return flags indicating compile-time options.
+
+    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
+     1.0: size of uInt
+     3.2: size of uLong
+     5.4: size of voidpf (pointer)
+     7.6: size of z_off_t
+
+    Compiler, assembler, and debug options:
+     8: DEBUG
+     9: ASMV or ASMINF -- use ASM code
+     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
+     11: 0 (reserved)
+
+    One-time table building (smaller code, but not thread-safe if true):
+     12: BUILDFIXED -- build static block decoding tables when needed
+     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
+     14,15: 0 (reserved)
+
+    Library content (indicates missing functionality):
+     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
+                          deflate code when not needed)
+     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
+                    and decode gzip streams (to avoid linking crc code)
+     18-19: 0 (reserved)
+
+    Operation variations (changes in library functionality):
+     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
+     21: FASTEST -- deflate algorithm with only one, lowest compression level
+     22,23: 0 (reserved)
+
+    The sprintf variant used by gzprintf (zero is best):
+     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
+     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
+     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
+
+    Remainder:
+     27-31: 0 (reserved)
+ */
+
+
+                        /* utility functions */
+
+/*
+     The following utility functions are implemented on top of the
+   basic stream-oriented functions. To simplify the interface, some
+   default options are assumed (compression level and memory usage,
+   standard memory allocation functions). The source code of these
+   utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
+                                 const Bytef *source, uLong sourceLen));
+/*
+     Compresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be at least the value returned
+   by compressBound(sourceLen). Upon exit, destLen is the actual size of the
+   compressed buffer.
+     This function can be used to compress a whole file at once if the
+   input file is mmap'ed.
+     compress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
+                                  const Bytef *source, uLong sourceLen,
+                                  int level));
+/*
+     Compresses the source buffer into the destination buffer. The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer. Upon entry, destLen is the total size of the
+   destination buffer, which must be at least the value returned by
+   compressBound(sourceLen). Upon exit, destLen is the actual size of the
+   compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+/*
+     compressBound() returns an upper bound on the compressed size after
+   compress() or compress2() on sourceLen bytes.  It would be used before
+   a compress() or compress2() call to allocate the destination buffer.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
+                                   const Bytef *source, uLong sourceLen));
+/*
+     Decompresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer. Upon entry, destLen is the total
+   size of the destination buffer, which must be large enough to hold the
+   entire uncompressed data. (The size of the uncompressed data must have
+   been saved previously by the compressor and transmitted to the decompressor
+   by some mechanism outside the scope of this compression library.)
+   Upon exit, destLen is the actual size of the compressed buffer.
+     This function can be used to decompress a whole file at once if the
+   input file is mmap'ed.
+
+     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
+*/
+
+
+typedef voidp gzFile;
+
+ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
+/*
+     Opens a gzip (.gz) file for reading or writing. The mode parameter
+   is as in fopen ("rb" or "wb") but can also include a compression level
+   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+   Huffman only compression as in "wb1h", or 'R' for run-length encoding
+   as in "wb1R". (See the description of deflateInit2 for more information
+   about the strategy parameter.)
+
+     gzopen can be used to read a file which is not in gzip format; in this
+   case gzread will directly read from the file without decompression.
+
+     gzopen returns NULL if the file could not be opened or if there was
+   insufficient memory to allocate the (de)compression state; errno
+   can be checked to distinguish the two cases (if errno is zero, the
+   zlib error is Z_MEM_ERROR).  */
+
+ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
+/*
+     gzdopen() associates a gzFile with the file descriptor fd.  File
+   descriptors are obtained from calls like open, dup, creat, pipe or
+   fileno (in the file has been previously opened with fopen).
+   The mode parameter is as in gzopen.
+     The next call of gzclose on the returned gzFile will also close the
+   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+     gzdopen returns NULL if there was insufficient memory to allocate
+   the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+     Dynamically update the compression level or strategy. See the description
+   of deflateInit2 for the meaning of these parameters.
+     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+   opened for writing.
+*/
+
+ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
+/*
+     Reads the given number of uncompressed bytes from the compressed file.
+   If the input file was not in gzip format, gzread copies the given number
+   of bytes into the buffer.
+     gzread returns the number of uncompressed bytes actually read (0 for
+   end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT    gzwrite OF((gzFile file,
+                                   voidpc buf, unsigned len));
+/*
+     Writes the given number of uncompressed bytes into the compressed file.
+   gzwrite returns the number of uncompressed bytes actually written
+   (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
+/*
+     Converts, formats, and writes the args to the compressed file under
+   control of the format string, as in fprintf. gzprintf returns the number of
+   uncompressed bytes actually written (0 in case of error).  The number of
+   uncompressed bytes written is limited to 4095. The caller should assure that
+   this limit is not exceeded. If it is exceeded, then gzprintf() will return
+   return an error (0) with nothing written. In this case, there may also be a
+   buffer overflow with unpredictable consequences, which is possible only if
+   zlib was compiled with the insecure functions sprintf() or vsprintf()
+   because the secure snprintf() or vsnprintf() functions were not available.
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+      Writes the given null-terminated string to the compressed file, excluding
+   the terminating null character.
+      gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+      Reads bytes from the compressed file until len-1 characters are read, or
+   a newline character is read and transferred to buf, or an end-of-file
+   condition is encountered.  The string is then terminated with a null
+   character.
+      gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
+/*
+      Writes c, converted to an unsigned char, into the compressed file.
+   gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
+/*
+      Reads one byte from the compressed file. gzgetc returns this byte
+   or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT    gzungetc OF((int c, gzFile file));
+/*
+      Push one character back onto the stream to be read again later.
+   Only one character of push-back is allowed.  gzungetc() returns the
+   character pushed, or -1 on failure.  gzungetc() will fail if a
+   character has been pushed but not read yet, or if c is -1. The pushed
+   character will be discarded if the stream is repositioned with gzseek()
+   or gzrewind().
+*/
+
+ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
+/*
+     Flushes all pending output into the compressed file. The parameter
+   flush is as in the deflate() function. The return value is the zlib
+   error number (see function gzerror below). gzflush returns Z_OK if
+   the flush parameter is Z_FINISH and all output could be flushed.
+     gzflush should be called only when strictly necessary because it can
+   degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
+                                      z_off_t offset, int whence));
+/*
+      Sets the starting position for the next gzread or gzwrite on the
+   given compressed file. The offset represents a number of bytes in the
+   uncompressed data stream. The whence parameter is defined as in lseek(2);
+   the value SEEK_END is not supported.
+     If the file is opened for reading, this function is emulated but can be
+   extremely slow. If the file is opened for writing, only forward seeks are
+   supported; gzseek then compresses a sequence of zeroes up to the new
+   starting position.
+
+      gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error, in
+   particular if the file is opened for writing and the new starting position
+   would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
+/*
+     Rewinds the given file. This function is supported only for reading.
+
+   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
+/*
+     Returns the starting position for the next gzread or gzwrite on the
+   given compressed file. This position represents a number of bytes in the
+   uncompressed data stream.
+
+   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+     Returns 1 when EOF has previously been detected reading the given
+   input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
+/*
+     Flushes all pending output if necessary, closes the compressed file
+   and deallocates all the (de)compression state. The return value is the zlib
+   error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+     Returns the error message for the last error which occurred on the
+   given compressed file. errnum is set to zlib error number. If an
+   error occurred in the file system and not in the compression library,
+   errnum is set to Z_ERRNO and the application may consult errno
+   to get the exact error code.
+*/
+
+ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+/*
+     Clears the error and end-of-file flags for file. This is analogous to the
+   clearerr() function in stdio. This is useful for continuing to read a gzip
+   file that is being written concurrently.
+*/
+
+                        /* checksum functions */
+
+/*
+     These functions are not related to compression but are exported
+   anyway because they might be useful in applications using the
+   compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+
+/*
+     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+   return the updated checksum. If buf is NULL, this function returns
+   the required initial value for the checksum.
+   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+   much faster. Usage example:
+
+     uLong adler = adler32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       adler = adler32(adler, buffer, length);
+     }
+     if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
+/*
+     Update a running crc with the bytes buf[0..len-1] and return the updated
+   crc. If buf is NULL, this function returns the required initial value
+   for the crc. Pre- and post-conditioning (one's complement) is performed
+   within this function so it shouldn't be done by the application.
+   Usage example:
+
+     uLong crc = crc32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       crc = crc32(crc, buffer, length);
+     }
+     if (crc != original_crc) error();
+*/
+
+
+                        /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
+                                      int windowBits, int memLevel,
+                                      int strategy, const char *version,
+                                      int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
+                                      const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits,
+                                         unsigned char FAR *window,
+                                         const char *version,
+                                         int stream_size));
+#define deflateInit(strm, level) \
+        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+#define inflateBackInit(strm, windowBits, window) \
+        inflateBackInit_((strm), (windowBits), (window), \
+        ZLIB_VERSION, sizeof(z_stream))
+
+#if !defined(_ZUTIL_H) && !defined(NO_DUMMY_DECL)
+    struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char   * ZEXPORT zError           OF((int));
+ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZLIB_H */
Index: trunk/geant4/visualization/externals/zlib/include/zutil.h
===================================================================
--- trunk/geant4/visualization/externals/zlib/include/zutil.h	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/include/zutil.h	(revision 562)
@@ -0,0 +1,263 @@
+/* zutil.h -- internal interface and configuration of the compression library
+ * Copyright (C) 1995-2003 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: zutil.h,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#ifndef _ZUTIL_H
+#define _ZUTIL_H
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+#ifdef STDC
+#  include <stddef.h>
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+    extern int errno;
+#else
+#   include <errno.h>
+#endif
+
+#ifndef local
+#  define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+typedef unsigned char  uch;
+typedef uch FAR uchf;
+typedef unsigned short ush;
+typedef ush FAR ushf;
+typedef unsigned long  ulg;
+
+extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+/* (size given to avoid silly warnings with Visual C++) */
+
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+
+#define ERR_RETURN(strm,err) \
+  return (strm->msg = (char*)ERR_MSG(err), (err))
+/* To be used only when the state is known to be valid */
+
+        /* common constants */
+
+#ifndef DEF_WBITS
+#  define DEF_WBITS MAX_WBITS
+#endif
+/* default windowBits for decompression. MAX_WBITS is for compression only */
+
+#if MAX_MEM_LEVEL >= 8
+#  define DEF_MEM_LEVEL 8
+#else
+#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
+#endif
+/* default memLevel */
+
+#define STORED_BLOCK 0
+#define STATIC_TREES 1
+#define DYN_TREES    2
+/* The three kinds of block type */
+
+#define MIN_MATCH  3
+#define MAX_MATCH  258
+/* The minimum and maximum match lengths */
+
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+
+        /* target dependencies */
+
+#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
+#  define OS_CODE  0x00
+#  if defined(__TURBOC__) || defined(__BORLANDC__)
+#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+       /* Allow compilation with ANSI keywords only enabled */
+       void _Cdecl farfree( void *block );
+       void *_Cdecl farmalloc( unsigned long nbytes );
+#    else
+#      include <alloc.h>
+#    endif
+#  else /* MSC or DJGPP */
+#    include <malloc.h>
+#  endif
+#endif
+
+#ifdef AMIGA
+#  define OS_CODE  0x01
+#endif
+
+#if defined(VAXC) || defined(VMS)
+#  define OS_CODE  0x02
+#  define F_OPEN(name, mode) \
+     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+#endif
+
+#if defined(ATARI) || defined(atarist)
+#  define OS_CODE  0x05
+#endif
+
+#ifdef OS2
+#  define OS_CODE  0x06
+#endif
+
+#if defined(MACOS) || defined(TARGET_OS_MAC)
+#  define OS_CODE  0x07
+#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+#    include <unix.h> /* for fdopen */
+#  else
+#    ifndef fdopen
+#      define fdopen(fd,mode) NULL /* No fdopen() */
+#    endif
+#  endif
+#endif
+
+#ifdef TOPS20
+#  define OS_CODE  0x0a
+#endif
+
+#ifdef WIN32
+#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
+#    define OS_CODE  0x0b
+#  endif
+#endif
+
+#ifdef __50SERIES /* Prime/PRIMOS */
+#  define OS_CODE  0x0f
+#endif
+
+#if defined(_BEOS_) || defined(RISCOS)
+#  define fdopen(fd,mode) NULL /* No fdopen() */
+#endif
+
+#if (defined(_MSC_VER) && (_MSC_VER > 600))
+#  if defined(_WIN32_WCE)
+#    define fdopen(fd,mode) NULL /* No fdopen() */
+#    ifndef _PTRDIFF_T_DEFINED
+       typedef int ptrdiff_t;
+#      define _PTRDIFF_T_DEFINED
+#    endif
+#  else
+#    define fdopen(fd,type)  _fdopen(fd,type)
+#  endif
+#endif
+
+        /* common defaults */
+
+#ifndef OS_CODE
+#  define OS_CODE  0x03  /* assume Unix */
+#endif
+
+#ifndef F_OPEN
+#  define F_OPEN(name, mode) fopen((name), (mode))
+#endif
+
+         /* functions */
+
+#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
+#  ifndef HAVE_VSNPRINTF
+#    define HAVE_VSNPRINTF
+#  endif
+#endif
+#if defined(__CYGWIN__)
+#  ifndef HAVE_VSNPRINTF
+#    define HAVE_VSNPRINTF
+#  endif
+#endif
+#ifndef HAVE_VSNPRINTF
+#  ifdef MSDOS
+     /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
+        but for now we just assume it doesn't. */
+#    define NO_vsnprintf
+#  endif
+#  ifdef __TURBOC__
+#    define NO_vsnprintf
+#  endif
+#  ifdef WIN32
+     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
+#    if !defined(vsnprintf) && !defined(NO_vsnprintf)
+#      define vsnprintf _vsnprintf
+#    endif
+#  endif
+#  ifdef __SASC
+#    define NO_vsnprintf
+#  endif
+#endif
+#ifdef VMS
+#  define NO_vsnprintf
+#endif
+
+#ifdef HAVE_STRERROR
+#  ifndef VMS
+     extern char *strerror OF((int));
+#  endif
+#  define zstrerror(errnum) strerror(errnum)
+#else
+#  define zstrerror(errnum) ""
+#endif
+
+#if defined(pyr)
+#  define NO_MEMCPY
+#endif
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
+ /* Use our own functions for small and medium model with MSC <= 5.0.
+  * You may have to use the same strategy for Borland C (untested).
+  * The __SC__ check is for Symantec.
+  */
+#  define NO_MEMCPY
+#endif
+#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
+#  define HAVE_MEMCPY
+#endif
+#ifdef HAVE_MEMCPY
+#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
+#    define zmemcpy _fmemcpy
+#    define zmemcmp _fmemcmp
+#    define zmemzero(dest, len) _fmemset(dest, 0, len)
+#  else
+#    define zmemcpy memcpy
+#    define zmemcmp memcmp
+#    define zmemzero(dest, len) memset(dest, 0, len)
+#  endif
+#else
+   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
+   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
+   extern void zmemzero OF((Bytef* dest, uInt len));
+#endif
+
+/* Diagnostic functions */
+#ifdef DEBUG
+#  include <stdio.h>
+   extern int z_verbose;
+   extern void z_error    OF((char *m));
+#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
+#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
+#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+#else
+#  define Assert(cond,msg)
+#  define Trace(x)
+#  define Tracev(x)
+#  define Tracevv(x)
+#  define Tracec(c,x)
+#  define Tracecv(c,x)
+#endif
+
+
+voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+void   zcfree  OF((voidpf opaque, voidpf ptr));
+
+#define ZALLOC(strm, items, size) \
+           (*((strm)->zalloc))((strm)->opaque, (items), (size))
+#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
+#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+
+#endif /* _ZUTIL_H */
Index: trunk/geant4/visualization/externals/zlib/src/adler32.cc
===================================================================
--- trunk/geant4/visualization/externals/zlib/src/adler32.cc	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/src/adler32.cc	(revision 562)
@@ -0,0 +1,71 @@
+/* adler32.c -- compute the Adler-32 checksum of a data stream
+ * Copyright (C) 1995-2003 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: adler32.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+#define BASE 65521UL    /* largest prime smaller than 65536 */
+#define NMAX 5552
+/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
+
+#define DO1(buf,i)  {s1 += buf[i]; s2 += s1;}
+#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
+#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
+#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
+#define DO16(buf)   DO8(buf,0); DO8(buf,8);
+
+#ifdef NO_DIVIDE
+#  define MOD(a) \
+    do { \
+        if (a >= (BASE << 16)) a -= (BASE << 16); \
+        if (a >= (BASE << 15)) a -= (BASE << 15); \
+        if (a >= (BASE << 14)) a -= (BASE << 14); \
+        if (a >= (BASE << 13)) a -= (BASE << 13); \
+        if (a >= (BASE << 12)) a -= (BASE << 12); \
+        if (a >= (BASE << 11)) a -= (BASE << 11); \
+        if (a >= (BASE << 10)) a -= (BASE << 10); \
+        if (a >= (BASE << 9)) a -= (BASE << 9); \
+        if (a >= (BASE << 8)) a -= (BASE << 8); \
+        if (a >= (BASE << 7)) a -= (BASE << 7); \
+        if (a >= (BASE << 6)) a -= (BASE << 6); \
+        if (a >= (BASE << 5)) a -= (BASE << 5); \
+        if (a >= (BASE << 4)) a -= (BASE << 4); \
+        if (a >= (BASE << 3)) a -= (BASE << 3); \
+        if (a >= (BASE << 2)) a -= (BASE << 2); \
+        if (a >= (BASE << 1)) a -= (BASE << 1); \
+        if (a >= BASE) a -= BASE; \
+    } while (0)
+#else
+#  define MOD(a) a %= BASE
+#endif
+
+/* ========================================================================= */
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
+{
+    unsigned long s1 = adler & 0xffff;
+    unsigned long s2 = (adler >> 16) & 0xffff;
+    int k;
+
+    if (buf == Z_NULL) return 1L;
+
+    while (len > 0) {
+        k = len < NMAX ? (int)len : NMAX;
+        len -= k;
+        while (k >= 16) {
+            DO16(buf);
+            buf += 16;
+            k -= 16;
+        }
+        if (k != 0) do {
+            s1 += *buf++;
+            s2 += s1;
+        } while (--k);
+        MOD(s1);
+        MOD(s2);
+    }
+    return (s2 << 16) | s1;
+}
Index: trunk/geant4/visualization/externals/zlib/src/compress.cc
===================================================================
--- trunk/geant4/visualization/externals/zlib/src/compress.cc	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/src/compress.cc	(revision 562)
@@ -0,0 +1,69 @@
+/* compress.c -- compress a memory buffer
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: compress.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+/* ===========================================================================
+     Compresses the source buffer into the destination buffer. The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer. Upon entry, destLen is the total size of the
+   destination buffer, which must be at least 0.1% larger than sourceLen plus
+   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+int ZEXPORT compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
+{
+    z_stream stream;
+    int err;
+
+    stream.next_in = (Bytef*)source;
+    stream.avail_in = (uInt)sourceLen;
+#ifdef MAXSEG_64K
+    /* Check for source > 64K on 16-bit machine: */
+    if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+#endif
+    stream.next_out = dest;
+    stream.avail_out = (uInt)*destLen;
+    if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+    stream.zalloc = (alloc_func)0;
+    stream.zfree = (free_func)0;
+    stream.opaque = (voidpf)0;
+
+    err = deflateInit(&stream, level);
+    if (err != Z_OK) return err;
+
+    err = deflate(&stream, Z_FINISH);
+    if (err != Z_STREAM_END) {
+        deflateEnd(&stream);
+        return err == Z_OK ? Z_BUF_ERROR : err;
+    }
+    *destLen = stream.total_out;
+
+    err = deflateEnd(&stream);
+    return err;
+}
+
+/* ===========================================================================
+ */
+int ZEXPORT compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
+{
+    return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
+}
+
+/* ===========================================================================
+     If the default memLevel or windowBits for deflateInit() is changed, then
+   this function needs to be updated.
+ */
+uLong ZEXPORT compressBound (uLong sourceLen)
+{
+    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
+}
Index: trunk/geant4/visualization/externals/zlib/src/crc32.cc
===================================================================
--- trunk/geant4/visualization/externals/zlib/src/crc32.cc	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/src/crc32.cc	(revision 562)
@@ -0,0 +1,322 @@
+/* crc32.c -- compute the CRC-32 of a data stream
+ * Copyright (C) 1995-2003 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
+ * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
+ * tables for updating the shift register in one step with three exclusive-ors
+ * instead of four steps with four exclusive-ors.  This results about a factor
+ * of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
+ */
+
+/* @(#) $Id: crc32.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+/*
+  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
+  protection on the static variables used to control the first-use generation
+  of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
+  first call get_crc_table() to initialize the tables before allowing more than
+  one thread to use crc32().
+ */
+
+#ifdef MAKECRCH
+#  include <stdio.h>
+#  ifndef DYNAMIC_CRC_TABLE
+#    define DYNAMIC_CRC_TABLE
+#  endif /* !DYNAMIC_CRC_TABLE */
+#endif /* MAKECRCH */
+
+#include "zutil.h"      /* for STDC and FAR definitions */
+
+#define local static
+
+/* Find a four-byte integer type for crc32_little() and crc32_big(). */
+#ifndef NOBYFOUR
+#  ifdef STDC           /* need ANSI C limits.h to determine sizes */
+#    include <limits.h>
+#    define BYFOUR
+#    if (UINT_MAX == 0xffffffffUL)
+       typedef unsigned int u4;
+#    else
+#      if (ULONG_MAX == 0xffffffffUL)
+         typedef unsigned long u4;
+#      else
+#        if (USHRT_MAX == 0xffffffffUL)
+           typedef unsigned short u4;
+#        else
+#          undef BYFOUR     /* can't find a four-byte integer type! */
+#        endif
+#      endif
+#    endif
+#  endif /* STDC */
+#endif /* !NOBYFOUR */
+
+/* Definitions for doing the crc four data bytes at a time. */
+#ifdef BYFOUR
+#  define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
+                (((w)&0xff00)<<8)+(((w)&0xff)<<24))
+   local unsigned long crc32_little OF((unsigned long,
+                        const unsigned char FAR *, unsigned));
+   local unsigned long crc32_big OF((unsigned long,
+                        const unsigned char FAR *, unsigned));
+#  define TBLS 8
+#else
+#  define TBLS 1
+#endif /* BYFOUR */
+
+#ifdef DYNAMIC_CRC_TABLE
+
+local volatile int crc_table_empty = 1;
+local unsigned long FAR crc_table[TBLS][256];
+local void make_crc_table OF((void));
+#ifdef MAKECRCH
+   local void write_table OF((FILE *, const unsigned long FAR *));
+#endif /* MAKECRCH */
+
+/*
+  Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
+  x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
+
+  Polynomials over GF(2) are represented in binary, one bit per coefficient,
+  with the lowest powers in the most significant bit.  Then adding polynomials
+  is just exclusive-or, and multiplying a polynomial by x is a right shift by
+  one.  If we call the above polynomial p, and represent a byte as the
+  polynomial q, also with the lowest power in the most significant bit (so the
+  byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
+  where a mod b means the remainder after dividing a by b.
+
+  This calculation is done using the shift-register method of multiplying and
+  taking the remainder.  The register is initialized to zero, and for each
+  incoming bit, x^32 is added mod p to the register if the bit is a one (where
+  x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
+  x (which is shifting right by one and adding x^32 mod p if the bit shifted
+  out is a one).  We start with the highest power (least significant bit) of
+  q and repeat for all eight bits of q.
+
+  The first table is simply the CRC of all possible eight bit values.  This is
+  all the information needed to generate CRCs on data a byte at a time for all
+  combinations of CRC register values and incoming bytes.  The remaining tables
+  allow for word-at-a-time CRC calculation for both big-endian and little-
+  endian machines, where a word is four bytes.
+*/
+local void make_crc_table()
+{
+    unsigned long c;
+    int n, k;
+    unsigned long poly;                 /* polynomial exclusive-or pattern */
+    /* terms of polynomial defining this crc (except x^32): */
+    static volatile int first = 1;      /* flag to limit concurrent making */
+    static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
+
+    /* See if another task is already doing this (not thread-safe, but better
+       than nothing -- significantly reduces duration of vulnerability in
+       case the advice about DYNAMIC_CRC_TABLE is ignored) */
+    if (first) {
+        first = 0;
+
+        /* make exclusive-or pattern from polynomial (0xedb88320UL) */
+        poly = 0UL;
+        for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
+            poly |= 1UL << (31 - p[n]);
+
+        /* generate a crc for every 8-bit value */
+        for (n = 0; n < 256; n++) {
+            c = (unsigned long)n;
+            for (k = 0; k < 8; k++)
+                c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+            crc_table[0][n] = c;
+        }
+
+#ifdef BYFOUR
+        /* generate crc for each value followed by one, two, and three zeros,
+           and then the byte reversal of those as well as the first table */
+        for (n = 0; n < 256; n++) {
+            c = crc_table[0][n];
+            crc_table[4][n] = REV(c);
+            for (k = 1; k < 4; k++) {
+                c = crc_table[0][c & 0xff] ^ (c >> 8);
+                crc_table[k][n] = c;
+                crc_table[k + 4][n] = REV(c);
+            }
+        }
+#endif /* BYFOUR */
+
+        crc_table_empty = 0;
+    }
+    else {      /* not first */
+        /* wait for the other guy to finish (not efficient, but rare) */
+        while (crc_table_empty)
+            ;
+    }
+
+#ifdef MAKECRCH
+    /* write out CRC tables to crc32.h */
+    {
+        FILE *out;
+
+        out = fopen("crc32.h", "w");
+        if (out == NULL) return;
+        fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
+        fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
+        fprintf(out, "local const unsigned long FAR ");
+        fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
+        write_table(out, crc_table[0]);
+#  ifdef BYFOUR
+        fprintf(out, "#ifdef BYFOUR\n");
+        for (k = 1; k < 8; k++) {
+            fprintf(out, "  },\n  {\n");
+            write_table(out, crc_table[k]);
+        }
+        fprintf(out, "#endif\n");
+#  endif /* BYFOUR */
+        fprintf(out, "  }\n};\n");
+        fclose(out);
+    }
+#endif /* MAKECRCH */
+}
+
+#ifdef MAKECRCH
+local void write_table(FILE *out, const unsigned long FAR *table)
+{
+    int n;
+
+    for (n = 0; n < 256; n++)
+        fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : "    ", table[n],
+                n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
+}
+#endif /* MAKECRCH */
+
+#else /* !DYNAMIC_CRC_TABLE */
+/* ========================================================================
+ * Tables of CRC-32s of all single-byte values, made by make_crc_table().
+ */
+#include "crc32.h"
+#endif /* DYNAMIC_CRC_TABLE */
+
+/* =========================================================================
+ * This function can be used by asm versions of crc32()
+ */
+const unsigned long FAR * ZEXPORT get_crc_table()
+{
+#ifdef DYNAMIC_CRC_TABLE
+    if (crc_table_empty)
+        make_crc_table();
+#endif /* DYNAMIC_CRC_TABLE */
+    return (const unsigned long FAR *)crc_table;
+}
+
+/* ========================================================================= */
+#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
+#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
+
+/* ========================================================================= */
+unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, unsigned len)
+{
+    if (buf == Z_NULL) return 0UL;
+
+#ifdef DYNAMIC_CRC_TABLE
+    if (crc_table_empty)
+        make_crc_table();
+#endif /* DYNAMIC_CRC_TABLE */
+
+#ifdef BYFOUR
+    if (sizeof(void *) == sizeof(ptrdiff_t)) {
+        u4 endian;
+
+        endian = 1;
+        if (*((unsigned char *)(&endian)))
+            return crc32_little(crc, buf, len);
+        else
+            return crc32_big(crc, buf, len);
+    }
+#endif /* BYFOUR */
+    crc = crc ^ 0xffffffffUL;
+    while (len >= 8) {
+        DO8;
+        len -= 8;
+    }
+    if (len) do {
+        DO1;
+    } while (--len);
+    return crc ^ 0xffffffffUL;
+}
+
+#ifdef BYFOUR
+
+/* ========================================================================= */
+#define DOLIT4 c ^= *buf4++; \
+        c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
+            crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
+#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
+
+/* ========================================================================= */
+local unsigned long crc32_little(unsigned long crc, const unsigned char FAR *buf, unsigned len)
+{
+    register u4 c;
+    register const u4 FAR *buf4;
+
+    c = (u4)crc;
+    c = ~c;
+    while (len && ((ptrdiff_t)buf & 3)) {
+        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+        len--;
+    }
+
+    buf4 = (const u4 FAR *)buf;
+    while (len >= 32) {
+        DOLIT32;
+        len -= 32;
+    }
+    while (len >= 4) {
+        DOLIT4;
+        len -= 4;
+    }
+    buf = (const unsigned char FAR *)buf4;
+
+    if (len) do {
+        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+    } while (--len);
+    c = ~c;
+    return (unsigned long)c;
+}
+
+/* ========================================================================= */
+#define DOBIG4 c ^= *++buf4; \
+        c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
+            crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
+#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
+
+/* ========================================================================= */
+local unsigned long crc32_big(unsigned long crc, const unsigned char FAR *buf, unsigned len)
+{
+    register u4 c;
+    register const u4 FAR *buf4;
+
+    c = REV((u4)crc);
+    c = ~c;
+    while (len && ((ptrdiff_t)buf & 3)) {
+        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+        len--;
+    }
+
+    buf4 = (const u4 FAR *)buf;
+    buf4--;
+    while (len >= 32) {
+        DOBIG32;
+        len -= 32;
+    }
+    while (len >= 4) {
+        DOBIG4;
+        len -= 4;
+    }
+    buf4++;
+    buf = (const unsigned char FAR *)buf4;
+
+    if (len) do {
+        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+    } while (--len);
+    c = ~c;
+    return (unsigned long)(REV(c));
+}
+
+#endif /* BYFOUR */
Index: trunk/geant4/visualization/externals/zlib/src/deflate.cc
===================================================================
--- trunk/geant4/visualization/externals/zlib/src/deflate.cc	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/src/deflate.cc	(revision 562)
@@ -0,0 +1,1452 @@
+/* deflate.c -- compress data using the deflation algorithm
+ * Copyright (C) 1995-2004 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ *  ALGORITHM
+ *
+ *      The "deflation" process depends on being able to identify portions
+ *      of the input text which are identical to earlier input (within a
+ *      sliding window trailing behind the input currently being processed).
+ *
+ *      The most straightforward technique turns out to be the fastest for
+ *      most input files: try all possible matches and select the longest.
+ *      The key feature of this algorithm is that insertions into the string
+ *      dictionary are very simple and thus fast, and deletions are avoided
+ *      completely. Insertions are performed at each input character, whereas
+ *      string matches are performed only when the previous match ends. So it
+ *      is preferable to spend more time in matches to allow very fast string
+ *      insertions and avoid deletions. The matching algorithm for small
+ *      strings is inspired from that of Rabin & Karp. A brute force approach
+ *      is used to find longer strings when a small match has been found.
+ *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
+ *      (by Leonid Broukhis).
+ *         A previous version of this file used a more sophisticated algorithm
+ *      (by Fiala and Greene) which is guaranteed to run in linear amortized
+ *      time, but has a larger average cost, uses more memory and is patented.
+ *      However the F&G algorithm may be faster for some highly redundant
+ *      files if the parameter max_chain_length (described below) is too large.
+ *
+ *  ACKNOWLEDGEMENTS
+ *
+ *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
+ *      I found it in 'freeze' written by Leonid Broukhis.
+ *      Thanks to many people for bug reports and testing.
+ *
+ *  REFERENCES
+ *
+ *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
+ *      Available in http://www.ietf.org/rfc/rfc1951.txt
+ *
+ *      A description of the Rabin and Karp algorithm is given in the book
+ *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
+ *
+ *      Fiala,E.R., and Greene,D.H.
+ *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
+ *
+ */
+
+/* @(#) $Id: deflate.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#include "deflate.h"
+
+const char deflate_copyright[] =
+   " deflate 1.2.2 Copyright 1995-2004 Jean-loup Gailly ";
+/*
+  If you use the zlib library in a product, an acknowledgment is welcome
+  in the documentation of your product. If for some reason you cannot
+  include such an acknowledgment, I would appreciate that you keep this
+  copyright string in the executable of your product.
+ */
+
+/* ===========================================================================
+ *  Function prototypes.
+ */
+typedef enum {
+    need_more,      /* block not completed, need more input or more output */
+    block_done,     /* block flush performed */
+    finish_started, /* finish started, need only more output at next deflate */
+    finish_done     /* finish done, accept no more input or output */
+} block_state;
+
+typedef block_state (*compress_func) OF((deflate_state *s, int flush));
+/* Compression function. Returns the block state after the call. */
+
+local void fill_window    OF((deflate_state *s));
+local block_state deflate_stored OF((deflate_state *s, int flush));
+local block_state deflate_fast   OF((deflate_state *s, int flush));
+#ifndef FASTEST
+local block_state deflate_slow   OF((deflate_state *s, int flush));
+#endif
+local void lm_init        OF((deflate_state *s));
+local void putShortMSB    OF((deflate_state *s, uInt b));
+local void flush_pending  OF((z_streamp strm));
+local int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size));
+#ifndef FASTEST
+#ifdef ASMV
+      void match_init OF((void)); /* asm code initialization */
+      uInt longest_match  OF((deflate_state *s, IPos cur_match));
+#else
+local uInt longest_match  OF((deflate_state *s, IPos cur_match));
+#endif
+#endif
+local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
+
+#ifdef DEBUG
+local  void check_match OF((deflate_state *s, IPos start, IPos match,
+                            int length));
+#endif
+
+/* ===========================================================================
+ * Local data
+ */
+
+#define NIL 0
+/* Tail of hash chains */
+
+#ifndef TOO_FAR
+#  define TOO_FAR 4096
+#endif
+/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+/* Values for max_lazy_match, good_match and max_chain_length, depending on
+ * the desired pack level (0..9). The values given below have been tuned to
+ * exclude worst case performance for pathological files. Better values may be
+ * found for specific files.
+ */
+typedef struct config_s {
+   ush good_length; /* reduce lazy search above this match length */
+   ush max_lazy;    /* do not perform lazy search above this match length */
+   ush nice_length; /* quit search above this match length */
+   ush max_chain;
+   compress_func func;
+} config;
+
+#ifdef FASTEST
+local const config configuration_table[2] = {
+/*      good lazy nice chain */
+/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
+/* 1 */ {4,    4,  8,    4, deflate_fast}}; /* max speed, no lazy matches */
+#else
+local const config configuration_table[10] = {
+/*      good lazy nice chain */
+/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
+/* 1 */ {4,    4,  8,    4, deflate_fast}, /* max speed, no lazy matches */
+/* 2 */ {4,    5, 16,    8, deflate_fast},
+/* 3 */ {4,    6, 32,   32, deflate_fast},
+
+/* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */
+/* 5 */ {8,   16, 32,   32, deflate_slow},
+/* 6 */ {8,   16, 128, 128, deflate_slow},
+/* 7 */ {8,   32, 128, 256, deflate_slow},
+/* 8 */ {32, 128, 258, 1024, deflate_slow},
+/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
+#endif
+
+/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
+ * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
+ * meaning.
+ */
+
+#define EQUAL 0
+/* result of memcmp for equal strings */
+
+#ifndef NO_DUMMY_DECL
+struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
+#endif
+
+/* ===========================================================================
+ * Update a hash value with the given input byte
+ * IN  assertion: all calls to to UPDATE_HASH are made with consecutive
+ *    input characters, so that a running hash key can be computed from the
+ *    previous key instead of complete recalculation each time.
+ */
+#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
+
+
+/* ===========================================================================
+ * Insert string str in the dictionary and set match_head to the previous head
+ * of the hash chain (the most recent string with same hash key). Return
+ * the previous length of the hash chain.
+ * If this file is compiled with -DFASTEST, the compression level is forced
+ * to 1, and no hash chains are maintained.
+ * IN  assertion: all calls to to INSERT_STRING are made with consecutive
+ *    input characters and the first MIN_MATCH bytes of str are valid
+ *    (except for the last MIN_MATCH-1 bytes of the input file).
+ */
+#ifdef FASTEST
+#define INSERT_STRING(s, str, match_head) \
+   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+    match_head = s->head[s->ins_h], \
+    s->head[s->ins_h] = (Pos)(str))
+#else
+#define INSERT_STRING(s, str, match_head) \
+   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+    match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
+    s->head[s->ins_h] = (Pos)(str))
+#endif
+
+/* ===========================================================================
+ * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
+ * prev[] will be initialized on the fly.
+ */
+#define CLEAR_HASH(s) \
+    s->head[s->hash_size-1] = NIL; \
+    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+
+/* ========================================================================= */
+int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, int stream_size)
+{
+    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
+                         Z_DEFAULT_STRATEGY, version, stream_size);
+    /* To do: ignore strm->next_in if we use it as window */
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy,
+                  const char *version, int stream_size)
+{
+    deflate_state *s;
+    int wrap = 1;
+    static const char my_version[] = ZLIB_VERSION;
+
+    ushf *overlay;
+    /* We overlay pending_buf and d_buf+l_buf. This works since the average
+     * output size for (length,distance) codes is <= 24 bits.
+     */
+
+    if (version == Z_NULL || version[0] != my_version[0] ||
+        stream_size != sizeof(z_stream)) {
+        return Z_VERSION_ERROR;
+    }
+    if (strm == Z_NULL) return Z_STREAM_ERROR;
+
+    strm->msg = Z_NULL;
+    if (strm->zalloc == (alloc_func)0) {
+        strm->zalloc = zcalloc;
+        strm->opaque = (voidpf)0;
+    }
+    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+
+#ifdef FASTEST
+    if (level != 0) level = 1;
+#else
+    if (level == Z_DEFAULT_COMPRESSION) level = 6;
+#endif
+
+    if (windowBits < 0) { /* suppress zlib wrapper */
+        wrap = 0;
+        windowBits = -windowBits;
+    }
+#ifdef GZIP
+    else if (windowBits > 15) {
+        wrap = 2;       /* write gzip wrapper instead */
+        windowBits -= 16;
+    }
+#endif
+    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
+        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
+        strategy < 0 || strategy > Z_RLE) {
+        return Z_STREAM_ERROR;
+    }
+    if (windowBits == 8) windowBits = 9;  /* until 256-byte window bug fixed */
+    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
+    if (s == Z_NULL) return Z_MEM_ERROR;
+    strm->state = (struct internal_state FAR *)s;
+    s->strm = strm;
+
+    s->wrap = wrap;
+    s->w_bits = windowBits;
+    s->w_size = 1 << s->w_bits;
+    s->w_mask = s->w_size - 1;
+
+    s->hash_bits = memLevel + 7;
+    s->hash_size = 1 << s->hash_bits;
+    s->hash_mask = s->hash_size - 1;
+    s->hash_shift =  ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
+
+    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
+    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
+    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));
+
+    s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
+
+    overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
+    s->pending_buf = (uchf *) overlay;
+    s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
+
+    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
+        s->pending_buf == Z_NULL) {
+        s->status = FINISH_STATE;
+        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
+        deflateEnd (strm);
+        return Z_MEM_ERROR;
+    }
+    s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
+    s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
+
+    s->level = level;
+    s->strategy = strategy;
+    s->method = (Byte)method;
+
+    return deflateReset(strm);
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
+{
+    deflate_state *s;
+    uInt length = dictLength;
+    uInt n;
+    IPos hash_head = 0;
+
+    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
+        strm->state->wrap == 2 ||
+        (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
+        return Z_STREAM_ERROR;
+
+    s = strm->state;
+    if (s->wrap)
+        strm->adler = adler32(strm->adler, dictionary, dictLength);
+
+    if (length < MIN_MATCH) return Z_OK;
+    if (length > MAX_DIST(s)) {
+        length = MAX_DIST(s);
+#ifndef USE_DICT_HEAD
+        dictionary += dictLength - length; /* use the tail of the dictionary */
+#endif
+    }
+    zmemcpy(s->window, dictionary, length);
+    s->strstart = length;
+    s->block_start = (long)length;
+
+    /* Insert all strings in the hash table (except for the last two bytes).
+     * s->lookahead stays null, so s->ins_h will be recomputed at the next
+     * call of fill_window.
+     */
+    s->ins_h = s->window[0];
+    UPDATE_HASH(s, s->ins_h, s->window[1]);
+    for (n = 0; n <= length - MIN_MATCH; n++) {
+        INSERT_STRING(s, n, hash_head);
+    }
+    if (hash_head) hash_head = 0;  /* to make compiler happy */
+    return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateReset (z_streamp strm)
+{
+    deflate_state *s;
+
+    if (strm == Z_NULL || strm->state == Z_NULL ||
+        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
+        return Z_STREAM_ERROR;
+    }
+
+    strm->total_in = strm->total_out = 0;
+    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
+    strm->data_type = Z_UNKNOWN;
+
+    s = (deflate_state *)strm->state;
+    s->pending = 0;
+    s->pending_out = s->pending_buf;
+
+    if (s->wrap < 0) {
+        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
+    }
+    s->status = s->wrap ? INIT_STATE : BUSY_STATE;
+    strm->adler =
+#ifdef GZIP
+        s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
+#endif
+        adler32(0L, Z_NULL, 0);
+    s->last_flush = Z_NO_FLUSH;
+
+    _tr_init(s);
+    lm_init(s);
+
+    return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflatePrime (z_streamp strm, int bits, int value)
+{
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    strm->state->bi_valid = bits;
+    strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
+    return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
+{
+    deflate_state *s;
+    compress_func func;
+    int err = Z_OK;
+
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    s = strm->state;
+
+#ifdef FASTEST
+    if (level != 0) level = 1;
+#else
+    if (level == Z_DEFAULT_COMPRESSION) level = 6;
+#endif
+    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_RLE) {
+        return Z_STREAM_ERROR;
+    }
+    func = configuration_table[s->level].func;
+
+    if (func != configuration_table[level].func && strm->total_in != 0) {
+        /* Flush the last buffer: */
+        err = deflate(strm, Z_PARTIAL_FLUSH);
+    }
+    if (s->level != level) {
+        s->level = level;
+        s->max_lazy_match   = configuration_table[level].max_lazy;
+        s->good_match       = configuration_table[level].good_length;
+        s->nice_match       = configuration_table[level].nice_length;
+        s->max_chain_length = configuration_table[level].max_chain;
+    }
+    s->strategy = strategy;
+    return err;
+}
+
+/* =========================================================================
+ * For the default windowBits of 15 and memLevel of 8, this function returns
+ * a close to exact, as well as small, upper bound on the compressed size.
+ * They are coded as constants here for a reason--if the #define's are
+ * changed, then this function needs to be changed as well.  The return
+ * value for 15 and 8 only works for those exact settings.
+ *
+ * For any setting other than those defaults for windowBits and memLevel,
+ * the value returned is a conservative worst case for the maximum expansion
+ * resulting from using fixed blocks instead of stored blocks, which deflate
+ * can emit on compressed data for some combinations of the parameters.
+ *
+ * This function could be more sophisticated to provide closer upper bounds
+ * for every combination of windowBits and memLevel, as well as wrap.
+ * But even the conservative upper bound of about 14% expansion does not
+ * seem onerous for output buffer allocation.
+ */
+uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen)
+{
+    deflate_state *s;
+    uLong destLen;
+
+    /* conservative upper bound */
+    destLen = sourceLen +
+              ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11;
+
+    /* if can't get parameters, return conservative bound */
+    if (strm == Z_NULL || strm->state == Z_NULL)
+        return destLen;
+
+    /* if not default parameters, return conservative bound */
+    s = strm->state;
+    if (s->w_bits != 15 || s->hash_bits != 8 + 7)
+        return destLen;
+
+    /* default settings: return tight bound for that case */
+    return compressBound(sourceLen);
+}
+
+/* =========================================================================
+ * Put a short in the pending buffer. The 16-bit value is put in MSB order.
+ * IN assertion: the stream state is correct and there is enough room in
+ * pending_buf.
+ */
+local void putShortMSB (deflate_state *s, uInt b)
+{
+    put_byte(s, (Byte)(b >> 8));
+    put_byte(s, (Byte)(b & 0xff));
+}
+
+/* =========================================================================
+ * Flush as much pending output as possible. All deflate() output goes
+ * through this function so some applications may wish to modify it
+ * to avoid allocating a large strm->next_out buffer and copying into it.
+ * (See also read_buf()).
+ */
+local void flush_pending(z_streamp strm)
+{
+    unsigned len = strm->state->pending;
+
+    if (len > strm->avail_out) len = strm->avail_out;
+    if (len == 0) return;
+
+    zmemcpy(strm->next_out, strm->state->pending_out, len);
+    strm->next_out  += len;
+    strm->state->pending_out  += len;
+    strm->total_out += len;
+    strm->avail_out  -= len;
+    strm->state->pending -= len;
+    if (strm->state->pending == 0) {
+        strm->state->pending_out = strm->state->pending_buf;
+    }
+}
+
+/* ========================================================================= */
+int ZEXPORT deflate (z_streamp strm, int flush)
+{
+    int old_flush; /* value of flush param for previous deflate call */
+    deflate_state *s;
+
+    if (strm == Z_NULL || strm->state == Z_NULL ||
+        flush > Z_FINISH || flush < 0) {
+        return Z_STREAM_ERROR;
+    }
+    s = strm->state;
+
+    if (strm->next_out == Z_NULL ||
+        (strm->next_in == Z_NULL && strm->avail_in != 0) ||
+        (s->status == FINISH_STATE && flush != Z_FINISH)) {
+        ERR_RETURN(strm, Z_STREAM_ERROR);
+    }
+    if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
+
+    s->strm = strm; /* just in case */
+    old_flush = s->last_flush;
+    s->last_flush = flush;
+
+    /* Write the header */
+    if (s->status == INIT_STATE) {
+#ifdef GZIP
+        if (s->wrap == 2) {
+            put_byte(s, 31);
+            put_byte(s, 139);
+            put_byte(s, 8);
+            put_byte(s, 0);
+            put_byte(s, 0);
+            put_byte(s, 0);
+            put_byte(s, 0);
+            put_byte(s, 0);
+            put_byte(s, s->level == 9 ? 2 :
+                        (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
+                         4 : 0));
+            put_byte(s, 255);
+            s->status = BUSY_STATE;
+            strm->adler = crc32(0L, Z_NULL, 0);
+        }
+        else
+#endif
+        {
+            uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
+            uInt level_flags;
+
+            if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
+                level_flags = 0;
+            else if (s->level < 6)
+                level_flags = 1;
+            else if (s->level == 6)
+                level_flags = 2;
+            else
+                level_flags = 3;
+            header |= (level_flags << 6);
+            if (s->strstart != 0) header |= PRESET_DICT;
+            header += 31 - (header % 31);
+
+            s->status = BUSY_STATE;
+            putShortMSB(s, header);
+
+            /* Save the adler32 of the preset dictionary: */
+            if (s->strstart != 0) {
+                putShortMSB(s, (uInt)(strm->adler >> 16));
+                putShortMSB(s, (uInt)(strm->adler & 0xffff));
+            }
+            strm->adler = adler32(0L, Z_NULL, 0);
+        }
+    }
+
+    /* Flush as much pending output as possible */
+    if (s->pending != 0) {
+        flush_pending(strm);
+        if (strm->avail_out == 0) {
+            /* Since avail_out is 0, deflate will be called again with
+             * more output space, but possibly with both pending and
+             * avail_in equal to zero. There won't be anything to do,
+             * but this is not an error situation so make sure we
+             * return OK instead of BUF_ERROR at next call of deflate:
+             */
+            s->last_flush = -1;
+            return Z_OK;
+        }
+
+    /* Make sure there is something to do and avoid duplicate consecutive
+     * flushes. For repeated and useless calls with Z_FINISH, we keep
+     * returning Z_STREAM_END instead of Z_BUF_ERROR.
+     */
+    } else if (strm->avail_in == 0 && flush <= old_flush &&
+               flush != Z_FINISH) {
+        ERR_RETURN(strm, Z_BUF_ERROR);
+    }
+
+    /* User must not provide more input after the first FINISH: */
+    if (s->status == FINISH_STATE && strm->avail_in != 0) {
+        ERR_RETURN(strm, Z_BUF_ERROR);
+    }
+
+    /* Start a new block or continue the current one.
+     */
+    if (strm->avail_in != 0 || s->lookahead != 0 ||
+        (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
+        block_state bstate;
+
+        bstate = (*(configuration_table[s->level].func))(s, flush);
+
+        if (bstate == finish_started || bstate == finish_done) {
+            s->status = FINISH_STATE;
+        }
+        if (bstate == need_more || bstate == finish_started) {
+            if (strm->avail_out == 0) {
+                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
+            }
+            return Z_OK;
+            /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
+             * of deflate should use the same flush parameter to make sure
+             * that the flush is complete. So we don't have to output an
+             * empty block here, this will be done at next call. This also
+             * ensures that for a very small output buffer, we emit at most
+             * one empty block.
+             */
+        }
+        if (bstate == block_done) {
+            if (flush == Z_PARTIAL_FLUSH) {
+                _tr_align(s);
+            } else { /* FULL_FLUSH or SYNC_FLUSH */
+                _tr_stored_block(s, (char*)0, 0L, 0);
+                /* For a full flush, this empty block will be recognized
+                 * as a special marker by inflate_sync().
+                 */
+                if (flush == Z_FULL_FLUSH) {
+                    CLEAR_HASH(s);             /* forget history */
+                }
+            }
+            flush_pending(strm);
+            if (strm->avail_out == 0) {
+              s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
+              return Z_OK;
+            }
+        }
+    }
+    Assert(strm->avail_out > 0, (char*)"bug2");
+
+    if (flush != Z_FINISH) return Z_OK;
+    if (s->wrap <= 0) return Z_STREAM_END;
+
+    /* Write the trailer */
+#ifdef GZIP
+    if (s->wrap == 2) {
+        put_byte(s, (Byte)(strm->adler & 0xff));
+        put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
+        put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
+        put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
+        put_byte(s, (Byte)(strm->total_in & 0xff));
+        put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
+        put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
+        put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
+    }
+    else
+#endif
+    {
+        putShortMSB(s, (uInt)(strm->adler >> 16));
+        putShortMSB(s, (uInt)(strm->adler & 0xffff));
+    }
+    flush_pending(strm);
+    /* If avail_out is zero, the application will call deflate again
+     * to flush the rest.
+     */
+    if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
+    return s->pending != 0 ? Z_OK : Z_STREAM_END;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateEnd (z_streamp strm)
+{
+    int status;
+
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+
+    status = strm->state->status;
+    if (status != INIT_STATE && status != BUSY_STATE &&
+        status != FINISH_STATE) {
+      return Z_STREAM_ERROR;
+    }
+
+    /* Deallocate in reverse order of allocations: */
+    TRY_FREE(strm, strm->state->pending_buf);
+    TRY_FREE(strm, strm->state->head);
+    TRY_FREE(strm, strm->state->prev);
+    TRY_FREE(strm, strm->state->window);
+
+    ZFREE(strm, strm->state);
+    strm->state = Z_NULL;
+
+    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
+}
+
+/* =========================================================================
+ * Copy the source state to the destination state.
+ * To simplify the source, this is not supported for 16-bit MSDOS (which
+ * doesn't have enough memory anyway to duplicate compression states).
+ */
+int ZEXPORT deflateCopy (z_streamp dest, z_streamp source)
+{
+#ifdef MAXSEG_64K
+    return Z_STREAM_ERROR;
+#else
+    deflate_state *ds;
+    deflate_state *ss;
+    ushf *overlay;
+
+
+    if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
+        return Z_STREAM_ERROR;
+    }
+
+    ss = source->state;
+
+    *dest = *source;
+
+    ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
+    if (ds == Z_NULL) return Z_MEM_ERROR;
+    dest->state = (struct internal_state FAR *) ds;
+    *ds = *ss;
+    ds->strm = dest;
+
+    ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
+    ds->prev   = (Posf *)  ZALLOC(dest, ds->w_size, sizeof(Pos));
+    ds->head   = (Posf *)  ZALLOC(dest, ds->hash_size, sizeof(Pos));
+    overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
+    ds->pending_buf = (uchf *) overlay;
+
+    if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
+        ds->pending_buf == Z_NULL) {
+        deflateEnd (dest);
+        return Z_MEM_ERROR;
+    }
+    /* following zmemcpy do not work for 16-bit MSDOS */
+    zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
+    zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
+    zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
+    zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+
+    ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
+    ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
+    ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
+
+    ds->l_desc.dyn_tree = ds->dyn_ltree;
+    ds->d_desc.dyn_tree = ds->dyn_dtree;
+    ds->bl_desc.dyn_tree = ds->bl_tree;
+
+    return Z_OK;
+#endif /* MAXSEG_64K */
+}
+
+/* ===========================================================================
+ * Read a new buffer from the current input stream, update the adler32
+ * and total number of bytes read.  All deflate() input goes through
+ * this function so some applications may wish to modify it to avoid
+ * allocating a large strm->next_in buffer and copying from it.
+ * (See also flush_pending()).
+ */
+local int read_buf(z_streamp strm, Bytef *buf, unsigned size)
+{
+    unsigned len = strm->avail_in;
+
+    if (len > size) len = size;
+    if (len == 0) return 0;
+
+    strm->avail_in  -= len;
+
+    if (strm->state->wrap == 1) {
+        strm->adler = adler32(strm->adler, strm->next_in, len);
+    }
+#ifdef GZIP
+    else if (strm->state->wrap == 2) {
+        strm->adler = crc32(strm->adler, strm->next_in, len);
+    }
+#endif
+    zmemcpy(buf, strm->next_in, len);
+    strm->next_in  += len;
+    strm->total_in += len;
+
+    return (int)len;
+}
+
+/* ===========================================================================
+ * Initialize the "longest match" routines for a new zlib stream
+ */
+local void lm_init (deflate_state *s)
+{
+    s->window_size = (ulg)2L*s->w_size;
+
+    CLEAR_HASH(s);
+
+    /* Set the default configuration parameters:
+     */
+    s->max_lazy_match   = configuration_table[s->level].max_lazy;
+    s->good_match       = configuration_table[s->level].good_length;
+    s->nice_match       = configuration_table[s->level].nice_length;
+    s->max_chain_length = configuration_table[s->level].max_chain;
+
+    s->strstart = 0;
+    s->block_start = 0L;
+    s->lookahead = 0;
+    s->match_length = s->prev_length = MIN_MATCH-1;
+    s->match_available = 0;
+    s->ins_h = 0;
+#ifdef ASMV
+    match_init(); /* initialize the asm code */
+#endif
+}
+
+#ifndef FASTEST
+/* ===========================================================================
+ * Set match_start to the longest match starting at the given string and
+ * return its length. Matches shorter or equal to prev_length are discarded,
+ * in which case the result is equal to prev_length and match_start is
+ * garbage.
+ * IN assertions: cur_match is the head of the hash chain for the current
+ *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
+ * OUT assertion: the match length is not greater than s->lookahead.
+ */
+#ifndef ASMV
+/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
+ * match.S. The code will be functionally equivalent.
+ */
+local uInt longest_match(deflate_state *s, IPos cur_match)
+{
+    unsigned chain_length = s->max_chain_length;/* max hash chain length */
+    register Bytef *scan = s->window + s->strstart; /* current string */
+    register Bytef *match;                       /* matched string */
+    register int len;                           /* length of current match */
+    int best_len = s->prev_length;              /* best match length so far */
+    int nice_match = s->nice_match;             /* stop if match long enough */
+    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+        s->strstart - (IPos)MAX_DIST(s) : NIL;
+    /* Stop when cur_match becomes <= limit. To simplify the code,
+     * we prevent matches with the string of window index 0.
+     */
+    Posf *prev = s->prev;
+    uInt wmask = s->w_mask;
+
+#ifdef UNALIGNED_OK
+    /* Compare two bytes at a time. Note: this is not always beneficial.
+     * Try with and without -DUNALIGNED_OK to check.
+     */
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
+    register ush scan_start = *(ushf*)scan;
+    register ush scan_end   = *(ushf*)(scan+best_len-1);
+#else
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+    register Byte scan_end1  = scan[best_len-1];
+    register Byte scan_end   = scan[best_len];
+#endif
+
+    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+     * It is easy to get rid of this optimization if necessary.
+     */
+    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, (char*)"Code too clever");
+
+    /* Do not waste too much time if we already have a good match: */
+    if (s->prev_length >= s->good_match) {
+        chain_length >>= 2;
+    }
+    /* Do not look for matches beyond the end of the input. This is necessary
+     * to make deflate deterministic.
+     */
+    if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+
+    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, (char*)"need lookahead");
+
+    do {
+        Assert(cur_match < s->strstart, (char*)"no future");
+        match = s->window + cur_match;
+
+        /* Skip to next match if the match length cannot increase
+         * or if the match length is less than 2:
+         */
+#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
+        /* This code assumes sizeof(unsigned short) == 2. Do not use
+         * UNALIGNED_OK if your compiler uses a different size.
+         */
+        if (*(ushf*)(match+best_len-1) != scan_end ||
+            *(ushf*)match != scan_start) continue;
+
+        /* It is not necessary to compare scan[2] and match[2] since they are
+         * always equal when the other bytes match, given that the hash keys
+         * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
+         * strstart+3, +5, ... up to strstart+257. We check for insufficient
+         * lookahead only every 4th comparison; the 128th check will be made
+         * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+         * necessary to put more guard bytes at the end of the window, or
+         * to check more often for insufficient lookahead.
+         */
+        Assert(scan[2] == match[2], (char*)"scan[2]?");
+        scan++, match++;
+        do {
+        } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+                 scan < strend);
+        /* The funny "do {}" generates better code on most compilers */
+
+        /* Here, scan <= window+strstart+257 */
+        Assert(scan <= s->window+(unsigned)(s->window_size-1), (char*)"wild scan");
+        if (*scan == *match) scan++;
+
+        len = (MAX_MATCH - 1) - (int)(strend-scan);
+        scan = strend - (MAX_MATCH-1);
+
+#else /* UNALIGNED_OK */
+
+        if (match[best_len]   != scan_end  ||
+            match[best_len-1] != scan_end1 ||
+            *match            != *scan     ||
+            *++match          != scan[1])      continue;
+
+        /* The check at best_len-1 can be removed because it will be made
+         * again later. (This heuristic is not always a win.)
+         * It is not necessary to compare scan[2] and match[2] since they
+         * are always equal when the other bytes match, given that
+         * the hash keys are equal and that HASH_BITS >= 8.
+         */
+        scan += 2, match++;
+        Assert(*scan == *match, (char*)"match[2]?");
+
+        /* We check for insufficient lookahead only every 8th comparison;
+         * the 256th check will be made at strstart+258.
+         */
+        do {
+        } while (*++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 *++scan == *++match && *++scan == *++match &&
+                 scan < strend);
+
+        Assert(scan <= s->window+(unsigned)(s->window_size-1), (char*)"wild scan");
+
+        len = MAX_MATCH - (int)(strend - scan);
+        scan = strend - MAX_MATCH;
+
+#endif /* UNALIGNED_OK */
+
+        if (len > best_len) {
+            s->match_start = cur_match;
+            best_len = len;
+            if (len >= nice_match) break;
+#ifdef UNALIGNED_OK
+            scan_end = *(ushf*)(scan+best_len-1);
+#else
+            scan_end1  = scan[best_len-1];
+            scan_end   = scan[best_len];
+#endif
+        }
+    } while ((cur_match = prev[cur_match & wmask]) > limit
+             && --chain_length != 0);
+
+    if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
+    return s->lookahead;
+}
+#endif /* ASMV */
+#endif /* FASTEST */
+
+/* ---------------------------------------------------------------------------
+ * Optimized version for level == 1 or strategy == Z_RLE only
+ */
+local uInt longest_match_fast(deflate_state *s, IPos cur_match)
+{
+    register Bytef *scan = s->window + s->strstart; /* current string */
+    register Bytef *match;                       /* matched string */
+    register int len;                           /* length of current match */
+    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+
+    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+     * It is easy to get rid of this optimization if necessary.
+     */
+    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, (char*)"Code too clever");
+
+    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, (char*)"need lookahead");
+
+    Assert(cur_match < s->strstart, (char*)"no future");
+
+    match = s->window + cur_match;
+
+    /* Return failure if the match length is less than 2:
+     */
+    if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
+
+    /* The check at best_len-1 can be removed because it will be made
+     * again later. (This heuristic is not always a win.)
+     * It is not necessary to compare scan[2] and match[2] since they
+     * are always equal when the other bytes match, given that
+     * the hash keys are equal and that HASH_BITS >= 8.
+     */
+    scan += 2, match += 2;
+    Assert(*scan == *match, (char*)"match[2]?");
+
+    /* We check for insufficient lookahead only every 8th comparison;
+     * the 256th check will be made at strstart+258.
+     */
+    do {
+    } while (*++scan == *++match && *++scan == *++match &&
+             *++scan == *++match && *++scan == *++match &&
+             *++scan == *++match && *++scan == *++match &&
+             *++scan == *++match && *++scan == *++match &&
+             scan < strend);
+
+    Assert(scan <= s->window+(unsigned)(s->window_size-1), (char*)"wild scan");
+
+    len = MAX_MATCH - (int)(strend - scan);
+
+    if (len < MIN_MATCH) return MIN_MATCH - 1;
+
+    s->match_start = cur_match;
+    return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
+}
+
+#ifdef DEBUG
+/* ===========================================================================
+ * Check that the match at match_start is indeed a match.
+ */
+local void check_match(deflate_state *s, IPos start, IPos match, int length)
+{
+    /* check that the match is indeed a match */
+    if (zmemcmp(s->window + match,
+                s->window + start, length) != EQUAL) {
+        fprintf(stderr, (char*)" start %u, match %u, length %d\n",
+                start, match, length);
+        do {
+            fprintf(stderr, (char*)"%c%c", s->window[match++], s->window[start++]);
+        } while (--length != 0);
+        z_error((char*)"invalid match");
+    }
+    if (z_verbose > 1) {
+        fprintf(stderr,(char*)"\\[%d,%d]", start-match, length);
+        do { putc(s->window[start++], stderr); } while (--length != 0);
+    }
+}
+#else
+#  define check_match(s, start, match, length)
+#endif /* DEBUG */
+
+/* ===========================================================================
+ * Fill the window when the lookahead becomes insufficient.
+ * Updates strstart and lookahead.
+ *
+ * IN assertion: lookahead < MIN_LOOKAHEAD
+ * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
+ *    At least one byte has been read, or avail_in == 0; reads are
+ *    performed for at least two bytes (required for the zip translate_eol
+ *    option -- not supported here).
+ */
+local void fill_window(deflate_state *s)
+{
+    register unsigned n, m;
+    register Posf *p;
+    unsigned more;    /* Amount of free space at the end of the window. */
+    uInt wsize = s->w_size;
+
+    do {
+        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+
+        /* Deal with !@#$% 64K limit: */
+        if (sizeof(int) <= 2) {
+            if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
+                more = wsize;
+
+            } else if (more == (unsigned)(-1)) {
+                /* Very unlikely, but possible on 16 bit machine if
+                 * strstart == 0 && lookahead == 1 (input done a byte at time)
+                 */
+                more--;
+            }
+        }
+
+        /* If the window is almost full and there is insufficient lookahead,
+         * move the upper half to the lower one to make room in the upper half.
+         */
+        if (s->strstart >= wsize+MAX_DIST(s)) {
+
+            zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
+            s->match_start -= wsize;
+            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
+            s->block_start -= (long) wsize;
+
+            /* Slide the hash table (could be avoided with 32 bit values
+               at the expense of memory usage). We slide even when level == 0
+               to keep the hash table consistent if we switch back to level > 0
+               later. (Using level 0 permanently is not an optimal usage of
+               zlib, so we don't care about this pathological case.)
+             */
+            n = s->hash_size;
+            p = &s->head[n];
+            do {
+                m = *--p;
+                *p = (Pos)(m >= wsize ? m-wsize : NIL);
+            } while (--n);
+
+            n = wsize;
+#ifndef FASTEST
+            p = &s->prev[n];
+            do {
+                m = *--p;
+                *p = (Pos)(m >= wsize ? m-wsize : NIL);
+                /* If n is not on any hash chain, prev[n] is garbage but
+                 * its value will never be used.
+                 */
+            } while (--n);
+#endif
+            more += wsize;
+        }
+        if (s->strm->avail_in == 0) return;
+
+        /* If there was no sliding:
+         *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+         *    more == window_size - lookahead - strstart
+         * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+         * => more >= window_size - 2*WSIZE + 2
+         * In the BIG_MEM or MMAP case (not yet supported),
+         *   window_size == input_size + MIN_LOOKAHEAD  &&
+         *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+         * Otherwise, window_size == 2*WSIZE so more >= 2.
+         * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+         */
+        Assert(more >= 2, (char*)"more < 2");
+
+        n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+        s->lookahead += n;
+
+        /* Initialize the hash value now that we have some input: */
+        if (s->lookahead >= MIN_MATCH) {
+            s->ins_h = s->window[s->strstart];
+            UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+            Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+        }
+        /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+         * but this is not important since only literal bytes will be emitted.
+         */
+
+    } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
+}
+
+/* ===========================================================================
+ * Flush the current block, with given end-of-file flag.
+ * IN assertion: strstart is set to the end of the current match.
+ */
+#define FLUSH_BLOCK_ONLY(s, eof) { \
+   _tr_flush_block(s, (s->block_start >= 0L ? \
+                   (charf *)&s->window[(unsigned)s->block_start] : \
+                   (charf *)Z_NULL), \
+                (ulg)((long)s->strstart - s->block_start), \
+                (eof)); \
+   s->block_start = s->strstart; \
+   flush_pending(s->strm); \
+   Tracev((stderr,(char*)"[FLUSH]")); \
+}
+
+/* Same but force premature exit if necessary. */
+#define FLUSH_BLOCK(s, eof) { \
+   FLUSH_BLOCK_ONLY(s, eof); \
+   if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
+}
+
+/* ===========================================================================
+ * Copy without compression as much as possible from the input stream, return
+ * the current block state.
+ * This function does not insert new strings in the dictionary since
+ * uncompressible data is probably not useful. This function is used
+ * only for the level=0 compression option.
+ * NOTE: this function should be optimized to avoid extra copying from
+ * window to pending_buf.
+ */
+local block_state deflate_stored(deflate_state *s, int flush)
+{
+    /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
+     * to pending_buf_size, and each stored block has a 5 byte header:
+     */
+    ulg max_block_size = 0xffff;
+    ulg max_start;
+
+    if (max_block_size > s->pending_buf_size - 5) {
+        max_block_size = s->pending_buf_size - 5;
+    }
+
+    /* Copy as much as possible from input to output: */
+    for (;;) {
+        /* Fill the window as much as possible: */
+        if (s->lookahead <= 1) {
+
+            Assert(s->strstart < s->w_size+MAX_DIST(s) ||
+                   s->block_start >= (long)s->w_size, (char*)"slide too late");
+
+            fill_window(s);
+            if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
+
+            if (s->lookahead == 0) break; /* flush the current block */
+        }
+        Assert(s->block_start >= 0L, (char*)"block gone");
+
+        s->strstart += s->lookahead;
+        s->lookahead = 0;
+
+        /* Emit a stored block if pending_buf will be full: */
+        max_start = s->block_start + max_block_size;
+        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
+            /* strstart == 0 is possible when wraparound on 16-bit machine */
+            s->lookahead = (uInt)(s->strstart - max_start);
+            s->strstart = (uInt)max_start;
+            FLUSH_BLOCK(s, 0);
+        }
+        /* Flush if we may have to slide, otherwise block_start may become
+         * negative and the data will be gone:
+         */
+        if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
+            FLUSH_BLOCK(s, 0);
+        }
+    }
+    FLUSH_BLOCK(s, flush == Z_FINISH);
+    return flush == Z_FINISH ? finish_done : block_done;
+}
+
+/* ===========================================================================
+ * Compress as much as possible from the input stream, return the current
+ * block state.
+ * This function does not perform lazy evaluation of matches and inserts
+ * new strings in the dictionary only for unmatched strings or for short
+ * matches. It is used only for the fast compression options.
+ */
+local block_state deflate_fast(deflate_state *s, int flush)
+{
+    IPos hash_head = NIL; /* head of the hash chain */
+    int bflush;           /* set if current block must be flushed */
+
+    for (;;) {
+        /* Make sure that we always have enough lookahead, except
+         * at the end of the input file. We need MAX_MATCH bytes
+         * for the next match, plus MIN_MATCH bytes to insert the
+         * string following the next match.
+         */
+        if (s->lookahead < MIN_LOOKAHEAD) {
+            fill_window(s);
+            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+                return need_more;
+            }
+            if (s->lookahead == 0) break; /* flush the current block */
+        }
+
+        /* Insert the string window[strstart .. strstart+2] in the
+         * dictionary, and set hash_head to the head of the hash chain:
+         */
+        if (s->lookahead >= MIN_MATCH) {
+            INSERT_STRING(s, s->strstart, hash_head);
+        }
+
+        /* Find the longest match, discarding those <= prev_length.
+         * At this point we have always match_length < MIN_MATCH
+         */
+        if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
+            /* To simplify the code, we prevent matches with the string
+             * of window index 0 (in particular we have to avoid a match
+             * of the string with itself at the start of the input file).
+             */
+#ifdef FASTEST
+            if ((s->strategy < Z_HUFFMAN_ONLY) ||
+                (s->strategy == Z_RLE && s->strstart - hash_head == 1)) {
+                s->match_length = longest_match_fast (s, hash_head);
+            }
+#else
+            if (s->strategy < Z_HUFFMAN_ONLY) {
+                s->match_length = longest_match (s, hash_head);
+            } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
+                s->match_length = longest_match_fast (s, hash_head);
+            }
+#endif
+            /* longest_match() or longest_match_fast() sets match_start */
+        }
+        if (s->match_length >= MIN_MATCH) {
+            check_match(s, s->strstart, s->match_start, s->match_length);
+
+            _tr_tally_dist(s, s->strstart - s->match_start,
+                           s->match_length - MIN_MATCH, bflush);
+
+            s->lookahead -= s->match_length;
+
+            /* Insert new strings in the hash table only if the match length
+             * is not too large. This saves time but degrades compression.
+             */
+#ifndef FASTEST
+            if (s->match_length <= s->max_insert_length &&
+                s->lookahead >= MIN_MATCH) {
+                s->match_length--; /* string at strstart already in table */
+                do {
+                    s->strstart++;
+                    INSERT_STRING(s, s->strstart, hash_head);
+                    /* strstart never exceeds WSIZE-MAX_MATCH, so there are
+                     * always MIN_MATCH bytes ahead.
+                     */
+                } while (--s->match_length != 0);
+                s->strstart++;
+            } else
+#endif
+            {
+                s->strstart += s->match_length;
+                s->match_length = 0;
+                s->ins_h = s->window[s->strstart];
+                UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+                Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+                /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
+                 * matter since it will be recomputed at next deflate call.
+                 */
+            }
+        } else {
+            /* No match, output a literal byte */
+            Tracevv((stderr,"%c", s->window[s->strstart]));
+            _tr_tally_lit (s, s->window[s->strstart], bflush);
+            s->lookahead--;
+            s->strstart++;
+        }
+        if (bflush) FLUSH_BLOCK(s, 0);
+    }
+    FLUSH_BLOCK(s, flush == Z_FINISH);
+    return flush == Z_FINISH ? finish_done : block_done;
+}
+
+#ifndef FASTEST
+/* ===========================================================================
+ * Same as above, but achieves better compression. We use a lazy
+ * evaluation for matches: a match is finally adopted only if there is
+ * no better match at the next window position.
+ */
+local block_state deflate_slow(deflate_state *s, int flush)
+{
+    IPos hash_head = NIL;    /* head of hash chain */
+    int bflush;              /* set if current block must be flushed */
+
+    /* Process the input block. */
+    for (;;) {
+        /* Make sure that we always have enough lookahead, except
+         * at the end of the input file. We need MAX_MATCH bytes
+         * for the next match, plus MIN_MATCH bytes to insert the
+         * string following the next match.
+         */
+        if (s->lookahead < MIN_LOOKAHEAD) {
+            fill_window(s);
+            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+                return need_more;
+            }
+            if (s->lookahead == 0) break; /* flush the current block */
+        }
+
+        /* Insert the string window[strstart .. strstart+2] in the
+         * dictionary, and set hash_head to the head of the hash chain:
+         */
+        if (s->lookahead >= MIN_MATCH) {
+            INSERT_STRING(s, s->strstart, hash_head);
+        }
+
+        /* Find the longest match, discarding those <= prev_length.
+         */
+        s->prev_length = s->match_length, s->prev_match = s->match_start;
+        s->match_length = MIN_MATCH-1;
+
+        if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
+            s->strstart - hash_head <= MAX_DIST(s)) {
+            /* To simplify the code, we prevent matches with the string
+             * of window index 0 (in particular we have to avoid a match
+             * of the string with itself at the start of the input file).
+             */
+            if (s->strategy < Z_HUFFMAN_ONLY) {
+                s->match_length = longest_match (s, hash_head);
+            } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
+                s->match_length = longest_match_fast (s, hash_head);
+            }
+            /* longest_match() or longest_match_fast() sets match_start */
+
+            if (s->match_length <= 5 && (s->strategy == Z_FILTERED
+#if TOO_FAR <= 32767
+                || (s->match_length == MIN_MATCH &&
+                    s->strstart - s->match_start > TOO_FAR)
+#endif
+                )) {
+
+                /* If prev_match is also MIN_MATCH, match_start is garbage
+                 * but we will ignore the current match anyway.
+                 */
+                s->match_length = MIN_MATCH-1;
+            }
+        }
+        /* If there was a match at the previous step and the current
+         * match is not better, output the previous match:
+         */
+        if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
+            uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
+            /* Do not insert strings in hash table beyond this. */
+
+            check_match(s, s->strstart-1, s->prev_match, s->prev_length);
+
+            _tr_tally_dist(s, s->strstart -1 - s->prev_match,
+                           s->prev_length - MIN_MATCH, bflush);
+
+            /* Insert in hash table all strings up to the end of the match.
+             * strstart-1 and strstart are already inserted. If there is not
+             * enough lookahead, the last two strings are not inserted in
+             * the hash table.
+             */
+            s->lookahead -= s->prev_length-1;
+            s->prev_length -= 2;
+            do {
+                if (++s->strstart <= max_insert) {
+                    INSERT_STRING(s, s->strstart, hash_head);
+                }
+            } while (--s->prev_length != 0);
+            s->match_available = 0;
+            s->match_length = MIN_MATCH-1;
+            s->strstart++;
+
+            if (bflush) FLUSH_BLOCK(s, 0);
+
+        } else if (s->match_available) {
+            /* If there was no match at the previous position, output a
+             * single literal. If there was a match but the current match
+             * is longer, truncate the previous match to a single literal.
+             */
+            Tracevv((stderr,(char*)"%c", s->window[s->strstart-1]));
+            _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+            if (bflush) {
+                FLUSH_BLOCK_ONLY(s, 0);
+            }
+            s->strstart++;
+            s->lookahead--;
+            if (s->strm->avail_out == 0) return need_more;
+        } else {
+            /* There is no previous match to compare with, wait for
+             * the next step to decide.
+             */
+            s->match_available = 1;
+            s->strstart++;
+            s->lookahead--;
+        }
+    }
+    Assert (flush != Z_NO_FLUSH, (char*)"no flush?");
+    if (s->match_available) {
+        Tracevv((stderr,(char*)"%c", s->window[s->strstart-1]));
+        _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+        s->match_available = 0;
+    }
+    FLUSH_BLOCK(s, flush == Z_FINISH);
+    return flush == Z_FINISH ? finish_done : block_done;
+}
+#endif /* FASTEST */
Index: trunk/geant4/visualization/externals/zlib/src/trees.cc
===================================================================
--- trunk/geant4/visualization/externals/zlib/src/trees.cc	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/src/trees.cc	(revision 562)
@@ -0,0 +1,1167 @@
+/* trees.c -- output deflated data using Huffman coding
+ * Copyright (C) 1995-2003 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ *  ALGORITHM
+ *
+ *      The "deflation" process uses several Huffman trees. The more
+ *      common source values are represented by shorter bit sequences.
+ *
+ *      Each code tree is stored in a compressed form which is itself
+ * a Huffman encoding of the lengths of all the code strings (in
+ * ascending order by source values).  The actual code strings are
+ * reconstructed from the lengths in the inflate process, as described
+ * in the deflate specification.
+ *
+ *  REFERENCES
+ *
+ *      Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
+ *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
+ *
+ *      Storer, James A.
+ *          Data Compression:  Methods and Theory, pp. 49-50.
+ *          Computer Science Press, 1988.  ISBN 0-7167-8156-5.
+ *
+ *      Sedgewick, R.
+ *          Algorithms, p290.
+ *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
+ */
+
+/* @(#) $Id: trees.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+/* #define GEN_TREES_H */
+
+#include "deflate.h"
+
+#ifdef DEBUG
+#  include <ctype.h>
+#endif
+
+/* ===========================================================================
+ * Constants
+ */
+
+#define MAX_BL_BITS 7
+/* Bit length codes must not exceed MAX_BL_BITS bits */
+
+#define END_BLOCK 256
+/* end of block literal code */
+
+#define REP_3_6      16
+/* repeat previous bit length 3-6 times (2 bits of repeat count) */
+
+#define REPZ_3_10    17
+/* repeat a zero length 3-10 times  (3 bits of repeat count) */
+
+#define REPZ_11_138  18
+/* repeat a zero length 11-138 times  (7 bits of repeat count) */
+
+local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
+   = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
+
+local const int extra_dbits[D_CODES] /* extra bits for each distance code */
+   = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
+
+local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
+   = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
+
+local const uch bl_order[BL_CODES]
+   = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
+/* The lengths of the bit length codes are sent in order of decreasing
+ * probability, to avoid transmitting the lengths for unused bit length codes.
+ */
+
+#define Buf_size (8 * 2*sizeof(char))
+/* Number of bits used within bi_buf. (bi_buf might be implemented on
+ * more than 16 bits on some systems.)
+ */
+
+/* ===========================================================================
+ * Local data. These are initialized only once.
+ */
+
+#define DIST_CODE_LEN  512 /* see definition of array dist_code below */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+/* non ANSI compilers may not accept trees.h */
+
+local ct_data static_ltree[L_CODES+2];
+/* The static literal tree. Since the bit lengths are imposed, there is no
+ * need for the L_CODES extra codes used during heap construction. However
+ * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
+ * below).
+ */
+
+local ct_data static_dtree[D_CODES];
+/* The static distance tree. (Actually a trivial tree since all codes use
+ * 5 bits.)
+ */
+
+uch _dist_code[DIST_CODE_LEN];
+/* Distance codes. The first 256 values correspond to the distances
+ * 3 .. 258, the last 256 values correspond to the top 8 bits of
+ * the 15 bit distances.
+ */
+
+uch _length_code[MAX_MATCH-MIN_MATCH+1];
+/* length code for each normalized match length (0 == MIN_MATCH) */
+
+local int base_length[LENGTH_CODES];
+/* First normalized length for each code (0 = MIN_MATCH) */
+
+local int base_dist[D_CODES];
+/* First normalized distance for each code (0 = distance of 1) */
+
+#else
+#  include "trees.h"
+#endif /* GEN_TREES_H */
+
+struct static_tree_desc_s {
+    const ct_data *static_tree;  /* static tree or NULL */
+    const intf *extra_bits;      /* extra bits for each code or NULL */
+    int     extra_base;          /* base index for extra_bits */
+    int     elems;               /* max number of elements in the tree */
+    int     max_length;          /* max bit length for the codes */
+};
+
+local static_tree_desc  static_l_desc =
+{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
+
+local static_tree_desc  static_d_desc =
+{static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS};
+
+local static_tree_desc  static_bl_desc =
+{(const ct_data *)0, extra_blbits, 0,   BL_CODES, MAX_BL_BITS};
+
+/* ===========================================================================
+ * Local (static) routines in this file.
+ */
+
+local void tr_static_init OF((void));
+local void init_block     OF((deflate_state *s));
+local void pqdownheap     OF((deflate_state *s, ct_data *tree, int k));
+local void gen_bitlen     OF((deflate_state *s, tree_desc *desc));
+local void gen_codes      OF((ct_data *tree, int max_code, ushf *bl_count));
+local void build_tree     OF((deflate_state *s, tree_desc *desc));
+local void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));
+local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
+local int  build_bl_tree  OF((deflate_state *s));
+local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
+                              int blcodes));
+local void compress_block OF((deflate_state *s, ct_data *ltree,
+                              ct_data *dtree));
+local void set_data_type  OF((deflate_state *s));
+local unsigned bi_reverse OF((unsigned value, int length));
+local void bi_windup      OF((deflate_state *s));
+local void bi_flush       OF((deflate_state *s));
+local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
+                              int header));
+
+#ifdef GEN_TREES_H
+local void gen_trees_header OF((void));
+#endif
+
+#ifndef DEBUG
+#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
+   /* Send a code of the given tree. c and tree must not have side effects */
+
+#else /* DEBUG */
+#  define send_code(s, c, tree) \
+     { if (z_verbose>2) fprintf(stderr,(char*)"\ncd %3d ",(c)); \
+       send_bits(s, tree[c].Code, tree[c].Len); }
+#endif
+
+/* ===========================================================================
+ * Output a short LSB first on the stream.
+ * IN assertion: there is enough room in pendingBuf.
+ */
+#define put_short(s, w) { \
+    put_byte(s, (uch)((w) & 0xff)); \
+    put_byte(s, (uch)((ush)(w) >> 8)); \
+}
+
+/* ===========================================================================
+ * Send a value on a given number of bits.
+ * IN assertion: length <= 16 and value fits in length bits.
+ */
+#ifdef DEBUG
+local void send_bits      OF((deflate_state *s, int value, int length));
+
+local void send_bits(deflate_state *s, int value, int length)
+{
+    Tracevv((stderr,(char*)" l %2d v %4x ", length, value));
+    Assert(length > 0 && length <= 15, (char*)"invalid length");
+    s->bits_sent += (ulg)length;
+
+    /* If not enough room in bi_buf, use (valid) bits from bi_buf and
+     * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+     * unused bits in value.
+     */
+    if (s->bi_valid > (int)Buf_size - length) {
+        s->bi_buf |= (value << s->bi_valid);
+        put_short(s, s->bi_buf);
+        s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
+        s->bi_valid += length - Buf_size;
+    } else {
+        s->bi_buf |= value << s->bi_valid;
+        s->bi_valid += length;
+    }
+}
+#else /* !DEBUG */
+
+#define send_bits(s, value, length) \
+{ int len = length;\
+  if (s->bi_valid > (int)Buf_size - len) {\
+    int val = value;\
+    s->bi_buf |= (val << s->bi_valid);\
+    put_short(s, s->bi_buf);\
+    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
+    s->bi_valid += len - Buf_size;\
+  } else {\
+    s->bi_buf |= (value) << s->bi_valid;\
+    s->bi_valid += len;\
+  }\
+}
+#endif /* DEBUG */
+
+
+/* the arguments must not have side effects */
+
+/* ===========================================================================
+ * Initialize the various 'constant' tables.
+ */
+local void tr_static_init()
+{
+#if defined(GEN_TREES_H) || !defined(STDC)
+    static int static_init_done = 0;
+    int n;        /* iterates over tree elements */
+    int bits;     /* bit counter */
+    int length;   /* length value */
+    int code;     /* code value */
+    int dist;     /* distance index */
+    ush bl_count[MAX_BITS+1];
+    /* number of codes at each bit length for an optimal tree */
+
+    if (static_init_done) return;
+
+    /* For some embedded targets, global variables are not initialized: */
+    static_l_desc.static_tree = static_ltree;
+    static_l_desc.extra_bits = extra_lbits;
+    static_d_desc.static_tree = static_dtree;
+    static_d_desc.extra_bits = extra_dbits;
+    static_bl_desc.extra_bits = extra_blbits;
+
+    /* Initialize the mapping length (0..255) -> length code (0..28) */
+    length = 0;
+    for (code = 0; code < LENGTH_CODES-1; code++) {
+        base_length[code] = length;
+        for (n = 0; n < (1<<extra_lbits[code]); n++) {
+            _length_code[length++] = (uch)code;
+        }
+    }
+    Assert (length == 256, (char*)"tr_static_init: length != 256");
+    /* Note that the length 255 (match length 258) can be represented
+     * in two different ways: code 284 + 5 bits or code 285, so we
+     * overwrite length_code[255] to use the best encoding:
+     */
+    _length_code[length-1] = (uch)code;
+
+    /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
+    dist = 0;
+    for (code = 0 ; code < 16; code++) {
+        base_dist[code] = dist;
+        for (n = 0; n < (1<<extra_dbits[code]); n++) {
+            _dist_code[dist++] = (uch)code;
+        }
+    }
+    Assert (dist == 256, (char*)"tr_static_init: dist != 256");
+    dist >>= 7; /* from now on, all distances are divided by 128 */
+    for ( ; code < D_CODES; code++) {
+        base_dist[code] = dist << 7;
+        for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
+            _dist_code[256 + dist++] = (uch)code;
+        }
+    }
+    Assert (dist == 256, (char*)"tr_static_init: 256+dist != 512");
+
+    /* Construct the codes of the static literal tree */
+    for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
+    n = 0;
+    while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
+    while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
+    while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
+    while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
+    /* Codes 286 and 287 do not exist, but we must include them in the
+     * tree construction to get a canonical Huffman tree (longest code
+     * all ones)
+     */
+    gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
+
+    /* The static distance tree is trivial: */
+    for (n = 0; n < D_CODES; n++) {
+        static_dtree[n].Len = 5;
+        static_dtree[n].Code = bi_reverse((unsigned)n, 5);
+    }
+    static_init_done = 1;
+
+#  ifdef GEN_TREES_H
+    gen_trees_header();
+#  endif
+#endif /* defined(GEN_TREES_H) || !defined(STDC) */
+}
+
+/* ===========================================================================
+ * Genererate the file trees.h describing the static trees.
+ */
+#ifdef GEN_TREES_H
+#  ifndef DEBUG
+#    include <stdio.h>
+#  endif
+
+#  define SEPARATOR(i, last, width) \
+      ((i) == (last)? (char*)"\n};\n\n" :    \
+       ((i) % (width) == (width)-1 ? (char*)",\n" : ", "))
+
+void gen_trees_header()
+{
+    FILE *header = fopen((char*)"trees.h", (char*)"w");
+    int i;
+
+    Assert (header != NULL, (char*)"Can't open trees.h");
+    fprintf(header,
+            (char*)"/* header created automatically with -DGEN_TREES_H */\n\n");
+
+    fprintf(header, (char*)"local const ct_data static_ltree[L_CODES+2] = {\n");
+    for (i = 0; i < L_CODES+2; i++) {
+        fprintf(header, (char*)"{{%3u},{%3u}}%s", static_ltree[i].Code,
+                static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
+    }
+
+    fprintf(header, (char*)"local const ct_data static_dtree[D_CODES] = {\n");
+    for (i = 0; i < D_CODES; i++) {
+        fprintf(header, (char*)"{{%2u},{%2u}}%s", static_dtree[i].Code,
+                static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
+    }
+
+    fprintf(header, (char*)"const uch _dist_code[DIST_CODE_LEN] = {\n");
+    for (i = 0; i < DIST_CODE_LEN; i++) {
+        fprintf(header, (char*)"%2u%s", _dist_code[i],
+                SEPARATOR(i, DIST_CODE_LEN-1, 20));
+    }
+
+    fprintf(header, (char*)"const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+    for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
+        fprintf(header, (char*)"%2u%s", _length_code[i],
+                SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
+    }
+
+    fprintf(header, (char*)"local const int base_length[LENGTH_CODES] = {\n");
+    for (i = 0; i < LENGTH_CODES; i++) {
+        fprintf(header, (char*)"%1u%s", base_length[i],
+                SEPARATOR(i, LENGTH_CODES-1, 20));
+    }
+
+    fprintf(header, (char*)"local const int base_dist[D_CODES] = {\n");
+    for (i = 0; i < D_CODES; i++) {
+        fprintf(header, (char*)"%5u%s", base_dist[i],
+                SEPARATOR(i, D_CODES-1, 10));
+    }
+
+    fclose(header);
+}
+#endif /* GEN_TREES_H */
+
+/* ===========================================================================
+ * Initialize the tree data structures for a new zlib stream.
+ */
+void _tr_init(deflate_state *s)
+{
+    tr_static_init();
+
+    s->l_desc.dyn_tree = s->dyn_ltree;
+    s->l_desc.stat_desc = &static_l_desc;
+
+    s->d_desc.dyn_tree = s->dyn_dtree;
+    s->d_desc.stat_desc = &static_d_desc;
+
+    s->bl_desc.dyn_tree = s->bl_tree;
+    s->bl_desc.stat_desc = &static_bl_desc;
+
+    s->bi_buf = 0;
+    s->bi_valid = 0;
+    s->last_eob_len = 8; /* enough lookahead for inflate */
+#ifdef DEBUG
+    s->compressed_len = 0L;
+    s->bits_sent = 0L;
+#endif
+
+    /* Initialize the first block of the first file: */
+    init_block(s);
+}
+
+/* ===========================================================================
+ * Initialize a new block.
+ */
+local void init_block(deflate_state *s)
+{
+    int n; /* iterates over tree elements */
+
+    /* Initialize the trees. */
+    for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
+    for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
+    for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
+
+    s->dyn_ltree[END_BLOCK].Freq = 1;
+    s->opt_len = s->static_len = 0L;
+    s->last_lit = s->matches = 0;
+}
+
+#define SMALLEST 1
+/* Index within the heap array of least frequent node in the Huffman tree */
+
+
+/* ===========================================================================
+ * Remove the smallest element from the heap and recreate the heap with
+ * one less element. Updates heap and heap_len.
+ */
+#define pqremove(s, tree, top) \
+{\
+    top = s->heap[SMALLEST]; \
+    s->heap[SMALLEST] = s->heap[s->heap_len--]; \
+    pqdownheap(s, tree, SMALLEST); \
+}
+
+/* ===========================================================================
+ * Compares to subtrees, using the tree depth as tie breaker when
+ * the subtrees have equal frequency. This minimizes the worst case length.
+ */
+#define smaller(tree, n, m, depth) \
+   (tree[n].Freq < tree[m].Freq || \
+   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
+
+/* ===========================================================================
+ * Restore the heap property by moving down the tree starting at node k,
+ * exchanging a node with the smallest of its two sons if necessary, stopping
+ * when the heap property is re-established (each father smaller than its
+ * two sons).
+ */
+local void pqdownheap(deflate_state *s, ct_data *tree, int k)
+{
+    int v = s->heap[k];
+    int j = k << 1;  /* left son of k */
+    while (j <= s->heap_len) {
+        /* Set j to the smallest of the two sons: */
+        if (j < s->heap_len &&
+            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
+            j++;
+        }
+        /* Exit if v is smaller than both sons */
+        if (smaller(tree, v, s->heap[j], s->depth)) break;
+
+        /* Exchange v with the smallest son */
+        s->heap[k] = s->heap[j];  k = j;
+
+        /* And continue down the tree, setting j to the left son of k */
+        j <<= 1;
+    }
+    s->heap[k] = v;
+}
+
+/* ===========================================================================
+ * Compute the optimal bit lengths for a tree and update the total bit length
+ * for the current block.
+ * IN assertion: the fields freq and dad are set, heap[heap_max] and
+ *    above are the tree nodes sorted by increasing frequency.
+ * OUT assertions: the field len is set to the optimal bit length, the
+ *     array bl_count contains the frequencies for each bit length.
+ *     The length opt_len is updated; static_len is also updated if stree is
+ *     not null.
+ */
+local void gen_bitlen(deflate_state *s, tree_desc *desc)
+{
+    ct_data *tree        = desc->dyn_tree;
+    int max_code         = desc->max_code;
+    const ct_data *stree = desc->stat_desc->static_tree;
+    const intf *extra    = desc->stat_desc->extra_bits;
+    int base             = desc->stat_desc->extra_base;
+    int max_length       = desc->stat_desc->max_length;
+    int h;              /* heap index */
+    int n, m;           /* iterate over the tree elements */
+    int bits;           /* bit length */
+    int xbits;          /* extra bits */
+    ush f;              /* frequency */
+    int overflow = 0;   /* number of elements with bit length too large */
+
+    for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
+
+    /* In a first pass, compute the optimal bit lengths (which may
+     * overflow in the case of the bit length tree).
+     */
+    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
+
+    for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+        n = s->heap[h];
+        bits = tree[tree[n].Dad].Len + 1;
+        if (bits > max_length) bits = max_length, overflow++;
+        tree[n].Len = (ush)bits;
+        /* We overwrite tree[n].Dad which is no longer needed */
+
+        if (n > max_code) continue; /* not a leaf node */
+
+        s->bl_count[bits]++;
+        xbits = 0;
+        if (n >= base) xbits = extra[n-base];
+        f = tree[n].Freq;
+        s->opt_len += (ulg)f * (bits + xbits);
+        if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
+    }
+    if (overflow == 0) return;
+
+    Trace((stderr,(char*)"\nbit length overflow\n"));
+    /* This happens for example on obj2 and pic of the Calgary corpus */
+
+    /* Find the first bit length which could increase: */
+    do {
+        bits = max_length-1;
+        while (s->bl_count[bits] == 0) bits--;
+        s->bl_count[bits]--;      /* move one leaf down the tree */
+        s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+        s->bl_count[max_length]--;
+        /* The brother of the overflow item also moves one step up,
+         * but this does not affect bl_count[max_length]
+         */
+        overflow -= 2;
+    } while (overflow > 0);
+
+    /* Now recompute all bit lengths, scanning in increasing frequency.
+     * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
+     * lengths instead of fixing only the wrong ones. This idea is taken
+     * from 'ar' written by Haruhiko Okumura.)
+     */
+    for (bits = max_length; bits != 0; bits--) {
+        n = s->bl_count[bits];
+        while (n != 0) {
+            m = s->heap[--h];
+            if (m > max_code) continue;
+            if (tree[m].Len != (unsigned) bits) {
+                Trace((stderr,(char*)"code %d bits %d->%d\n", m, tree[m].Len, bits));
+                s->opt_len += ((long)bits - (long)tree[m].Len)
+                              *(long)tree[m].Freq;
+                tree[m].Len = (ush)bits;
+            }
+            n--;
+        }
+    }
+}
+
+/* ===========================================================================
+ * Generate the codes for a given tree and bit counts (which need not be
+ * optimal).
+ * IN assertion: the array bl_count contains the bit length statistics for
+ * the given tree and the field len is set for all tree elements.
+ * OUT assertion: the field code is set for all tree elements of non
+ *     zero code length.
+ */
+local void gen_codes (ct_data *tree, int max_code, ushf *bl_count)
+{
+    ush next_code[MAX_BITS+1]; /* next code value for each bit length */
+    ush code = 0;              /* running code value */
+    int bits;                  /* bit index */
+    int n;                     /* code index */
+
+    /* The distribution counts are first used to generate the code values
+     * without bit reversal.
+     */
+    for (bits = 1; bits <= MAX_BITS; bits++) {
+        next_code[bits] = code = (code + bl_count[bits-1]) << 1;
+    }
+    /* Check that the bit counts in bl_count are consistent. The last code
+     * must be all ones.
+     */
+    Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
+            (char*)"inconsistent bit counts");
+    Tracev((stderr,(char*)"\ngen_codes: max_code %d ", max_code));
+
+    for (n = 0;  n <= max_code; n++) {
+        int len = tree[n].Len;
+        if (len == 0) continue;
+        /* Now reverse the bits */
+        tree[n].Code = bi_reverse(next_code[len]++, len);
+
+        Tracecv(tree != static_ltree, (stderr,(char*)"\nn %3d %c l %2d c %4x (%x) ",
+             n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
+    }
+}
+
+/* ===========================================================================
+ * Construct one Huffman tree and assigns the code bit strings and lengths.
+ * Update the total bit length for the current block.
+ * IN assertion: the field freq is set for all tree elements.
+ * OUT assertions: the fields len and code are set to the optimal bit length
+ *     and corresponding code. The length opt_len is updated; static_len is
+ *     also updated if stree is not null. The field max_code is set.
+ */
+local void build_tree(deflate_state *s, tree_desc *desc)
+{
+    ct_data *tree         = desc->dyn_tree;
+    const ct_data *stree  = desc->stat_desc->static_tree;
+    int elems             = desc->stat_desc->elems;
+    int n, m;          /* iterate over heap elements */
+    int max_code = -1; /* largest code with non zero frequency */
+    int node;          /* new node being created */
+
+    /* Construct the initial heap, with least frequent element in
+     * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+     * heap[0] is not used.
+     */
+    s->heap_len = 0, s->heap_max = HEAP_SIZE;
+
+    for (n = 0; n < elems; n++) {
+        if (tree[n].Freq != 0) {
+            s->heap[++(s->heap_len)] = max_code = n;
+            s->depth[n] = 0;
+        } else {
+            tree[n].Len = 0;
+        }
+    }
+
+    /* The pkzip format requires that at least one distance code exists,
+     * and that at least one bit should be sent even if there is only one
+     * possible code. So to avoid special checks later on we force at least
+     * two codes of non zero frequency.
+     */
+    while (s->heap_len < 2) {
+        node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
+        tree[node].Freq = 1;
+        s->depth[node] = 0;
+        s->opt_len--; if (stree) s->static_len -= stree[node].Len;
+        /* node is 0 or 1 so it does not have extra bits */
+    }
+    desc->max_code = max_code;
+
+    /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+     * establish sub-heaps of increasing lengths:
+     */
+    for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
+
+    /* Construct the Huffman tree by repeatedly combining the least two
+     * frequent nodes.
+     */
+    node = elems;              /* next internal node of the tree */
+    do {
+        pqremove(s, tree, n);  /* n = node of least frequency */
+        m = s->heap[SMALLEST]; /* m = node of next least frequency */
+
+        s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
+        s->heap[--(s->heap_max)] = m;
+
+        /* Create a new node father of n and m */
+        tree[node].Freq = tree[n].Freq + tree[m].Freq;
+        s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
+                                s->depth[n] : s->depth[m]) + 1);
+        tree[n].Dad = tree[m].Dad = (ush)node;
+#ifdef DUMP_BL_TREE
+        if (tree == s->bl_tree) {
+            fprintf(stderr,(char*)"\nnode %d(%d), sons %d(%d) %d(%d)",
+                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
+        }
+#endif
+        /* and insert the new node in the heap */
+        s->heap[SMALLEST] = node++;
+        pqdownheap(s, tree, SMALLEST);
+
+    } while (s->heap_len >= 2);
+
+    s->heap[--(s->heap_max)] = s->heap[SMALLEST];
+
+    /* At this point, the fields freq and dad are set. We can now
+     * generate the bit lengths.
+     */
+    gen_bitlen(s, (tree_desc *)desc);
+
+    /* The field len is now set, we can generate the bit codes */
+    gen_codes ((ct_data *)tree, max_code, s->bl_count);
+}
+
+/* ===========================================================================
+ * Scan a literal or distance tree to determine the frequencies of the codes
+ * in the bit length tree.
+ */
+local void scan_tree (deflate_state *s, ct_data *tree, int max_code)
+{
+    int n;                     /* iterates over all tree elements */
+    int prevlen = -1;          /* last emitted length */
+    int curlen;                /* length of current code */
+    int nextlen = tree[0].Len; /* length of next code */
+    int count = 0;             /* repeat count of the current code */
+    int max_count = 7;         /* max repeat count */
+    int min_count = 4;         /* min repeat count */
+
+    if (nextlen == 0) max_count = 138, min_count = 3;
+    tree[max_code+1].Len = (ush)0xffff; /* guard */
+
+    for (n = 0; n <= max_code; n++) {
+        curlen = nextlen; nextlen = tree[n+1].Len;
+        if (++count < max_count && curlen == nextlen) {
+            continue;
+        } else if (count < min_count) {
+            s->bl_tree[curlen].Freq += count;
+        } else if (curlen != 0) {
+            if (curlen != prevlen) s->bl_tree[curlen].Freq++;
+            s->bl_tree[REP_3_6].Freq++;
+        } else if (count <= 10) {
+            s->bl_tree[REPZ_3_10].Freq++;
+        } else {
+            s->bl_tree[REPZ_11_138].Freq++;
+        }
+        count = 0; prevlen = curlen;
+        if (nextlen == 0) {
+            max_count = 138, min_count = 3;
+        } else if (curlen == nextlen) {
+            max_count = 6, min_count = 3;
+        } else {
+            max_count = 7, min_count = 4;
+        }
+    }
+}
+
+/* ===========================================================================
+ * Send a literal or distance tree in compressed form, using the codes in
+ * bl_tree.
+ */
+local void send_tree (deflate_state *s, ct_data *tree, int max_code)
+{
+    int n;                     /* iterates over all tree elements */
+    int prevlen = -1;          /* last emitted length */
+    int curlen;                /* length of current code */
+    int nextlen = tree[0].Len; /* length of next code */
+    int count = 0;             /* repeat count of the current code */
+    int max_count = 7;         /* max repeat count */
+    int min_count = 4;         /* min repeat count */
+
+    /* tree[max_code+1].Len = -1; */  /* guard already set */
+    if (nextlen == 0) max_count = 138, min_count = 3;
+
+    for (n = 0; n <= max_code; n++) {
+        curlen = nextlen; nextlen = tree[n+1].Len;
+        if (++count < max_count && curlen == nextlen) {
+            continue;
+        } else if (count < min_count) {
+            do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
+
+        } else if (curlen != 0) {
+            if (curlen != prevlen) {
+                send_code(s, curlen, s->bl_tree); count--;
+            }
+            Assert(count >= 3 && count <= 6, (char*)" 3_6?");
+            send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
+
+        } else if (count <= 10) {
+            send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
+
+        } else {
+            send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
+        }
+        count = 0; prevlen = curlen;
+        if (nextlen == 0) {
+            max_count = 138, min_count = 3;
+        } else if (curlen == nextlen) {
+            max_count = 6, min_count = 3;
+        } else {
+            max_count = 7, min_count = 4;
+        }
+    }
+}
+
+/* ===========================================================================
+ * Construct the Huffman tree for the bit lengths and return the index in
+ * bl_order of the last bit length code to send.
+ */
+local int build_bl_tree(deflate_state *s)
+{
+    int max_blindex;  /* index of last bit length code of non zero freq */
+
+    /* Determine the bit length frequencies for literal and distance trees */
+    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
+    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
+
+    /* Build the bit length tree: */
+    build_tree(s, (tree_desc *)(&(s->bl_desc)));
+    /* opt_len now includes the length of the tree representations, except
+     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+     */
+
+    /* Determine the number of bit length codes to send. The pkzip format
+     * requires that at least 4 bit length codes be sent. (appnote.txt says
+     * 3 but the actual value used is 4.)
+     */
+    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
+        if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
+    }
+    /* Update opt_len to include the bit length tree and counts */
+    s->opt_len += 3*(max_blindex+1) + 5+5+4;
+    Tracev((stderr, (char*)"\ndyn trees: dyn %ld, stat %ld",
+            s->opt_len, s->static_len));
+
+    return max_blindex;
+}
+
+/* ===========================================================================
+ * Send the header for a block using dynamic Huffman trees: the counts, the
+ * lengths of the bit length codes, the literal tree and the distance tree.
+ * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
+ */
+local void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes)
+{
+    int rank;                    /* index in bl_order */
+
+    Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, (char*)"not enough codes");
+    Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
+            (char*)"too many codes");
+    Tracev((stderr, (char*)"\nbl counts: "));
+    send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
+    send_bits(s, dcodes-1,   5);
+    send_bits(s, blcodes-4,  4); /* not -3 as stated in appnote.txt */
+    for (rank = 0; rank < blcodes; rank++) {
+        Tracev((stderr, (char*)"\nbl code %2d ", bl_order[rank]));
+        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
+    }
+    Tracev((stderr, (char*)"\nbl tree: sent %ld", s->bits_sent));
+
+    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
+    Tracev((stderr, (char*)"\nlit tree: sent %ld", s->bits_sent));
+
+    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
+    Tracev((stderr, (char*)"\ndist tree: sent %ld", s->bits_sent));
+}
+
+/* ===========================================================================
+ * Send a stored block
+ */
+void _tr_stored_block(deflate_state *s, charf *buf, ulg stored_len, int eof)
+{
+    send_bits(s, (STORED_BLOCK<<1)+eof, 3);  /* send block type */
+#ifdef DEBUG
+    s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
+    s->compressed_len += (stored_len + 4) << 3;
+#endif
+    copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
+}
+
+/* ===========================================================================
+ * Send one empty static block to give enough lookahead for inflate.
+ * This takes 10 bits, of which 7 may remain in the bit buffer.
+ * The current inflate code requires 9 bits of lookahead. If the
+ * last two codes for the previous block (real code plus EOB) were coded
+ * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
+ * the last real code. In this case we send two empty static blocks instead
+ * of one. (There are no problems if the previous block is stored or fixed.)
+ * To simplify the code, we assume the worst case of last real code encoded
+ * on one bit only.
+ */
+void _tr_align(deflate_state *s)
+{
+    send_bits(s, STATIC_TREES<<1, 3);
+    send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+    s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
+#endif
+    bi_flush(s);
+    /* Of the 10 bits for the empty block, we have already sent
+     * (10 - bi_valid) bits. The lookahead for the last real code (before
+     * the EOB of the previous block) was thus at least one plus the length
+     * of the EOB plus what we have just sent of the empty static block.
+     */
+    if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
+        send_bits(s, STATIC_TREES<<1, 3);
+        send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+        s->compressed_len += 10L;
+#endif
+        bi_flush(s);
+    }
+    s->last_eob_len = 7;
+}
+
+/* ===========================================================================
+ * Determine the best encoding for the current block: dynamic trees, static
+ * trees or store, and output the encoded block to the zip file.
+ */
+void _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len, int eof)
+{
+    ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+    int max_blindex = 0;  /* index of last bit length code of non zero freq */
+
+    /* Build the Huffman trees unless a stored block is forced */
+    if (s->level > 0) {
+
+         /* Check if the file is ascii or binary */
+        if (s->strm->data_type == Z_UNKNOWN) set_data_type(s);
+
+        /* Construct the literal and distance trees */
+        build_tree(s, (tree_desc *)(&(s->l_desc)));
+        Tracev((stderr, (char*)"\nlit data: dyn %ld, stat %ld", s->opt_len,
+                s->static_len));
+
+        build_tree(s, (tree_desc *)(&(s->d_desc)));
+        Tracev((stderr, (char*)"\ndist data: dyn %ld, stat %ld", s->opt_len,
+                s->static_len));
+        /* At this point, opt_len and static_len are the total bit lengths of
+         * the compressed block data, excluding the tree representations.
+         */
+
+        /* Build the bit length tree for the above two trees, and get the index
+         * in bl_order of the last bit length code to send.
+         */
+        max_blindex = build_bl_tree(s);
+
+        /* Determine the best encoding. Compute the block lengths in bytes. */
+        opt_lenb = (s->opt_len+3+7)>>3;
+        static_lenb = (s->static_len+3+7)>>3;
+
+        Tracev((stderr, (char*)"\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
+                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
+                s->last_lit));
+
+        if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
+
+    } else {
+        Assert(buf != (char*)0, (char*)"lost buf");
+        opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
+    }
+
+#ifdef FORCE_STORED
+    if (buf != (char*)0) { /* force stored block */
+#else
+    if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+                       /* 4: two words for the lengths */
+#endif
+        /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
+         * Otherwise we can't have processed more than WSIZE input bytes since
+         * the last block flush, because compression would have been
+         * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
+         * transform a block into a stored block.
+         */
+        _tr_stored_block(s, buf, stored_len, eof);
+
+#ifdef FORCE_STATIC
+    } else if (static_lenb >= 0) { /* force static trees */
+#else
+    } else if (static_lenb == opt_lenb) {
+#endif
+        send_bits(s, (STATIC_TREES<<1)+eof, 3);
+        compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
+#ifdef DEBUG
+        s->compressed_len += 3 + s->static_len;
+#endif
+    } else {
+        send_bits(s, (DYN_TREES<<1)+eof, 3);
+        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
+                       max_blindex+1);
+        compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
+#ifdef DEBUG
+        s->compressed_len += 3 + s->opt_len;
+#endif
+    }
+    Assert (s->compressed_len == s->bits_sent, (char*)"bad compressed size");
+    /* The above check is made mod 2^32, for files larger than 512 MB
+     * and uLong implemented on 32 bits.
+     */
+    init_block(s);
+
+    if (eof) {
+        bi_windup(s);
+#ifdef DEBUG
+        s->compressed_len += 7;  /* align on byte boundary */
+#endif
+    }
+    Tracev((stderr,(char*)"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
+           s->compressed_len-7*eof));
+}
+
+/* ===========================================================================
+ * Save the match info and tally the frequency counts. Return true if
+ * the current block must be flushed.
+ */
+int _tr_tally (deflate_state *s, unsigned dist, unsigned lc)
+{
+    s->d_buf[s->last_lit] = (ush)dist;
+    s->l_buf[s->last_lit++] = (uch)lc;
+    if (dist == 0) {
+        /* lc is the unmatched char */
+        s->dyn_ltree[lc].Freq++;
+    } else {
+        s->matches++;
+        /* Here, lc is the match length - MIN_MATCH */
+        dist--;             /* dist = match distance - 1 */
+        Assert((ush)dist < (ush)MAX_DIST(s) &&
+               (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
+               (ush)d_code(dist) < (ush)D_CODES,  (char*)"_tr_tally: bad match");
+
+        s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+        s->dyn_dtree[d_code(dist)].Freq++;
+    }
+
+#ifdef TRUNCATE_BLOCK
+    /* Try to guess if it is profitable to stop the current block here */
+    if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
+        /* Compute an upper bound for the compressed length */
+        ulg out_length = (ulg)s->last_lit*8L;
+        ulg in_length = (ulg)((long)s->strstart - s->block_start);
+        int dcode;
+        for (dcode = 0; dcode < D_CODES; dcode++) {
+            out_length += (ulg)s->dyn_dtree[dcode].Freq *
+                (5L+extra_dbits[dcode]);
+        }
+        out_length >>= 3;
+        Tracev((stderr,(char*)"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
+               s->last_lit, in_length, out_length,
+               100L - out_length*100L/in_length));
+        if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
+    }
+#endif
+    return (s->last_lit == s->lit_bufsize-1);
+    /* We avoid equality with lit_bufsize because of wraparound at 64K
+     * on 16 bit machines and because stored blocks are restricted to
+     * 64K-1 bytes.
+     */
+}
+
+/* ===========================================================================
+ * Send the block data compressed using the given Huffman trees
+ */
+local void compress_block(deflate_state *s, ct_data *ltree, ct_data *dtree)
+{
+    unsigned dist;      /* distance of matched string */
+    int lc;             /* match length or unmatched char (if dist == 0) */
+    unsigned lx = 0;    /* running index in l_buf */
+    unsigned code;      /* the code to send */
+    int extra;          /* number of extra bits to send */
+
+    if (s->last_lit != 0) do {
+        dist = s->d_buf[lx];
+        lc = s->l_buf[lx++];
+        if (dist == 0) {
+            send_code(s, lc, ltree); /* send a literal byte */
+            Tracecv(isgraph(lc), (stderr," '%c' ", lc));
+        } else {
+            /* Here, lc is the match length - MIN_MATCH */
+            code = _length_code[lc];
+            send_code(s, code+LITERALS+1, ltree); /* send the length code */
+            extra = extra_lbits[code];
+            if (extra != 0) {
+                lc -= base_length[code];
+                send_bits(s, lc, extra);       /* send the extra length bits */
+            }
+            dist--; /* dist is now the match distance - 1 */
+            code = d_code(dist);
+            Assert (code < D_CODES, (char*)"bad d_code");
+
+            send_code(s, code, dtree);       /* send the distance code */
+            extra = extra_dbits[code];
+            if (extra != 0) {
+                dist -= base_dist[code];
+                send_bits(s, dist, extra);   /* send the extra distance bits */
+            }
+        } /* literal or match pair ? */
+
+        /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
+        Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
+               (char*)"pendingBuf overflow");
+
+    } while (lx < s->last_lit);
+
+    send_code(s, END_BLOCK, ltree);
+    s->last_eob_len = ltree[END_BLOCK].Len;
+}
+
+/* ===========================================================================
+ * Set the data type to ASCII or BINARY, using a crude approximation:
+ * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
+ * IN assertion: the fields freq of dyn_ltree are set and the total of all
+ * frequencies does not exceed 64K (to fit in an int on 16 bit machines).
+ */
+local void set_data_type(deflate_state *s)
+{
+    int n = 0;
+    unsigned ascii_freq = 0;
+    unsigned bin_freq = 0;
+    while (n < 7)        bin_freq += s->dyn_ltree[n++].Freq;
+    while (n < 128)    ascii_freq += s->dyn_ltree[n++].Freq;
+    while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
+    s->strm->data_type = bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII;
+}
+
+/* ===========================================================================
+ * Reverse the first len bits of a code, using straightforward code (a faster
+ * method would use a table)
+ * IN assertion: 1 <= len <= 15
+ */
+local unsigned bi_reverse(unsigned code, int len)
+{
+    register unsigned res = 0;
+    do {
+        res |= code & 1;
+        code >>= 1, res <<= 1;
+    } while (--len > 0);
+    return res >> 1;
+}
+
+/* ===========================================================================
+ * Flush the bit buffer, keeping at most 7 bits in it.
+ */
+local void bi_flush(deflate_state *s)
+{
+    if (s->bi_valid == 16) {
+        put_short(s, s->bi_buf);
+        s->bi_buf = 0;
+        s->bi_valid = 0;
+    } else if (s->bi_valid >= 8) {
+        put_byte(s, (Byte)s->bi_buf);
+        s->bi_buf >>= 8;
+        s->bi_valid -= 8;
+    }
+}
+
+/* ===========================================================================
+ * Flush the bit buffer and align the output on a byte boundary
+ */
+local void bi_windup(deflate_state *s)
+{
+    if (s->bi_valid > 8) {
+        put_short(s, s->bi_buf);
+    } else if (s->bi_valid > 0) {
+        put_byte(s, (Byte)s->bi_buf);
+    }
+    s->bi_buf = 0;
+    s->bi_valid = 0;
+#ifdef DEBUG
+    s->bits_sent = (s->bits_sent+7) & ~7;
+#endif
+}
+
+/* ===========================================================================
+ * Copy a stored block, storing first the length and its
+ * one's complement if requested.
+ */
+local void copy_block(deflate_state *s, charf    *buf, unsigned len, int header)
+{
+    bi_windup(s);        /* align on byte boundary */
+    s->last_eob_len = 8; /* enough lookahead for inflate */
+
+    if (header) {
+        put_short(s, (ush)len);
+        put_short(s, (ush)~len);
+#ifdef DEBUG
+        s->bits_sent += 2*16;
+#endif
+    }
+#ifdef DEBUG
+    s->bits_sent += (ulg)len<<3;
+#endif
+    while (len--) {
+        put_byte(s, *buf++);
+    }
+}
Index: trunk/geant4/visualization/externals/zlib/src/zutil.cc
===================================================================
--- trunk/geant4/visualization/externals/zlib/src/zutil.cc	(revision 562)
+++ trunk/geant4/visualization/externals/zlib/src/zutil.cc	(revision 562)
@@ -0,0 +1,304 @@
+/* zutil.c -- target dependent utility functions for the compression library
+ * Copyright (C) 1995-2003 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zutil.cc,v 1.1 2005/05/12 21:04:53 duns Exp $ */
+
+#include "zutil.h"
+
+#ifndef NO_DUMMY_DECL
+struct internal_state      {int dummy;}; /* for buggy compilers */
+#endif
+
+#ifndef STDC
+extern void exit OF((int));
+#endif
+
+const char * const z_errmsg[10] = {
+"need dictionary",     /* Z_NEED_DICT       2  */
+"stream end",          /* Z_STREAM_END      1  */
+"",                    /* Z_OK              0  */
+"file error",          /* Z_ERRNO         (-1) */
+"stream error",        /* Z_STREAM_ERROR  (-2) */
+"data error",          /* Z_DATA_ERROR    (-3) */
+"insufficient memory", /* Z_MEM_ERROR     (-4) */
+"buffer error",        /* Z_BUF_ERROR     (-5) */
+"incompatible version",/* Z_VERSION_ERROR (-6) */
+""};
+
+
+const char * ZEXPORT zlibVersion()
+{
+    return ZLIB_VERSION;
+}
+
+uLong ZEXPORT zlibCompileFlags()
+{
+    uLong flags;
+
+    flags = 0;
+    switch (sizeof(uInt)) {
+    case 2:     break;
+    case 4:     flags += 1;     break;
+    case 8:     flags += 2;     break;
+    default:    flags += 3;
+    }
+    switch (sizeof(uLong)) {
+    case 2:     break;
+    case 4:     flags += 1 << 2;        break;
+    case 8:     flags += 2 << 2;        break;
+    default:    flags += 3 << 2;
+    }
+    switch (sizeof(voidpf)) {
+    case 2:     break;
+    case 4:     flags += 1 << 4;        break;
+    case 8:     flags += 2 << 4;        break;
+    default:    flags += 3 << 4;
+    }
+    switch (sizeof(z_off_t)) {
+    case 2:     break;
+    case 4:     flags += 1 << 6;        break;
+    case 8:     flags += 2 << 6;        break;
+    default:    flags += 3 << 6;
+    }
+#ifdef DEBUG
+    flags += 1 << 8;
+#endif
+#if defined(ASMV) || defined(ASMINF)
+    flags += 1 << 9;
+#endif
+#ifdef ZLIB_WINAPI
+    flags += 1 << 10;
+#endif
+#ifdef BUILDFIXED
+    flags += 1 << 12;
+#endif
+#ifdef DYNAMIC_CRC_TABLE
+    flags += 1 << 13;
+#endif
+#ifdef NO_GZCOMPRESS
+    flags += 1 << 16;
+#endif
+#ifdef NO_GZIP
+    flags += 1 << 17;
+#endif
+#ifdef PKZIP_BUG_WORKAROUND
+    flags += 1 << 20;
+#endif
+#ifdef FASTEST
+    flags += 1 << 21;
+#endif
+#ifdef STDC
+#  ifdef NO_vsnprintf
+        flags += 1 << 25;
+#    ifdef HAS_vsprintf_void
+        flags += 1 << 26;
+#    endif
+#  else
+#    ifdef HAS_vsnprintf_void
+        flags += 1 << 26;
+#    endif
+#  endif
+#else
+        flags += 1 << 24;
+#  ifdef NO_snprintf
+        flags += 1 << 25;
+#    ifdef HAS_sprintf_void
+        flags += 1 << 26;
+#    endif
+#  else
+#    ifdef HAS_snprintf_void
+        flags += 1 << 26;
+#    endif
+#  endif
+#endif
+    return flags;
+}
+
+#ifdef DEBUG
+
+#  ifndef verbose
+#    define verbose 0
+#  endif
+int z_verbose = verbose;
+
+void z_error (char *m)
+{
+    fprintf(stderr, "%s\n", m);
+    exit(1);
+}
+#endif
+
+/* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+const char * ZEXPORT zError(int err)
+{
+    return ERR_MSG(err);
+}
+
+#if defined(_WIN32_WCE)
+    /* does not exist on WCE */
+    int errno = 0;
+#endif
+
+#ifndef HAVE_MEMCPY
+
+void zmemcpy(Bytef *dest, const Bytef *source, uInt len)
+{
+    if (len == 0) return;
+    do {
+        *dest++ = *source++; /* ??? to be unrolled */
+    } while (--len != 0);
+}
+
+int zmemcmp(const Bytef* s1, const Bytef* s2, uInt len)
+{
+    uInt j;
+
+    for (j = 0; j < len; j++) {
+        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+    }
+    return 0;
+}
+
+void zmemzero(Bytef *dest, uInt len)
+{
+    if (len == 0) return;
+    do {
+        *dest++ = 0;  /* ??? to be unrolled */
+    } while (--len != 0);
+}
+#endif
+
+
+#ifdef SYS16BIT
+
+#ifdef __TURBOC__
+/* Turbo C in 16-bit mode */
+
+#  define MY_ZCALLOC
+
+/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
+ * must fix the pointer. Warning: the pointer must be put back to its
+ * original form in order to free it, use zcfree().
+ */
+
+#define MAX_PTR 10
+/* 10*64K = 640K */
+
+local int next_ptr = 0;
+
+typedef struct ptr_table_s {
+    voidpf org_ptr;
+    voidpf new_ptr;
+} ptr_table;
+
+local ptr_table table[MAX_PTR];
+/* This table is used to remember the original form of pointers
+ * to large buffers (64K). Such pointers are normalized with a zero offset.
+ * Since MSDOS is not a preemptive multitasking OS, this table is not
+ * protected from concurrent access. This hack doesn't work anyway on
+ * a protected system like OS/2. Use Microsoft C instead.
+ */
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    voidpf buf = opaque; /* just to make some compilers happy */
+    ulg bsize = (ulg)items*size;
+
+    /* If we allocate less than 65520 bytes, we assume that farmalloc
+     * will return a usable pointer which doesn't have to be normalized.
+     */
+    if (bsize < 65520L) {
+        buf = farmalloc(bsize);
+        if (*(ush*)&buf != 0) return buf;
+    } else {
+        buf = farmalloc(bsize + 16L);
+    }
+    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
+    table[next_ptr].org_ptr = buf;
+
+    /* Normalize the pointer to seg:0 */
+    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
+    *(ush*)&buf = 0;
+    table[next_ptr++].new_ptr = buf;
+    return buf;
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    int n;
+    if (*(ush*)&ptr != 0) { /* object < 64K */
+        farfree(ptr);
+        return;
+    }
+    /* Find the original pointer */
+    for (n = 0; n < next_ptr; n++) {
+        if (ptr != table[n].new_ptr) continue;
+
+        farfree(table[n].org_ptr);
+        while (++n < next_ptr) {
+            table[n-1] = table[n];
+        }
+        next_ptr--;
+        return;
+    }
+    ptr = opaque; /* just to make some compilers happy */
+    Assert(0, "zcfree: ptr not found");
+}
+
+#endif /* __TURBOC__ */
+
+
+#ifdef M_I86
+/* Microsoft C in 16-bit mode */
+
+#  define MY_ZCALLOC
+
+#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
+#  define _halloc  halloc
+#  define _hfree   hfree
+#endif
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    if (opaque) opaque = 0; /* to make compiler happy */
+    return _halloc((long)items, size);
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    if (opaque) opaque = 0; /* to make compiler happy */
+    _hfree(ptr);
+}
+
+#endif /* M_I86 */
+
+#endif /* SYS16BIT */
+
+
+#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+
+#ifndef STDC
+extern voidp  malloc OF((uInt size));
+extern voidp  calloc OF((uInt items, uInt size));
+extern void   free   OF((voidpf ptr));
+#endif
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+    if (opaque) items += size - size; /* make compiler happy */
+    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
+                              (voidpf)calloc(items, size);
+}
+
+void  zcfree (voidpf opaque, voidpf ptr)
+{
+    free(ptr);
+    if (opaque) return; /* make compiler happy */
+}
+
+#endif /* MY_ZCALLOC */
Index: trunk/geant4/visualization/run1.mac
===================================================================
--- trunk/geant4/visualization/run1.mac	(revision 562)
+++ trunk/geant4/visualization/run1.mac	(revision 562)
@@ -0,0 +1,20 @@
+# $Id: run1.mac,v 1.2 2000/11/21 10:59:42 maire Exp $
+#
+# Macro file for "exampleN03.cc"
+# 
+# can be run in batch, without graphic
+# or interactively: Idle> /control/execute run1.mac
+#
+/control/verbose 2
+/control/saveHistory
+#
+/run/verbose 2
+/event/verbose 0
+/tracking/verbose 1
+# 
+# muon 300 MeV to the direction (1.,0.,0.)
+# 3 events
+#
+/gun/particle mu+
+/gun/energy 300 MeV
+/run/beamOn 3
Index: trunk/geant4/visualization/run2.mac
===================================================================
--- trunk/geant4/visualization/run2.mac	(revision 562)
+++ trunk/geant4/visualization/run2.mac	(revision 562)
@@ -0,0 +1,28 @@
+# $Id: run2.mac,v 1.6 2002/12/16 16:37:25 maire Exp $
+#
+# Macro file of "exampleN03.cc"
+#
+# can be run in batch, without graphic
+# or interactively: Idle> /control/execute run2.mac
+#
+/control/verbose 2
+# 
+# electron 30 MeV to the direction (1.,0.,0.)
+# 1 event
+#
+/run/beamOn 1
+#
+# shoot randomly 20 events
+#
+/N03/event/printModulo 5
+/N03/gun/rndm on
+/run/beamOn 20
+#
+# activate/inactivate physic processes
+#
+/process/list
+/process/inactivate eBrem
+#
+/run/beamOn 20
+#
+
Index: trunk/geant4/visualization/vis-mv.mac
===================================================================
--- trunk/geant4/visualization/vis-mv.mac	(revision 562)
+++ trunk/geant4/visualization/vis-mv.mac	(revision 562)
@@ -0,0 +1,66 @@
+#
+# Macro file for the initialization phase of "exampleN03.cc"
+# when running in interactive mode
+#
+# Sets some default verbose
+#
+/control/verbose 2
+/control/saveHistory
+/run/verbose 2
+#
+# create empty scene
+#
+/vis/scene/create
+#
+# Create a scene handler for a specific graphics system
+# (Edit the next line(s) to choose another graphic system)
+#
+# Use this open statement to get an .eps and .prim files
+# suitable for viewing in DAWN.
+/vis/open DAWNFILE
+#
+# Use this open statement instead for OpenGL in immediate mode.
+/vis/open OGLIQT
+#/vis/open OGLIX
+#
+# Use this open statement instead to get a HepRep version 1 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepFile
+#
+# Use this open statement instead to get a HepRep version 2 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepXML
+#
+# Output an empty detector
+/vis/viewer/flush
+#
+# Draw trajectories at end of event, showing trajectory points as
+# markers of size 2 pixels
+#/vis/scene/add/trajectories
+/vis/modeling/trajectories/create/drawByCharge
+/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
+# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
+#
+# To draw gammas only
+#/vis/filtering/trajectories/create/particleFilter
+#/vis/filtering/trajectories/particleFilter-0/add gamma
+#
+# To draw charged particles only
+#/vis/filtering/trajectories/particleFilter-0/invert true
+#
+# Many other options available with /vis/modeling and /vis/filtering.
+# For example, select colour by particle ID
+#/vis/modeling/trajectories/create/drawByParticleID
+#/vis/modeling/trajectories/drawByParticleID-0/set e- red
+#
+/vis/scene/endOfEventAction accumulate
+#
+# At end of each run, an automatic flush causes graphical output.
+#/run/beamOn 1
+# When you exit Geant4, you will find a file called scene-0.heprep.zip.
+# Unzipping this will give you three separate HepRep files suitable for
+# viewing in WIRED.
+# The first file will contain just detector geometry.
+# The second file will contain the detector plus one event.
+# The third file will contain the detector plus ten events.
Index: trunk/geant4/visualization/vis-simple.mac
===================================================================
--- trunk/geant4/visualization/vis-simple.mac	(revision 562)
+++ trunk/geant4/visualization/vis-simple.mac	(revision 562)
@@ -0,0 +1,66 @@
+#
+# Macro file for the initialization phase of "exampleN03.cc"
+# when running in interactive mode
+#
+# Sets some default verbose
+#
+/control/verbose 2
+/control/saveHistory
+/run/verbose 2
+#
+# create empty scene
+#
+/vis/scene/create
+#
+# Create a scene handler for a specific graphics system
+# (Edit the next line(s) to choose another graphic system)
+#
+# Use this open statement to get an .eps and .prim files
+# suitable for viewing in DAWN.
+#--- /vis/open DAWNFILE
+#
+# Use this open statement instead for OpenGL in immediate mode.
+/vis/open OGLIQT
+#/vis/open OGLIX
+#
+# Use this open statement instead to get a HepRep version 1 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepFile
+#
+# Use this open statement instead to get a HepRep version 2 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepXML
+#
+# Output an empty detector
+#--- /vis/viewer/flush
+#
+# Draw trajectories at end of event, showing trajectory points as
+# markers of size 2 pixels
+#/vis/scene/add/trajectories
+#--- /vis/modeling/trajectories/create/drawByCharge
+#--- /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+#--- /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
+# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
+#
+# To draw gammas only
+#/vis/filtering/trajectories/create/particleFilter
+#/vis/filtering/trajectories/particleFilter-0/add gamma
+#
+# To draw charged particles only
+#/vis/filtering/trajectories/particleFilter-0/invert true
+#
+# Many other options available with /vis/modeling and /vis/filtering.
+# For example, select colour by particle ID
+#/vis/modeling/trajectories/create/drawByParticleID
+#/vis/modeling/trajectories/drawByParticleID-0/set e- red
+#
+#--- /vis/scene/endOfEventAction accumulate
+#
+# At end of each run, an automatic flush causes graphical output.
+#/run/beamOn 1
+# When you exit Geant4, you will find a file called scene-0.heprep.zip.
+# Unzipping this will give you three separate HepRep files suitable for
+# viewing in WIRED.
+# The first file will contain just detector geometry.
+# The second file will contain the detector plus one event.
+# The third file will contain the detector plus ten events.
Index: trunk/geant4/visualization/vis.mac
===================================================================
--- trunk/geant4/visualization/vis.mac	(revision 562)
+++ trunk/geant4/visualization/vis.mac	(revision 562)
@@ -0,0 +1,66 @@
+#
+# Macro file for the initialization phase of "exampleN03.cc"
+# when running in interactive mode
+#
+# Sets some default verbose
+#
+/control/verbose 2
+/control/saveHistory
+/run/verbose 2
+#
+# create empty scene
+#
+/vis/scene/create
+#
+# Create a scene handler for a specific graphics system
+# (Edit the next line(s) to choose another graphic system)
+#
+# Use this open statement to get an .eps and .prim files
+# suitable for viewing in DAWN.
+/vis/open DAWNFILE
+#
+# Use this open statement instead for OpenGL in immediate mode.
+/vis/open OGLSQT
+#/vis/open OGLIX
+#
+# Use this open statement instead to get a HepRep version 1 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepFile
+#
+# Use this open statement instead to get a HepRep version 2 file
+# suitable for viewing in WIRED.
+#/vis/open HepRepXML
+#
+# Output an empty detector
+/vis/viewer/flush
+#
+# Draw trajectories at end of event, showing trajectory points as
+# markers of size 2 pixels
+/vis/scene/add/trajectories
+/vis/modeling/trajectories/create/drawByCharge
+/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
+# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
+#
+# To draw gammas only
+#/vis/filtering/trajectories/create/particleFilter
+#/vis/filtering/trajectories/particleFilter-0/add gamma
+#
+# To draw charged particles only
+#/vis/filtering/trajectories/particleFilter-0/invert true
+#
+# Many other options available with /vis/modeling and /vis/filtering.
+# For example, select colour by particle ID
+#/vis/modeling/trajectories/create/drawByParticleID
+#/vis/modeling/trajectories/drawByParticleID-0/set e- red
+#
+/vis/scene/endOfEventAction accumulate
+#
+# At end of each run, an automatic flush causes graphical output.
+#/run/beamOn 1
+# When you exit Geant4, you will find a file called scene-0.heprep.zip.
+# Unzipping this will give you three separate HepRep files suitable for
+# viewing in WIRED.
+# The first file will contain just detector geometry.
+# The second file will contain the detector plus one event.
+# The third file will contain the detector plus ten events.
Index: trunk/geant4/visualization/visTutor/History
===================================================================
--- trunk/geant4/visualization/visTutor/History	(revision 562)
+++ trunk/geant4/visualization/visTutor/History	(revision 562)
@@ -0,0 +1,36 @@
+====================================
+examples/novice/N03/visTutor/History
+====================================
+
+3rd May 2005  John Allison  (examples-V07-00-03)
+- Replaced vis manager with G4VisExecutive.
+
+10-12-04 Joseph Perl
+- exNo3Vis5.mac: changed name in comments in header from ...Vis6 to ...Vis5.
+- exNo3Vis6.mac: changed name in comments in header from ...Vis7 to ...Vis6.
+- exNo3Vis7.mac: changed name in comments in header from ...Vis8 to ...Vis7.
+- exNo3Vis8.mac: changed name in comments in header from ...Vis9 to ...Vis8.
+- exNo3Tree1.mac: changed name in comments in header from ...Tree0 to ...Tree1.
+
+27-11-03 Gabriele Cosmo 
+- removed script exN03Vis5.mac of OPACS and renamed scripts 6/7/8/9 to
+  5/6/7/8 respectively. Added scripts to gui.mac.
+
+14-11-01 Satoshi Tanaka (exN03VisTutor-V03-02-02)
+- exN03Vis8.mac : Batch visualization with the DAWNFILE driver
+- exN03Vis9.mac : Multi-page PostScript file generation (old exN03Vis8.mac)
+
+08-11-01 Satoshi Tanaka (exN03VisTutor-V03-02-01a)
+- /vis/viewer/viewpointThetaPhi ==> /vis/viewer/set/viewpointThetaPhi
+
+07-11-01 Satoshi Tanaka (exN03VisTutor-V03-02-01)
+- Macros are rewritten with /vis/viewer/flush
+- Comments are updated.
+
+18-09-01 Satoshi Tanaka (exN03VisTutor-V03-02-00)
+- Updation for automatic visualization at Hebden Bridge mini-workshop.
+- /vis/viewer/flush and /vis/flushAll are not included yet.
+  (To be included in the next tag.) 
+- /vis/drawTree may still require /vis/scene/notifyHandlers.
+  (John Allison will revise the /vis/drawTree command soon.)
+
Index: trunk/geant4/visualization/visTutor/exN03Tree0.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Tree0.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Tree0.mac	(revision 562)
@@ -0,0 +1,59 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Tree0.mac                                    #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#                                                                     #
+#  CONTENTS: A macro to demonstrate ASCII DTREE                       #
+#                                                                     #
+#  USAGE:                                                             #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Tree0.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix / Windows                     #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     # 
+#  VERBOSE LEVEL:                                                     #
+#                                                                     # 
+#    <  10: - does not print daughters of repeated logical volumes.   #
+#           - does not repeat replicas.                               #
+#    >= 10: prints all physical volumes.                              #
+#    For level of detail add:                                         #
+#    >=  0: prints physical volume name.                              #
+#    >=  1: prints logical volume name.                               #
+#    >=  2: prints solid name and type.                               #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#    * The geometry tree is displayed in the stdout.                  #
+#    * The compound command to visualize geometry tree:               # 
+#      /vis/drawTree [<physical-volume-name>] [<system>]              # 
+#######################################################################
+
+# Draw the whole geometry tree
+/vis/drawTree 
+
+# Draw a part of tree
+/vis/drawTree Gap 
+
+# Change the level to display details 
+/vis/ASCIITree/verbose 1
+/vis/drawTree
+
+# Change the level to display details
+/vis/ASCIITree/verbose 2
+/vis/drawTree
+
+# Change the level to display details
+/vis/ASCIITree/verbose 10
+/vis/drawTree
Index: trunk/geant4/visualization/visTutor/exN03Tree1.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Tree1.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Tree1.mac	(revision 562)
@@ -0,0 +1,63 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Tree1.mac                                    #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#                                                                     #
+#  CONTENTS: A macro to demonstrate GAG DTREE                         #
+#                                                                     #
+#  USAGE:                                                             #
+#          * Edit exampleN03.cc to use the GAG interface              #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Tree1.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix/Windows, GAG (Java version)   #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     # 
+#  VERBOSE LEVEL:                                                     #
+#                                                                     # 
+#    <  10: - does not print daughters of repeated logical volumes.   #
+#           - does not repeat replicas.                               #
+#    >= 10: prints all physical volumes.                              #
+#    For level of detail add:                                         #
+#    >=  0: prints physical volume name.                              #
+#    >=  1: prints logical volume name.                               #
+#    >=  2: prints solid name and type.                               #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#    * The geometry tree is displayed in GAG windows stdout.          #
+#      (If you are using the G4 character terminals, the tree is      #
+#       displayed in stdout.)                                         # 
+#    * The compound command to visualize geometry tree:               # 
+#      /vis/drawTree [<physical-volume-name>] [<system>]              #
+#######################################################################
+
+# Draw the whole geometry tree
+#  Note: "!" means the default argument, i.e., "world"
+/vis/drawTree ! GAGTree
+
+# Draw a part of tree
+/vis/drawTree Gap GAGTree
+
+# Change the level to display details 
+/vis/GAGTree/verbose 1
+/vis/drawTree ! GAGTree
+
+# Change the level to display details
+/vis/GAGTree/verbose 2
+/vis/drawTree ! GAGTree
+
+# Change the level to display details
+/vis/GAGTree/verbose 10
+/vis/drawTree ! GAGTree
Index: trunk/geant4/visualization/visTutor/exN03Vis0.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis0.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis0.mac	(revision 562)
@@ -0,0 +1,108 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis0.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#        May      20, 2000                                            # 
+#        November 10, 1999                                            #
+#                                                                     #
+#  CONTENTS: A simplest macro to demonstrate visualization of         #
+#            detector geometry and events                             #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis0.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+##############################################
+# Visualization of detector geometry 
+#  with the OGLIX (OpenGL Immediate X) driver
+##############################################
+
+# Invoke the OGLIX driver
+/vis/open OGLIX
+#/vis/open DAWNFILE
+
+# Set camera 
+/vis/viewer/reset 
+/vis/viewer/set/viewpointThetaPhi 70 20
+
+# Create an empty scene and add the detector geometry to it
+/vis/drawVolume
+
+# The following command "flush" 
+#  the action of the current viewer.
+#  They are required for the post-processing drivers 
+#  such as DAWNFILE, VRMLFILE, HepRep drivers, etc.
+#  For OpenGL drivers, these commands are not required
+#  but harmless even if they are described.
+/vis/viewer/flush
+
+#########################################################
+# Visualization of events with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver
+/vis/open DAWNFILE
+
+# Add the world volume to the current scene
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Set camera 
+/vis/viewer/reset 
+/vis/viewer/zoom              1.5
+/vis/viewer/set/viewpointThetaPhi 70 20
+
+# Visualize events added to the current scene
+/tracking/storeTrajectory 1
+/run/beamOn 3
Index: trunk/geant4/visualization/visTutor/exN03Vis1.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis1.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis1.mac	(revision 562)
@@ -0,0 +1,164 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis1.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#        May      20, 2000                                            # 
+#        November 10, 1999                                            #
+#                                                                     #
+#  CONTENTS: A basic macro for visualization of detector geometry     #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis1.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+###########################################
+# Visualization of detector geometry 
+#  with the OGLSX (OpenGL Stored X) driver
+###########################################
+
+# Invoke the OGLSX driver 
+/vis/open OGLSX
+
+# Bird's-eye view of the detector geometry 
+#
+#  viewpoint  : (theta,phi) = (20*deg, 70*deg), 
+#  zoom factor: 0.8 of the full screen size
+#
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi  20 70
+/vis/viewer/zoom               0.8 
+/vis/drawVolume
+
+# The following two commands "flush" 
+#  the action of the current viewer.
+#  They are required for the post-processing drivers 
+#  such as DAWNFILE, VRMLFILE, HepRep drivers, etc.
+#  For OpenGL drivers, these commands are not required
+#  but harmless even if they are described.
+/vis/viewer/flush
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Bird's-eye view of a detector component (Absorber)
+#  viewpoint  : (theta,phi) = (35*deg, 35*deg), 
+#  zoom factor: 1.1 of the full screen size
+#  coordinate axes:
+#     x-axis:red,  y-axis:green,  z-axis:blue
+#     origin: (0,0,0),  length: 500
+#  Scale: length = 10 cm, Orientation = z, color = red, 
+#         placing_algorithm = manual, 
+#         center = (-2.5 cm , -5 cm, 0 cm)
+#
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume           Absorber 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm  40 -100 -140   Absorber 
+/vis/scene/add/scale     10 cm z 1 0 0 manual -2.5 -5 0  cm
+
+# "Flush the action of all the existing viewers.
+#   Note: You should execute these commands, e.g.,  
+#         when the current scene is modified.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+# Bird's-eye view of a detector component (Gap)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume                Gap 
+/vis/scene/add/axes  	  0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm  50 -100 -140   Gap 
+/vis/scene/add/scale      10 cm z 1 0 0 manual -2.5 -5  0 cm
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Bird's-eye view of the whole detector components (world)
+#  * The argument "world" of the command 
+#    "/vis/scene/add/volume" is omittable.
+#  * "/vis/viewer/set/culling false" makes the invisible 
+#    world volume visible.
+#    (The invisibility of the world volume is set 
+#     in ExN03DetectorConstruction.cc.)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/viewer/set/culling         global false
+/vis/drawVolume 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm 50 -100 -240   World
+/vis/scene/add/scale     10 cm x 1 0 0 
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Make the culling on for next visualization
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling       global true
Index: trunk/geant4/visualization/visTutor/exN03Vis10.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis10.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis10.mac	(revision 562)
@@ -0,0 +1,72 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis10.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Guy Barrand                                             #
+#                                                                     #
+#  DATE: June 09, 2000                                                #
+#                                                                     #
+#  CONTENTS: A basic macro for demonstrating Inventor driver          #
+#                                                                     #
+#  USAGE:  % $G4BINDIR/exampleN03  visTutor/exN03Vis6.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Windows,                           #
+#                                  some Inventor (TGS, SGI, Coin)     #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    G4VIS_BUILD_OIWIN32_DRIVER                                       # 
+#    G4UI_BUILD_WIN32_SESSION                                         # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    G4VIS_USE_OIWIN32                                                #
+#    G4UI_USE_WIN32                                                   # 
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+# Create "scene-0" 
+/vis/scene/create
+
+# Invoke the OpenInventor driver 
+/vis/sceneHandler/create OIWin32
+/vis/viewer/create
+
+# Add the world volume to the current scene
+/vis/scene/add/volume
+#/vis/scene/add/volume Layer
+# Name of the absorbers = name of their material (Lead) !
+#/vis/scene/add/volume Lead
+# Name of the gaps = name of their material (liquidArgon) !
+#/vis/scene/add/volume liquidArgon
+#/vis/scene/add/trajectories
+/tracking/storeTrajectory 1
+
+# Bird-eye view of events
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi   45 45 
+
+/vis/scene/notifyHandlers
+
+/control/verbose 2
+#######################################################################
+#   Controls on an Inventor examiner viewer are :                     #
+#  - in picking mode (cursor is the upper left arrow)                 #
+#   Ctrl + pick a volume : see daughters.                             #
+#   Shift + pick a volume : see mother.                               #
+#  - in viewing mode (cursor is the hand)                             #
+#   Left-button + pointer move : rotate.                              #
+#   Ctrl+Left-button + pointer move : pan.                            #
+#   Ctrl+Shift+Left-button + pointer move : scale.                    #
+#   Middle-button + pointer move : pan.                               #
+#                                                                     #
+#######################################################################
+
+/vis/viewer/update
+
+/run/beamOn 1
+
+
Index: trunk/geant4/visualization/visTutor/exN03Vis11.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis11.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis11.mac	(revision 562)
@@ -0,0 +1,157 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis11.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Guy Barrand dd                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        April    08, 2004                                            #
+#                                                                     #
+#  CONTENTS: A basic macro for visualization of detector geometry     #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis11.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+###########################################
+# Visualization of detector geometry 
+#  with the OGLSXm (OpenGL Stored Motif) driver
+###########################################
+
+# Invoke the OGLSXm driver 
+/vis/open OGLSXm
+
+# Bird's-eye view of the detector geometry 
+#
+#  viewpoint  : (theta,phi) = (20*deg, 70*deg), 
+#  zoom factor: 0.8 of the full screen size
+#
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi  20 70
+/vis/viewer/zoom               0.8 
+/vis/drawVolume
+
+# The following two commands "flush" 
+#  the action of the current viewer.
+#  They are required for the post-processing drivers 
+#  such as DAWNFILE, VRMLFILE, HepRep drivers, etc.
+#  For OpenGL drivers, these commands are not required
+#  but harmless even if they are described.
+/vis/viewer/flush
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Bird's-eye view of a detector component (Absorber)
+#  viewpoint  : (theta,phi) = (35*deg, 35*deg), 
+#  zoom factor: 1.1 of the full screen size
+#  coordinate axes:
+#     x-axis:red,  y-axis:green,  z-axis:blue
+#     origin: (0,0,0),  length: 500
+#  Scale: length = 10 cm, Orientation = z, color = red, 
+#         placing_algorithm = manual, 
+#         center = (-2.5 cm , -5 cm, 0 cm)
+#
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume           Absorber 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm  40 -100 -140   Absorber 
+/vis/scene/add/scale     10 cm z 1 0 0 manual -2.5 -5 0  cm
+
+# "Flush the action of all the existing viewers.
+#   Note: You should execute these commands, e.g.,  
+#         when the current scene is modified.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+# Bird's-eye view of a detector component (Gap)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume                Gap 
+/vis/scene/add/axes  	  0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm  50 -100 -140   Gap 
+/vis/scene/add/scale      10 cm z 1 0 0 manual -2.5 -5  0 cm
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Bird's-eye view of the whole detector components (world)
+#  * The argument "world" of the command 
+#    "/vis/scene/add/volume" is omittable.
+#  * "/vis/viewer/set/culling false" makes the invisible 
+#    world volume visible.
+#    (The invisibility of the world volume is set 
+#     in ExN03DetectorConstruction.cc.)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/viewer/set/culling         global false
+/vis/drawVolume 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm 50 -100 -240   World
+/vis/scene/add/scale     10 cm x 1 0 0 
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Make the culling on for next visualization
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling       global true
Index: trunk/geant4/visualization/visTutor/exN03Vis12.loop
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis12.loop	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis12.loop	(revision 562)
@@ -0,0 +1,4 @@
+# exN03Vis12.loop
+/vis/ogl/set/startTime {startTime} ns {timeRange} ns
+# Print eps file
+#/vis/oglx/printEPS
Index: trunk/geant4/visualization/visTutor/exN03Vis12.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis12.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis12.mac	(revision 562)
@@ -0,0 +1,70 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis12.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Laurent Garnier                                         #
+#                                                                     #
+#  DATE: July 01, 2007                                                #
+#                                                                     #
+#  CONTENTS: A basic macro for demonstrating Inventor driver          #
+#                                                                     #
+#  USAGE:  % $G4BINDIR/exampleN03  visTutor/exN03Vis12.mac            #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, Motif, X-window, OpenGL,Qt   #
+#                                  HEPVis                             #
+#                                  Inventor (TGS or SoFree)           #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_BUILD_OIX_DRIVER       1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OIQT               1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+# Create "scene-0" 
+/vis/scene/create
+
+# Invoke the OpenInventor driver 
+/vis/sceneHandler/create OGLIQT
+/vis/viewer/create
+
+# Add the world volume to the current scene
+/vis/scene/add/volume
+#/vis/scene/add/volume Layer
+# Name of the absorbers = name of their material (Lead) !
+#/vis/scene/add/volume Lead
+# Name of the gaps = name of their material (liquidArgon) !
+#/vis/scene/add/volume liquidArgon
+#/vis/scene/add/trajectories
+/tracking/storeTrajectory 1
+
+# Bird-eye view of events
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi   45 45 
+
+/vis/scene/notifyHandlers
+
+/control/verbose 2
+#######################################################################
+#   Controls on an Inventor examiner viewer are :                     #
+#  - in picking mode (cursor is the upper left arrow)                 #
+#   Ctrl + pick a volume : see daughters.                             #
+#   Shift + pick a volume : see mother.                               #
+#  - in viewing mode (cursor is the hand)                             #
+#   Left-button + pointer move : rotate.                              #
+#   Ctrl+Left-button + pointer move : pane.                           #
+#   Ctrl+Shift+Left-button + pointer move : scale.                    #
+#   Middle-button + pointer move : pane.                              #
+#                                                                     #
+#######################################################################
+
+/vis/viewer/update
+
+/run/beamOn 1
+
Index: trunk/geant4/visualization/visTutor/exN03Vis13.loop
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis13.loop	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis13.loop	(revision 562)
@@ -0,0 +1,7 @@
+# exN03Vis13.loop
+/vis/viewer/pan {dx} 0 mm
+/vis/ogl/set/endTime {endTime} ns {timeRange} ns
+# Force refresh here (since auto-refresh switched off in main mac).
+/vis/viewer/refresh
+# Print eps file
+#/vis/oglx/printEPS
Index: trunk/geant4/visualization/visTutor/exN03Vis13.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis13.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis13.mac	(revision 562)
@@ -0,0 +1,70 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis13.mac                                    #
+#                                                                     #
+#  AUTHOR(S): John Allison                                            #
+#                                                                     #
+#  DATE: 18th August 2006                                             #
+#                                                                     #
+#  CONTENTS: Time development of an electrmagnetic shower.            #
+#                                                                     #
+#  USAGE:  % $G4BINDIR/exampleN03  visTutor/exN03Vis12.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Mac/Unix with X-Windows, OpenGL    #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+/control/verbose 2
+/vis/verbose confirmations
+
+/vis/open OGLSX 600x600-0+0
+/vis/drawVolume
+/vis/scene/add/eventID
+/vis/scene/add/trajectories rich
+
+# Set up drawByParticleID with time slicing
+/vis/modeling/trajectories/create/drawByParticleID
+/vis/modeling/trajectories/drawByParticleID-0/set e- red
+/vis/modeling/trajectories/drawByParticleID-0/set e+ blue
+/vis/modeling/trajectories/drawByParticleID-0/set pi- cyan
+/vis/modeling/trajectories/drawByParticleID-0/set pi+ magenta
+#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawStepPts true
+/vis/modeling/trajectories/drawByParticleID-0/default/setStepPtsSize 5
+#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawAuxPts true
+/vis/modeling/trajectories/drawByParticleID-0/default/setAuxPtsSize 5
+/control/alias interval 0.01
+/control/alias halfInterval 0.005
+/vis/modeling/trajectories/drawByParticleID-0/default/setTimeSliceInterval {interval} ns
+/vis/modeling/trajectories/list
+
+# Remove gammas
+/vis/filtering/trajectories/create/particleFilter
+/vis/filtering/trajectories/particleFilter-0/add gamma
+/vis/filtering/trajectories/particleFilter-0/invert true
+
+# Create trajecgtories
+/gun/energy 10 GeV
+/vis/viewer/set/globalLineWidthScale 2
+/run/beamOn
+
+# Run time sequence
+/vis/ogl/set/fade 1
+/vis/ogl/set/displayHeadTime true
+# The trajectories can appear of jump ahead of the light front because
+# their time range overlaps the viewer's time range.  To mitigate this
+# effect of discrete time intervals, advance the light front by half the
+# trajectories interval...
+/vis/ogl/set/displayLightFront true -90 0 0 mm -{halfInterval} ns
+/vis/viewer/panTo -9 0 cm
+/vis/viewer/zoomTo 2
+/control/alias timeRange 0.1
+/control/alias dx 0.3
+# Switch off auto-refresh to avoid refresh on /vis/viewer/pan in loop.
+# (Then force refresh in loop.)
+/vis/viewer/set/autoRefresh 0
+/vis/verbose warnings
+/control/verbose 0
+/control/loop visTutor/exN03Vis13.loop endTime 0 0.7 0.001
+/control/verbose 2
+/vis/verbose confirmations
Index: trunk/geant4/visualization/visTutor/exN03Vis14.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis14.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis14.mac	(revision 562)
@@ -0,0 +1,156 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis14.mac                                    #
+#                                                                     #
+#  AUTHOR(S): Laurent Garnier                                         #
+#                                                                     #
+#  DATE: July 13, 2007                                                #
+#                                                                     #
+#  CONTENTS: A basic macro for visualization of detector geometry     #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis14.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,Qt          #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLQT_DRIVER   1                         # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLQT           1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+###########################################
+# Visualization of detector geometry 
+#  with the OGLSQT (OpenGL Stored QT) driver
+###########################################
+
+# Invoke the OGLSQT driver 
+/vis/open OGLSQT
+
+# Bird's-eye view of the detector geometry 
+#
+#  viewpoint  : (theta,phi) = (20*deg, 70*deg), 
+#  zoom factor: 0.8 of the full screen size
+#
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi  20 70
+/vis/viewer/zoom               0.8 
+/vis/drawVolume
+
+# The following two commands "flush" 
+#  the action of the current viewer.
+#  They are required for the post-processing drivers 
+#  such as DAWNFILE, VRMLFILE, HepRep drivers, etc.
+#  For OpenGL drivers, these commands are not required
+#  but harmless even if they are described.
+/vis/viewer/flush
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Bird's-eye view of a detector component (Absorber)
+#  viewpoint  : (theta,phi) = (35*deg, 35*deg), 
+#  zoom factor: 1.1 of the full screen size
+#  coordinate axes:
+#     x-axis:red,  y-axis:green,  z-axis:blue
+#     origin: (0,0,0),  length: 500
+#  Scale: length = 10 cm, Orientation = z, color = red, 
+#         placing_algorithm = manual, 
+#         center = (-2.5 cm , -5 cm, 0 cm)
+#
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume           Absorber 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm  40 -100 -140   Absorber 
+/vis/scene/add/scale     10 cm z 1 0 0 manual -2.5 -5 0  cm
+
+# "Flush the action of all the existing viewers.
+#   Note: You should execute these commands, e.g.,  
+#         when the current scene is modified.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+# Bird's-eye view of a detector component (Gap)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/drawVolume                Gap 
+/vis/scene/add/axes  	  0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm  50 -100 -140   Gap 
+/vis/scene/add/scale      10 cm z 1 0 0 manual -2.5 -5  0 cm
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Bird's-eye view of the whole detector components (world)
+#  * The argument "world" of the command 
+#    "/vis/scene/add/volume" is omittable.
+#  * "/vis/viewer/set/culling false" makes the invisible 
+#    world volume visible.
+#    (The invisibility of the world volume is set 
+#     in ExN03DetectorConstruction.cc.)
+/vis/viewer/reset
+/vis/viewer/zoom               1.1
+/vis/viewer/set/viewpointThetaPhi  35 35
+/vis/viewer/set/culling         global false
+/vis/drawVolume 
+/vis/scene/add/axes      0 0 0 500 mm
+/vis/scene/add/text      0 0 0 mm 50 -100 -240   World
+/vis/scene/add/scale     10 cm x 1 0 0 
+
+# "Flush the action of all the existing viewers.
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+
+# Make the culling on for next visualization
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling       global true
Index: trunk/geant4/visualization/visTutor/exN03Vis2.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis2.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis2.mac	(revision 562)
@@ -0,0 +1,127 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis2.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            # 
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#        May      20, 2000                                            #
+#        November 10, 1999                                            #
+#                                                                     #
+#  CONTENTS: A basic macro for visualization of events                #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis2.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#######################################################################
+
+#################################################
+# Store particle trajactories for visualization
+#################################################
+/tracking/storeTrajectory 1
+
+#######################################################
+# Visualization with the OGLSX (OpenGL Stored X) driver
+#######################################################
+
+# Invoke the OGLSX driver 
+/vis/open OGLSX
+
+# Create an empty scene and add the detector geometry to it 
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Set viewing parameters
+#  viewpoint  : (theta,phi) = (10*deg, 10*deg).
+#  drawing style: surface
+/vis/viewer/reset
+/vis/viewer/set/style surface
+/vis/viewer/set/viewpointThetaPhi   10  10
+
+# Generate one event and visualize it.
+/run/beamOn  1
+
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Create an empty scene and add the detector geometry to it 
+/vis/drawVolume 
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Set the trajectory-accumulation mode to "accumulate".
+#  Trajectories of each event are accumulated
+#  and visualized at the end of one run.
+/vis/scene/endOfEventAction    accumulate
+
+# Visualize many events (bird's eye view)
+#  viewpoint  : (theta,phi) = (45*deg, 45*deg) 
+#  zoom factor: 1.5 x (full screen size)
+#  drawing style: wireframe
+/vis/viewer/reset
+/vis/viewer/set/style  wireframe
+/vis/viewer/set/viewpointThetaPhi   45 45
+/vis/viewer/zoom        1.5
+/run/beamOn             50
+
+# Visualize many events (zoomed-up view)
+#  viewpoint  : (theta,phi) = (90*deg, 0) 
+#  zoom factor: 5 x (full screen size)
+/vis/viewer/reset
+/vis/viewer/set/style  wireframe
+/vis/viewer/set/viewpointThetaPhi   90 0
+/vis/viewer/zoom        5
+/run/beamOn             50
+
+# Reset trajectory-accumulation mode to "refresh" (default)
+#  Trajectories are visualized at the end of each event.
+/vis/scene/endOfEventAction       refresh
Index: trunk/geant4/visualization/visTutor/exN03Vis3.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis3.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis3.mac	(revision 562)
@@ -0,0 +1,136 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis3.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#        May      20, 2000                                            # 
+#        November 10, 1999                                            #
+#                                                                     #
+#  CONTENTS: A basic macro for demonstrating various drawing styles   #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis3.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/local)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#######################################################################
+
+##############################################
+# Store particle trajactories for visualization
+##############################################
+/tracking/storeTrajectory 1
+
+###########################################################
+# Visualization with the OGLIX (OpenGL Immediate X) driver
+###########################################################
+
+# Invoke the OGLSX driver 
+/vis/open OGLSX
+
+# Create an empty scene and add the detector geometry to it 
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Bird-eye view of events with 
+#  the hidden-surface drawing style
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi  45 45 
+/vis/viewer/set/style          surface
+/run/beamOn                    10
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+#
+##########################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Create an empty scene and add the detector geometry to it 
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Bird-eye view of events with the 
+#  wireframe drawing style
+/vis/viewer/reset 
+/vis/viewer/zoom               1.5
+/vis/viewer/set/viewpointThetaPhi  45 45 
+/vis/viewer/set/style          wireframe
+/run/beamOn                    3
+
+# Set the trajectory-accumulation mode to "accumulate".
+#  Trajectories of each event are accumulated
+#  and visualized at the end of one run.
+/vis/scene/endOfEventAction    accumulate
+
+# Bird-eye view of events with the 
+#  hidden-surface drawing style
+/vis/viewer/set/style          surface
+/run/beamOn                    50
+
+# Cull detector geometry and show only trajectories.
+/vis/viewer/reset 
+/vis/viewer/set/culling     global  true
+/vis/viewer/set/culling     density true 999
+/vis/viewer/set/style       wireframe
+/run/beamOn                 10
+
+# Reset the culling policy for next visualization
+#  The default culling policy is:
+#   global          : on
+#   invisible       : on 
+#   low density     : off 
+#   covered daughter: off
+#
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling  density false
+
+# Reset trajectory-accumulation mode to "refresh" (default)
+#  Trajectories are visualized at the end of each event.
+/vis/scene/endOfEventAction       refresh
Index: trunk/geant4/visualization/visTutor/exN03Vis4.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis4.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis4.mac	(revision 562)
@@ -0,0 +1,105 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis4.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            # 
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#        June     06, 2000                                            # 
+#                                                                     #
+#  CONTENTS: An example for the compound command,                     #
+#            "/vis/specify  <logical_volume_name>"                    #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis4.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window,                    #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
+#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OPENGLX            1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     # 
+#    The compound command "/vis/specify <logical-volume-name>"        #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #  
+#      /vis/scene/add/logicalVolume $1                                #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+##########################################################
+# Visualization with the OGLIX driver
+##########################################################
+
+# Invoke the OGLIX driver 
+/vis/open OGLIX
+
+# Set camera 
+/vis/viewer/reset
+/vis/viewer/zoom       0.9 
+/vis/viewer/set/viewpointThetaPhi  35 35
+
+# Visualize a selected logical volume
+/vis/specify           Absorber 
+/vis/viewer/flush
+
+##########################################################
+# Visualization with the DAWNFILE driver
+#
+#  * Each visualized view is saved to a file "g4_XX.eps"  
+#    with the "vectorized" PostScript format.
+#
+#  * Set an environmental variable if you wish to 
+#    skip DAWN GUI:
+#     % setenv G4DAWNFILE_VIEWER "dawn -d"
+##########################################################
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Set camera 
+/vis/viewer/reset
+/vis/viewer/zoom       0.9 
+/vis/viewer/set/viewpointThetaPhi  35 35
+
+# Visualize a selected logical volume (1)
+/vis/specify                  Absorber 
+/vis/scene/add/axes    0 0 0 500 mm
+/vis/scene/add/text    0 0 0 mm  40 -100 -200   LogVol:Absorber 
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
+# Visualize a selected logical volume (2)
+/vis/specify  Gap
+/vis/scene/add/axes    0 0 0 500 mm
+/vis/scene/add/text    0 0 0 mm  40 -100 -200   LogVol:Gap
+/vis/scene/notifyHandlers
+/vis/viewer/update
+
+# FOR FUTURE UPDATION
+#/vis/viewer/flushAll
+
Index: trunk/geant4/visualization/visTutor/exN03Vis5.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis5.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis5.mac	(revision 562)
@@ -0,0 +1,70 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis5.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Guy Barrand                                             #
+#                                                                     #
+#  DATE: June 09, 2000                                                #
+#                                                                     #
+#  CONTENTS: A basic macro for demonstrating Inventor driver          #
+#                                                                     #
+#  USAGE:  % $G4BINDIR/exampleN03  visTutor/exN03Vis6.mac             #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, Motif, X-window, OpenGL,     #
+#                                  HEPVis                             #
+#                                  Inventor (TGS or SoFree)           #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_BUILD_OIX_DRIVER       1                          # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    % setenv G4VIS_USE_OIX                1                          #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+# Create "scene-0" 
+/vis/scene/create
+
+# Invoke the OpenInventor driver 
+/vis/sceneHandler/create OIX
+/vis/viewer/create
+
+# Add the world volume to the current scene
+/vis/scene/add/volume
+#/vis/scene/add/volume Layer
+# Name of the absorbers = name of their material (Lead) !
+#/vis/scene/add/volume Lead
+# Name of the gaps = name of their material (liquidArgon) !
+#/vis/scene/add/volume liquidArgon
+#/vis/scene/add/trajectories
+/tracking/storeTrajectory 1
+
+# Bird-eye view of events
+/vis/viewer/reset
+/vis/viewer/set/viewpointThetaPhi   45 45 
+
+/vis/scene/notifyHandlers
+
+/control/verbose 2
+#######################################################################
+#   Controls on an Inventor examiner viewer are :                     #
+#  - in picking mode (cursor is the upper left arrow)                 #
+#   Ctrl + pick a volume : see daughters.                             #
+#   Shift + pick a volume : see mother.                               #
+#  - in viewing mode (cursor is the hand)                             #
+#   Left-button + pointer move : rotate.                              #
+#   Ctrl+Left-button + pointer move : pane.                           #
+#   Ctrl+Shift+Left-button + pointer move : scale.                    #
+#   Middle-button + pointer move : pane.                              #
+#                                                                     #
+#######################################################################
+
+/vis/viewer/update
+
+/run/beamOn 1
+
Index: trunk/geant4/visualization/visTutor/exN03Vis6.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis6.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis6.mac	(revision 562)
@@ -0,0 +1,68 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis6.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            #  
+#                                                                     #
+#  CONTENTS: A macro to demonstrate the VRMLFILE driver               #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis7.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window,                    #
+#                                  VRML viewer (e.g. VRMLview)        #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  RECOMMENDED ENVIRONMENTAL VARIABLES FOR VISUALIZATION:             #
+#                                                                     #
+#    % setenv G4VRMLFILE_VIEWER        vrmlview                       #
+#     ( The default value is "NONE".)                                 #
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#   The VRML-file viewer "vrmlview" is obtainable from the following  #
+#   Web site:                                                         #
+#      http://www.sim.no/downloads.html                               #
+#                                                                     #
+#######################################################################
+
+###################################################
+# Visualization of detector geometry and events  
+# with the VRML2FILE driver.
+###################################################
+
+# Store particle trajactories for visualization
+/tracking/storeTrajectory 1
+
+# Invoke the VRML2FILE driver
+#  Note: The VRML1FILE driver generates VRML 1.0 format files.
+#        The VRML2FILE driver generates VRML 2.0 format files.
+/vis/open VRML2FILE
+
+# Create an empty scene and add the detector geometry to it
+/vis/drawVolume
+
+# Visualize 3 events in the wireframe mode 
+#  Note: The command /vis/scene/add/trajectories
+#        is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is  
+#        described in the event action.
+#  Note: "/vis/viewer/set/style wireframe" means  
+#       "half-transparent" in the VRML2FILE driver.  
+#       It is a convention only for this driver.
+#/vis/scene/add/trajectories
+/vis/viewer/set/style wireframe
+/run/beamOn 3
Index: trunk/geant4/visualization/visTutor/exN03Vis7.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis7.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis7.mac	(revision 562)
@@ -0,0 +1,61 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis7.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      14, 2001                                            #
+#                                                                     #
+#  CONTENTS: A macro to demonstrate batch visualization to generate   #
+#            PostScript file with the DAWNFILE driver                 #
+#                                                                     #
+#          % setenv DAWN_BATCH               1                        #
+#          % make visclean                                            #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis8.mac              #
+#          Idle> exit                                                 #
+#          % gv g4_00.eps &                                           #
+#          % gv g4_01.eps &                                           #
+#          % gv g4_02.eps &                                           #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window,                    #
+#                                  DAWN (version 3.85 or after)       #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#                                                                     # 
+#######################################################################
+
+####################################################################
+# Creation of a multi-page PostScript file with the DAWNFILE driver
+####################################################################
+
+# Invoke the DAWNFILE driver
+/vis/open DAWNFILE
+
+# Add the world volume to the current scene
+/vis/drawVolume
+
+# Add trajectories to the current scene
+#  Note: This command is not necessary in exampleN03,
+#        since the C++ method DrawTrajectory() is 
+#        described in the event action.
+#/vis/scene/add/trajectories
+
+# Set camera 
+/vis/viewer/reset 
+/vis/viewer/zoom              1.5
+/vis/viewer/set/viewpointThetaPhi 70 20
+
+# Visualize events added to the current scene
+/tracking/storeTrajectory 1
+/run/beamOn 3
Index: trunk/geant4/visualization/visTutor/exN03Vis8.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis8.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis8.mac	(revision 562)
@@ -0,0 +1,87 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis8.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Satoshi Tanaka                                          #
+#                                                                     #
+#  DATE:                                                              #
+#        Nov      14, 2001 (renamed from exN03Vis8.mac)               #
+#        Nov      07, 2001                                            #
+#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
+#        June     20, 2001                                            #
+#        November 26, 2000                                            #
+#        October  17, 2000                                            # 
+#                                                                     #
+#  CONTENTS: A macro to demonstrate creation of a "multi-page"        #
+#            PostScript file                                          #
+#                                                                     #
+#  USAGE:  % setenv G4DAWNFILE_MAX_FILE_NUM  1                        #
+#          % setenv DAWN_BATCH               a                        #
+#          % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis9.mac              #
+#          Idle> exit                                                 #
+#          % gv g4_00.eps                                             #
+#                                                                     #
+#          Then click, "<<", ">>" etc to traverse pages               #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window,                    #
+#                                  DAWN (version 3.85 or after)       #
+#                                  gv (Ghostview), Tcl/Tk             #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    * Unnecessary                                                    #
+#                                                                     # 
+#  ADDITIONAL NOTES:                                                  #
+#    * If you execute this macro plural times, all the views are      #
+#      sequentially appended to the file "g4_00.eps".                 #
+#      For example if you execute it two times, a 6-page (3+3 page)   #
+#      PostScript file is made.                                       #
+#      Unset environmental variables to initialize your environment:  #
+#                                                                     # 
+#       % unsetenv G4DAWNFILE_MAX_FILE_NUM                            #
+#       % unsetenv DAWN_BATCH                                         # 
+#                                                                     # 
+#######################################################################
+
+####################################################################
+# Creation of a multi-page PostScript file with the DAWNFILE driver
+####################################################################
+
+# Invoke the DAWNFILE driver 
+/vis/open DAWNFILE
+
+# Set viewing parameters
+/vis/viewer/reset
+/vis/viewer/zoom               0.9 
+/vis/viewer/set/viewpointThetaPhi  35 35
+
+# Generate page 1: Absorber
+/vis/drawVolume           Absorber 
+/vis/scene/add/axes       0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm  30 -150 -200   Page1/3:Absorber 
+/vis/viewer/flush
+
+# Generate page 2: Gap
+/vis/drawVolume           Gap
+/vis/scene/add/axes       0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm 30 -100 -200   Page2/3:Gap
+/vis/viewer/flush
+
+# Generate page 3: World
+/vis/viewer/set/culling   global  false
+/vis/drawVolume           
+/vis/scene/add/axes       0 0 0 500 mm
+/vis/scene/add/text       0 0 0 mm 50 -100 -200   Page3/3:world
+/vis/viewer/flush
+
+# Make the culling on for next visualization
+#  Note: You may also use "/vis/viewer/reset" 
+#        for this initialization. 
+/vis/viewer/set/culling   global  true
Index: trunk/geant4/visualization/visTutor/exN03Vis9.mac
===================================================================
--- trunk/geant4/visualization/visTutor/exN03Vis9.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/exN03Vis9.mac	(revision 562)
@@ -0,0 +1,65 @@
+#######################################################################
+#  MACRO FILE NAME: exN03Vis9.mac                                     #
+#                                                                     #
+#  AUTHOR(S): Guy Barrand
+#                                                                     #
+#  DATE:                                                              #
+#        Appril   08, 2004                                            #
+#                                                                     #
+#  CONTENTS: A simplest macro to demonstrate visualization of         #
+#            detector geometry and events                             #
+#                                                                     #
+#  USAGE:  % gmake visclean                                           #
+#          % $G4BINDIR/exampleN03                                     #
+#          Idle> /control/execute visTutor/exN03Vis9.mac              #
+#                                                                     #
+#  REQUIRED PLATFORMS & SOFTWARES: Windows, OpenGL                    #
+#  OPTIONAL :                      DAWN (version 3.85 or after)       #
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    G4VIS_BUILD_OPENGLWIN32_DRIVER                                   # 
+#   (G4UI_BUILD_WIN32_SESSION)                                        # 
+#                                                                     #
+#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
+#  (See geant4/source/visualization/README for details.)              #
+#                                                                     #
+#    G4VIS_USE_OPENGLWIN32                                            # 
+#   (G4UI_USE_WIN32)                                                  # 
+#                                                                     #
+#  ADDITIONAL NOTES:                                                  #
+#    The compound command "/vis/open <vis-driver-name>"               #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/sceneHandler/create $1                                    #
+#      /vis/viewer/create                                             #
+#                                                                     #
+#    The compound command "/vis/drawVolume <physical-volume-name>"    #
+#    is equivalent to the following set of commands:                  #
+#                                                                     #
+#      /vis/scene/create                                              #
+#      /vis/scene/add/volume $1                                       #
+#      /vis/sceneHandler/attach                                       #
+#                                                                     #
+#######################################################################
+
+##############################################
+# Visualization of detector geometry and trajectories
+#  with the OGLIWin32 (OpenGL Immediate Windows) driver
+##############################################
+
+# Invoke the OGLIWin32 driver
+/vis/open OGLIWin32
+
+# Set camera 
+/vis/viewer/reset 
+/vis/viewer/set/viewpointThetaPhi 70 20
+
+# Create an empty scene and add the detector geometry to it
+/vis/drawVolume
+
+# Visualize events added to the current scene
+/tracking/storeTrajectory 1
+/run/beamOn 1
+
Index: trunk/geant4/visualization/visTutor/g4Xt.xrm
===================================================================
--- trunk/geant4/visualization/visTutor/g4Xt.xrm	(revision 562)
+++ trunk/geant4/visualization/visTutor/g4Xt.xrm	(revision 562)
@@ -0,0 +1,359 @@
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!! 
+!!!!  A X11 resource file to customize G4UI sessions and 
+!!!! visualization viewers based over Xt. You use it by
+!!!! setting the XENVIRONMENT environment variable to point
+!!!! to this file, for example :
+!!!!    csh> setenv XENVIRONMENT g4Xt.xrm
+!!!!     sh> XENVIRONMENT=g4Xt.xrm;export XENVIRONMENT
+!!!! 
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*topShadowColor    :white
+*bottomShadowColor :black
+*foreground        :black
+*background        :lightgrey
+*borderColor       :lightgrey
+*fontList          :-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!! G4UIXm
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*text.background   :white
+*text.fontList     :*courier*-r-*--14-*
+*text.maxLength    :8000
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! OpenInventor resources, copied from file :
+!  OpenInventor2.4.1/app-defaults/Inventor
+!
+!#################################################
+!       RESSOURCE FILE FOR OPEN INVENTOR         !
+!#################################################
+!
+! You must put this file in
+! /usr/lib/X11/app-defaults
+! or set up XAPPLRESDIR (see X window documentation)
+!
+!#################################################
+!!################################################
+!!                 POPUP MENU
+!!------------------------------------------------
+!!               FUNCTIONS MENU
+!!------------------------------------------------
+*IvMenu.IvFunctions1.labelString: Functions
+*IvFunctions2.IvHelp.labelString: Help
+*IvFunctions2.IvHome.labelString: Home
+*IvFunctions2.IvSetHome.labelString: Set Home
+*IvFunctions2.IvViewAll.labelString: View All
+*IvFunctions2.IvSeek.labelString: Seek
+*IvFunctions2.IvCopyView.labelString: Copy View
+*IvFunctions2.IvPasteView.labelString: Paste View
+!!------------------------------------------------
+!!               DRAW STYLE MENU
+!!------------------------------------------------
+*IvMenu.IvDrawStyle1.labelString: Draw Style
+*IvDrawStyle2.IvAsIs.labelString: as is
+*IvDrawStyle2.IvHiddenLine.labelString: hidden line
+*IvDrawStyle2.IvNoTexture.labelString: no texture
+*IvDrawStyle2.IvLowResolution.labelString: low resolution
+*IvDrawStyle2.IvWireFrame.labelString: wireframe
+*IvDrawStyle2.IvPoints.labelString: points
+*IvDrawStyle2.IvBoundingBoxNoDepth.labelString: bounding box ( no depth )
+*IvDrawStyle2.IvMoveSameAsStill.labelString: move same as still
+*IvDrawStyle2.IvMoveNoTexture.labelString:  move no texture.
+*IvDrawStyle2.IvMoveLowRes.labelString: move low res
+*IvDrawStyle2.IvMoveWireFrame.labelString: move wireframe
+*IvDrawStyle2.IvMoveLowResWireFrameNoDepth.labelString: move low res wire frame ( no depth )
+*IvDrawStyle2.IvMovePoints.labelString: move points
+*IvDrawStyle2.IvMoveLowResPointsNoDepth.labelString: move low res points ( no depth )
+*IvDrawStyle2.IvMoveBoundingBoxNoDepth.labelString: move bounding box ( no depth )
+*IvDrawStyle2.IvSingleBuffer.labelString: single buffer
+*IvDrawStyle2.IvDoubleBuffer.labelString: Double buffer
+*IvDrawStyle2.IvInteractiveBuffer.labelString: interactive buffer
+!!------------------------------------------------
+*IvMenu.IvViewing.labelString: Viewing
+!!------------------------------------------------
+*IvMenu.IvDecoration.labelString: Decoration
+!!------------------------------------------------
+*IvMenu.IvHeadlight.labelString: Headlight
+!!------------------------------------------------
+*IvMenu.IvPreferences.labelString: Preferences ...
+
+!!------------------------------------------------
+!!                 PREFERENCES
+!!------------------------------------------------
+*IvFormPreference1.IvSeekAnimationTime.labelString: Seek animation time
+*IvFormPreference1.IvSeconds.labelString: seconds
+*IvFormPreference1.IvSeekTo.labelString: Seek to:
+*IvFormPreference1.IvPoint.labelString: point
+*IvFormPreference1.IvObject.labelString: object
+*IvFormPreference2.IvSeekDistance.labelString: Seek distance:
+*IvFormPreference2.IvPercentage.labelString: percentage
+*IvFormPreference2.IvAbsolute.labelString: absolute
+*IvZoomForm.IvCameraZoom.labelString: Camera zoom
+*IvZoomForm.IvZoomSliderRangesFrom.labelString: Zoom slider ranges from:
+*IvZoomForm.IvTo.labelString: to:
+*IvZoomForm.IvZoomSlider.labelString: Zoom slider
+*IvZoomForm.IvZoomField.labelString: Zoom field
+*IvZoomForm.IvZoomFrom.labelString: Zoom from
+*IvZoomForm.IvZoomTo.labelString: Zoom to
+*IvFormPreference3.IvAutoClippingPlanes.labelString: Auto clipping planes 
+*IvFormPreference4.IvStereoViewing.labelString: Stereo Viewing
+*IvFormPreference6.IvNearPlane.labelString: near plane
+*IvFormPreference6.IvFarPlane.labelString: far plane
+*IvStereoThumbForm.IvCameraRotation.labelString: Camera rotation
+
+!!------------------------------------------------
+!! Preferences for Examiner Viewer
+!!------------------------------------------------
+*IvFormExaminer1.IvEnableSpinAnimation.labelString: Enable spin animation
+*IvFormExaminer1.IvShowPointOfRotationAxes.labelString: Show point of rotation axes
+*IvFormExaminer1.IvAxesSize.labelString: axes size
+*IvFormExaminer1.IvPixels.labelString: pixels
+!!------------------------------------------------
+!! Decorations for Examiner Viewer !!
+!!------------------------------------------------
+*IvExamTitle.labelString: Examiner Viewer
+*IvExamPrefTitle.labelString: Examiner Viewer Preference Sheet
+*IvExamPopupTitle.labelString: Examiner Viewer
+*IvExamIconTitle.labelString: Examiner Viewer
+*IvExamRotx.labelString: Rotx
+*IvExamRoty.labelString: Roty
+*IvExamZoom.labelString: Zoom
+*IvExamDolly.labelString: Dolly
+!!------------------------------------------------
+!! Decorations for Plane Viewer !!
+!!------------------------------------------------
+*IvPlaneTitle.labelString: Plane Viewer
+*IvPlanePrefTitle.labelString: Plane Viewer Preference Sheet
+*IvPlanePopupTitle.labelString: Plane Viewer
+*IvPlaneIconTitle.labelString: Plane Viewer
+*IvPlaneTransx.labelString: transX
+*IvPlaneTransy.labelString: transY
+*IvPlaneZoom.labelString: Zoom
+*IvPlaneDolly.labelString: Dolly
+!!------------------------------------------------
+!! Decorations for Fly Viewer !!
+!!------------------------------------------------
+*IvFlyTitle.labelString: Fly Viewer
+*IvFlyPrefTitle.labelString: Fly Viewer Preference Sheet
+*IvFlyPopupTitle.labelString: Fly Viewer
+*IvFlyIconTitle.labelString: Fly Viewer
+!! Same for Walk Viewer !!
+*IvFlyWalkRotate.labelString: Rotate
+!! Same for Walk Viewer !!
+*IvFlyWalkTilt.labelString: Tilt
+!! Same for Walk Viewer !!
+*IvFlyWalkDolly.labelString: Dolly
+!!------------------------------------------------
+!! Preferences for Fly Viewer !!
+!!------------------------------------------------
+*FlyPreference.FlyingSpeed.labelString: Flying speed:
+*FlyPreference.Increase.labelString: increase
+*FlyPreference.Decrease.labelString: decrease 
+!!------------------------------------------------
+!! Decorations for Walk Viewer !!
+!!------------------------------------------------
+*IvWalkTitle.labelString: Walk Viewer
+*IvWalkPrefTitle.labelString: Walk Viewer Preference Sheet
+*IvWalkPopupTitle.labelString: Walk Viewer
+*IvWalkIconTitle.labelString: Walk Viewer
+*IvLeftTrimForm.IvH.labelString: H
+!!------------------------------------------------
+!! Preferences for Walk Viewer !!
+!!------------------------------------------------
+*IvFormPreference5.IvViewerSpeed.labelString: Viewer speed
+*IvFormPreference5.IvIncrease.labelString: increase
+*IvFormPreference5.IvDecrease.labelString: decrease
+!!------------------------------------------------
+!!              EDITORS
+!!------------------------------------------------
+!! Drectional Light Editor !!
+!!------------------------------------------------      
+*IvDirectLightTitle.labelString: Dir Light Editor
+*IvDirectLightIconTitle.labelString: Dir Light Ed
+*IvDirectLightInten.labelString: Inten
+*IvDirectLightColorEditor.labelString: Directional Light Color
+*IvDLMenuBar.IvEdit.labelString: Edit
+*IvDLMenuBar*IvControlPullDown*IvColorEditor.labelString: Color Editor
+*IvDLMenuBar*IvControlPullDown*IvCopy.labelString: Copy
+*IvDLMenuBar*IvControlPullDown*IvPaste.labelString: Paste
+*IvDLMenuBar*IvControlPullDown*IvHelp.labelString: Help
+!!------------------------------------------------
+!! Color Editor !!
+!!------------------------------------------------
+*IvColorEditorTitle.labelString: Color Editor
+*IvColorEditorIconTitle.labelString: Color Editor
+*IvColorEditorR.labelString: R
+*IvColorEditorG.labelString: G
+*IvColorEditorB.labelString: B
+*IvColorEditorH.labelString: H
+*IvColorEditorS.labelString: S
+*IvColorEditorV.labelString: V
+*IvColorEditorRight.labelString: Right
+*IvColorEditorSwitch.labelString: Switch
+*IvColorEditorCont.labelString: Continuous
+*IvColorEditorManu.labelString: Manual
+*IvColorEditorWysi.labelString: WYSIWYG
+*IvColorEditorCopy.labelString: Copy
+*IvColorEditorPaste.labelString: Paste
+*IvColorEditorHelp.labelString: Help
+*IvColorEditorNone.labelString: None
+*IvColorEditorValue.labelString: Value
+*IvColorEditorRGB.labelString: RGB
+*IvColorEditorHSV.labelString: HSV
+*IvColorEditorRGBV.labelString: RGB V
+*IvColorEditorRGBHSV.labelString: RGB HSV
+
+*IvCEMenuBar.IvEdit.labelString: Edit
+*IvCEMenuBar.IvSliders.labelString: Sliders
+*IvButtonsForm.IvAccept.labelString: Accept
+!!------------------------------------------------
+!! Material Editor !!
+!!------------------------------------------------
+*IvMaterialEditorTitle.labelString: Material Editor
+*IvMaterialEditorIconTitle.labelString: Mat Editor
+*IvMaterialAmbientTitle.labelString: Material Ambient Color
+*IvMaterialDiffuseTitle.labelString: Material Diffuse Color
+*IvMaterialSpecularTitle.labelString: Material Specular Color
+*IvMaterialEmissiveTitle.labelString: -Material Emissive Color
+*IvMaterialEditorMaterial.labelString: Material / 
+*IvMaterialEditorAmb.labelString: Amb / 
+*IvMaterialEditorDiff.labelString: Diff /  
+*IvMaterialEditorSpec.labelString: Spec / 
+*IvMaterialEditorEmis.labelString: Emis / 
+*IvMaterialEditorColor.labelString: Color
+*IvMEMenuBar.IvEdit.labelString: Edit
+*IvMEMenuBar*IvEditPullDown.IvMaterialList.labelString: Material List
+*IvMEMenuBar*IvEditPullDown.IvContinuous.labelString: Continuous
+*IvMEMenuBar*IvEditPullDown.IvManual.labelString: Manual
+*IvMEMenuBar*IvEditPullDown.IvCopy.labelString: Copy
+*IvMEMenuBar*IvEditPullDown.IvPaste.labelString: Paste
+*IvMEMenuBar*IvEditPullDown.IvHelp.labelString: Help
+*IvControls.IvEditColor.labelString: Edit Color
+*IvsliderForm.IvtextForm.IvAmb.labelString: Amb:
+*IvsliderForm.IvtextForm.IvDiff.labelString: Diff
+*IvsliderForm.IvtextForm.IvSpec.labelString: Spec
+*IvsliderForm.IvtextForm.IvEmis.labelString: Emis
+*IvsliderForm.IvtextForm.IvShininess.labelString: Shininess
+*IvsliderForm.IvtextForm.IvTransp.labelString: Transp:
+*IvMETop.IvAccept.labelString: Accept
+!!------------------------------------------------
+!! Material List !!
+!!------------------------------------------------
+*IvMaterialListTitle.labelString: Material List
+*IvMaterialListeIconTitle.labelString: Mat List
+*IvMLMenuBar*IvPalettes.labelString: Palettes
+!!------------------------------------------------
+!! Print Dialog
+!!------------------------------------------------
+*IvPrintDialTitle.labelString: Print Dialog 
+*IvPrintDialIconTitle.labelString: -rint Dialog
+*IvPrintDialPrinter.labelString: Printer:
+*IvPrintDialPageOut.labelString: Page Output:
+*IvPrintDialToPrinter.labelString: To Printer
+*IvPrintDialToFile.labelString: To File
+*IvPrintDialQuit.labelString: Quit
+*IvPrintDialPrint.labelString: Print
+*IvPrintDialMessage.labelString: Message:
+*IvPrintDialFileFormat.labelString: File Format:
+*IvPrintDialPostScript.labelString: PostScript
+*IvPrintDialRGB.labelString: RGB
+*IvPrintDialPrintQuality.labelString: Print Quality:
+*IvPrintDialHigh.labelString: High
+*IvPrintDialDraft.labelString: Draft
+*IvPrintDialPageFormat.labelString: Page Format
+*IvPrintDialPortrait.labelString: Portrait
+*IvPrintDialLandscape.labelString: Landscape
+*IvPrintDialPrintSize.labelString: Print Size (inches):
+*IvPrintDialFileName.labelString: File Name:
+*IvPrintDialResolution.labelString: Resolution
+*IvPrintDialBy.labelString: by
+*IvPrintDialDpi.labelString: DPI:
+*IvPrintDialMess1.labelString: Printing in progress...
+*IvPrintDialMess2.labelString: ERROR:  Empty database.
+*IvPrintDialMess3.labelString: ERROR:  Exceeds 
+*IvPrintDialMess4.labelString: ERROR:  Could not execute print.
+*IvPrintDialMess5.labelString: ERROR:  Could not execute print.
+*IvPrintDialMess6.labelString: ERROR:  No printer.
+*IvPrintDialMess7.labelString: ERROR:  Couldn't open 
+*IvPrintDialMess8.labelString: ERROR:  No file name.
+*IvPrintDialMess9.labelString: ERROR:   Could not open file.
+*IvPrintDialMess10.labelString: ERROR:  Could not get data.
+*IvPrintDialMess11.labelString: ERROR:  Could not get data.
+*IvPrintDialMess12.labelString: Printing completed.
+
+!!------------------------------------------------
+!! Xt Component ( For Light and Material Sliders Set )
+!!------------------------------------------------
+*IvXtComponentTitle.labelString: Xt Component
+*IvTGSXtComponentTitle.labelString: TGS: Xt Component
+!!------------------------------------------------
+!! For All Sliders
+!!------------------------------------------------
+*IvSlidersMin.labelString: min
+*IvSlidersMax.labelString: max
+*IvSlidersStyle.labelString: style
+!!------------------------------------------------
+!! Light Slider Set 
+!!------------------------------------------------
+*IvLightSliderColor.labelString: COLOR
+*IvLightSliderRed.labelString: Red
+*IvLightSliderGreen.labelString: Green
+*IvLightSliderBlue.labelString: Blue
+*IvLightSliderIntensity1.labelString: INTENSITY
+*IvLightSliderIntensity2.labelString: Intensity
+!!------------------------------------------------
+!! Material Slider Set
+!!------------------------------------------------
+*IvMaterialSliderAmbient.labelString: AMBIENT
+*IvMaterialSliderAmbientRed.labelString: Ambient Red
+*IvMaterialSliderAmbientGreen.labelString: Ambient Green
+*IvMaterialSliderAmbientBleu.labelString: Ambient Blue
+*IvMaterialSliderDiffuse.labelString: DIFFUSE
+*IvMaterialSliderDiffuseRed.labelString: Diffuse Red
+*IvMaterialSliderDiffuseGreen.labelString:  Diffuse Green
+*IvMaterialSliderDiffuseBleu.labelString: Diffuse Blue
+*IvMaterialSliderSpecular.labelString: SPECULAR
+*IvMaterialSliderSpecularRed.labelString: Specular Red
+*IvMaterialSliderSpecularGreen.labelString: Specular Green
+*IvMaterialSliderSpecularBleu.labelString: Specular Blue
+*IvMaterialSliderEmissive.labelString: EMISSIVE
+*IvMaterialSliderEmissiveRed.labelString: Emissive Red
+*IvMaterialSliderEmissiveGreen.labelString: Emissive Green
+*IvMaterialSliderEmissiveBlue.labelString: Emissive Blue
+*IvMaterialSliderShininess.labelString: SHININESS
+*IvMaterialSliderShininessShininess.labelString: shininess 
+*IvMaterialSliderTransparency.labelString: TRANSPARENCY
+*IvMaterialSliderTransparencyTransparency.labelString: transparency
+!!------------------------------------------------
+!! Transform Slider Set
+!!------------------------------------------------
+*IvTransformSliderTrans.labelString: TRANSLATIONS
+*IvTransformSliderTransX.labelString: X Translation
+*IvTransformSliderTransY.labelString: Y Translation
+*IvTransformSliderTransZ.labelString: Z Translation
+*IvTransformSliderScale.labelString: SCALES
+*IvTransformSliderScaleX.labelString: X Scale
+*IvTransformSliderScaleY.labelString: Y Scale
+*IvTransformSliderScaleZ.labelString: Z Scale
+*IvTransformSliderRotate.labelString: ROTATIONS
+*IvTransformSliderRotateX.labelString: X Rotate
+*IvTransformSliderRotateY.labelString: Y Rotate
+*IvTransformSliderRotateZ.labelString: Z Rotate
+*IvTransformSliderScaleOrient.labelString: SCALE ORIENTATION
+*IvTransformSliderScaleOrientX.labelString: X Rotate
+*IvTransformSliderScaleOrientY.labelString: Y Rotate
+*IvTransformSliderScaleOrientZ.labelString: Z Rotate
+*IvTransformSliderCenter.labelString: CENTER
+*IvTransformSliderCenterX.labelString: X Center
+*IvTransformSliderCenterY.labelString: Y Center
+*IvTransformSliderCenterZ.labelString: Z Center
+*IvTransformSliderTitle.labelString: Transform Editor
+*IvTransformSliderIconTitle.labelString: Xf Editor
+
+
+!!------------------- THE END --------------------
Index: trunk/geant4/visualization/visTutor/gui.mac
===================================================================
--- trunk/geant4/visualization/visTutor/gui.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/gui.mac	(revision 562)
@@ -0,0 +1,53 @@
+#
+#  This file permits to customize, with commands,
+# the menu bar of the G4UIXm, G4UIWin32 sessions.
+# It has no effect with G4UIterminal.
+#
+# File :
+/gui/addMenu file File
+/gui/addButton file Continue continue
+/gui/addButton file Exit "exit"
+#
+# Run menu :
+/gui/addMenu run Run
+/gui/addButton run "beamOn 1" "/run/beamOn 1"
+/gui/addButton run run1 "/control/execute run1.mac"
+/gui/addButton run run2 "/control/execute run2.mac"
+#
+# Gun menu :
+/gui/addMenu gun Gun
+/gui/addButton gun "50 MeV"  "/gun/energy 50 MeV"
+/gui/addButton gun "1 GeV"   "/gun/energy 1 GeV"
+/gui/addButton gun "10 GeV"  "/gun/energy 10 GeV"
+/gui/addButton gun "e-"      "/gun/particle e-"
+/gui/addButton gun "pi0"     "/gun/particle pi0"
+/gui/addButton gun "pi+"     "/gun/particle pi+"
+/gui/addButton gun "neutron" "/gun/particle neutron"
+/gui/addButton gun "proton"  "/gun/particle proton"
+#
+# Vis menu :
+/gui/addMenu vis Vis
+/gui/addButton vis Vis0(OGLIX) "/control/execute visTutor/exN03Vis0.mac"
+/gui/addButton vis Vis1(OGLSX) "/control/execute visTutor/exN03Vis1.mac"
+/gui/addButton vis Vis2(OGLSX) "/control/execute visTutor/exN03Vis2.mac"
+/gui/addButton vis Vis3(OGLSX) "/control/execute visTutor/exN03Vis3.mac"
+/gui/addButton vis Vis4(OGLIX) "/control/execute visTutor/exN03Vis4.mac"
+/gui/addButton vis Vis12(OGLIQT) "/control/execute visTutor/exN03Vis12.mac"
+/gui/addButton vis Vis14(OGLSQT) "/control/execute visTutor/exN03Vis14.mac"
+/gui/addButton vis Vis5(OIX)   "/control/execute visTutor/exN03Vis5.mac"
+/gui/addButton vis Vis6(VRML2FILE) "/control/execute visTutor/exN03Vis6.mac"
+/gui/addButton vis Vis7(DAWNFILE) "/control/execute visTutor/exN03Vis7.mac"
+/gui/addButton vis Vis8(DAWNFILE) "/control/execute visTutor/exN03Vis8.mac"
+/gui/addButton vis Vis9(OGLIWIN) "/control/execute visTutor/exN03Vis9.mac"
+/gui/addButton vis Vis10(OIWin32) "/control/execute visTutor/exN03Vis10.mac"
+/gui/addButton vis Vis11(OGLSXm) "/control/execute visTutor/exN03Vis11.mac"
+#
+# Viewer menu :
+/gui/addMenu viewer Viewer
+/gui/addButton viewer "Set style solid" "/vis/viewer/set/style solid"
+/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wire"
+#/gui/addButton viewer viewer_update "/vis/viewer/update"
+/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
+#
+# To limit the output flow in the "dump" widget :
+/N03/event/printModulo 100
Index: trunk/geant4/visualization/visTutor/heprep.mac
===================================================================
--- trunk/geant4/visualization/visTutor/heprep.mac	(revision 562)
+++ trunk/geant4/visualization/visTutor/heprep.mac	(revision 562)
@@ -0,0 +1,43 @@
+# $Id: heprep.mac,v 1.2 2003/12/01 21:09:28 perl Exp $
+#
+# Macro file for "exampleN03.cc"
+#
+# can be run in batch, without graphic
+# or interactively: Idle> /control/execute heprep.mac
+#
+# Produces heprep2 file(s)
+#
+/control/verbose 0
+/control/saveHistory
+#
+/run/verbose 0
+/event/verbose 0
+/tracking/verbose 0
+#
+# muon 300 MeV to the direction (1.,0.,0.)
+# 3 events
+#
+# Create a scene containing the detector.
+/vis/scene/create
+/vis/scene/add/volume world
+#
+# Open a HepRep version 2 file suitable for viewing in WIRED.
+/vis/open HepRepXML
+#
+# Output an empty detector
+/vis/viewer/flush
+#
+# Include trajectories in the image.
+/tracking/storeTrajectory 1
+/vis/scene/add/trajectories
+#
+# If multiple events in one run, accumulate all events into a single
+# graphical image.  If this line is commented out, each event will instead
+# appear in a separate image.
+/vis/scene/endOfEventAction accumulate
+#
+# At end of each run, an automatic flush causes graphical output.
+# This run will make an image with one event.
+/run/beamOn 1
+# This run will make an image with ten events.
+/run/beamOn 10
