Index: trunk/geant4/config/G4UI_BUILD.gmk
===================================================================
--- trunk/geant4/config/G4UI_BUILD.gmk	(revision 592)
+++ trunk/geant4/config/G4UI_BUILD.gmk	(revision 593)
@@ -1,3 +1,3 @@
-# $Id: G4UI_BUILD.gmk,v 1.4 2003/10/17 10:17:10 gbarrand Exp $
+# $Id: G4UI_BUILD.gmk,v 1.5 2007/10/03 12:15:05 lgarnier Exp $
 # -------------------------------------------------------------
 # Interfaces-specific CPPFLAGS for BUILD phase.
Index: trunk/geant4/config/G4UI_USE.gmk
===================================================================
--- trunk/geant4/config/G4UI_USE.gmk	(revision 592)
+++ trunk/geant4/config/G4UI_USE.gmk	(revision 593)
@@ -1,3 +1,3 @@
-# $Id: G4UI_USE.gmk,v 1.8 2003/10/17 10:17:10 gbarrand Exp $
+# $Id: G4UI_USE.gmk,v 1.9 2007/10/03 12:15:05 lgarnier Exp $
 # -------------------------------------------------------------
 # GNUmakefile for CPPFLAGS for interfaces USE phase.
Index: trunk/geant4/config/G4VIS_BUILD.gmk
===================================================================
--- trunk/geant4/config/G4VIS_BUILD.gmk	(revision 592)
+++ trunk/geant4/config/G4VIS_BUILD.gmk	(revision 593)
@@ -1,3 +1,3 @@
-# $Id: G4VIS_BUILD.gmk,v 1.19 2005/10/05 17:35:40 allison Exp $
+# $Id: G4VIS_BUILD.gmk,v 1.20 2007/10/03 12:15:05 lgarnier Exp $
 # -------------------------------------------------------------
 # Visualization-specific CPPFLAGS for BUILD phase.
Index: trunk/geant4/config/G4VIS_USE.gmk
===================================================================
--- trunk/geant4/config/G4VIS_USE.gmk	(revision 592)
+++ trunk/geant4/config/G4VIS_USE.gmk	(revision 593)
@@ -1,3 +1,3 @@
-# $Id: G4VIS_USE.gmk,v 1.22 2005/10/05 17:35:40 allison Exp $
+# $Id: G4VIS_USE.gmk,v 1.23 2007/10/03 12:15:05 lgarnier Exp $
 # -------------------------------------------------------------
 # GNUmakefile for CPPFLAGS for visualization USE phase.
Index: trunk/geant4/config/History
===================================================================
--- trunk/geant4/config/History	(revision 592)
+++ trunk/geant4/config/History	(revision 593)
@@ -1,3 +1,3 @@
-$Id: History,v 1.288 2006/11/30 15:47:16 gcosmo Exp $
+$Id: History,v 1.300 2007/08/16 09:34:51 gcosmo Exp $
 -------------------------------------------------------------------
 
@@ -16,4 +16,56 @@
      * Reverse chronological order (last date on top), please *
      ----------------------------------------------------------
+
+16th August 2007  Gabriele Cosmo (config-V09-00-04)
+- Corrected definition of OUT internal variable to allow for proper
+  linking also of unit tests.
+
+15th August 2007  Gabriele Cosmo (config-V09-00-03)
+- Added "rpg" hadronic model module to binmake.gmk.
+
+13th August 2007  Gabriele Cosmo (config-V09-00-02)
+- SUN-CC.gmk: forced -xO2 as optimisation level.
+
+18th July 2007  Gabriele Cosmo (config-V09-00-01)
+- liblist.c: fixed problem affecting recent CygWin installations on
+  Windows in parsing the buffer for the generation of libname.map.
+- binmake.gmk: defined OUT internal variable specifying the proper
+  compilation/linking option to Unix or Windows compilers: '-o '
+  and '/Fe' respectively.
+
+11th July 2007  Makoto Asai (config-V09-00-00)
+- Added digits_hits/scorer sub-directory to binmake.gmk.
+
+28th June 2007  Gabriele Cosmo (config-V08-03-04)
+- Updated Configure scripts to fix installation issue when installation
+  path is different from source path and headers are not installed.
+- Cleared <TAB> characters from .gmk scripts where not necessary.
+
+22nd June 2007  Gabriele Cosmo (config-V08-03-03)
+- Corrected binmake.gmk for having error_propagation in INCFLAGS properly
+  included in search path.
+- Updated internal scripts for Configure to cope with new environment
+  variable G4NEUTRONHPDATA.
+
+18th June 2007  Ben Morgan (config-V08-03-02)
+- Fixed Configure internal script to get rid of searching old physics_list
+  module at installation.
+
+27th May 2007  Gabriele Cosmo (config-V08-03-01)
+- Added "lll_fission" hadronic model module to binmake.gmk.
+
+12th May 2007  Gabriele Cosmo (config-V08-03-00)
+- Added "error_propagation" module to binmake.gmk.
+- Removed G4LIB_BUILD_LISTS flag. Physics lists are built by default.
+
+21st March 2007  Gabriele Cosmo
+- Added "biasing" module to binmake.gmk.
+
+28th February 2007  Gabriele Cosmo (config-V08-02-00)
+- Protected generation of dependencies using internal 'make' variable
+  MAKECMDGOALS in binmake.gmk and common.gmk, following suggestion made
+  in problem report #930.
+  This protection resolves the problem of generation of dependencies when
+  issueing the 'clean' target.
 
 3rd November 2006  Gunter Folger (config-V08-01-07)
Index: trunk/geant4/config/architecture.gmk
===================================================================
--- trunk/geant4/config/architecture.gmk	(revision 592)
+++ trunk/geant4/config/architecture.gmk	(revision 593)
@@ -1,3 +1,3 @@
-# $Id: architecture.gmk,v 1.107 2006/10/31 11:35:43 gunter Exp $
+# $Id: architecture.gmk,v 1.110 2007/06/28 14:16:55 gcosmo Exp $
 # ------------------------------------------------------------------------
 #       GEANT 4 - Architecture configuration script for GNU Make
@@ -14,9 +14,9 @@
 # the environment variable G4SYSTEM:
 #
-#          Linux-g++   Linux (Red Hat Enterprise/SCL3), gcc-3.2.3 (default)
-#
-#          SUN-CC      SunOS 5.8, CC 5.4
-#
-#          WIN32-VC    Windows/XP and Microsoft Visual C++ 7.1 .NET
+#          Linux-g++   Linux (Red Hat Enterprise/SCL4), gcc-3.4.6 (default)
+#
+#          SUN-CC      SunOS 5.8, CC 5.5
+#
+#          WIN32-VC    Windows/XP and Microsoft Visual C++ 8.0
 #                      Adding CYGWIN32 tools
 # -------------------------------------------------------------------------
@@ -52,5 +52,5 @@
 endif
 G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TMP) ] && mkdir -p $(G4TMP) )
-	
+
 # If not specified, the default path for G4 libraries G4LIB is
 # set to $G4INSTALL/lib/$G4SYSTEM ...
@@ -111,10 +111,4 @@
   G4LIB_BUILD_ZLIB = 1
   G4LIB_USE_ZLIB = 1
-endif
-
-# Allow to disable building of physics_lists module. Default is to build these
-#
-ifneq ($(G4LIB_BUILD_LISTS),NO)
-  G4LIB_BUILD_LISTS = 1
 endif
 
@@ -305,6 +299,5 @@
   OGLFLAGS:= $(filter-out -I/usr//include,$(OGLFLAGS))
 endif
-	
-	
+
 # If there is no cbrt() function...
 #
Index: trunk/geant4/config/binmake.gmk
===================================================================
--- trunk/geant4/config/binmake.gmk	(revision 592)
+++ trunk/geant4/config/binmake.gmk	(revision 593)
@@ -1,3 +1,3 @@
-# $Id: binmake.gmk,v 1.116 2006/11/08 16:52:19 gunter Exp $
+# $Id: binmake.gmk,v 1.129 2007/08/16 09:46:02 gcosmo Exp $
 # ----------------------------------------------------------
 # Script defining rules and paths for making binaries.
@@ -61,8 +61,9 @@
               -I$(G4BASE)/particles/hadrons/mesons/include \
               -I$(G4BASE)/particles/shortlived/include \
-	      -I$(G4BASE)/physics_lists/lists/include \
-	      -I$(G4BASE)/physics_lists/builders/include \
+              -I$(G4BASE)/physics_lists/lists/include \
+              -I$(G4BASE)/physics_lists/builders/include \
               -I$(G4BASE)/processes/management/include \
               -I$(G4BASE)/processes/cuts/include \
+              -I$(G4BASE)/processes/biasing/include \
               -I$(G4BASE)/processes/scoring/include \
               -I$(G4BASE)/processes/decay/include \
@@ -78,17 +79,17 @@
               -I$(G4BASE)/processes/electromagnetic/polarisation/include \
               -I$(G4BASE)/processes/hadronic/cross_sections/include \
-	      -I$(G4BASE)/processes/hadronic/management/include \
-	      -I$(G4BASE)/processes/hadronic/models/abrasion/include \
+              -I$(G4BASE)/processes/hadronic/management/include \
+              -I$(G4BASE)/processes/hadronic/models/abrasion/include \
               -I$(G4BASE)/processes/hadronic/models/binary_cascade/include \
-	      -I$(G4BASE)/processes/hadronic/models/cascade/cascade/include \
-	      -I$(G4BASE)/processes/hadronic/models/cascade/evaporation/include \
-	      -I$(G4BASE)/processes/hadronic/models/cascade/utils/include \
+              -I$(G4BASE)/processes/hadronic/models/cascade/cascade/include \
+              -I$(G4BASE)/processes/hadronic/models/cascade/evaporation/include \
+              -I$(G4BASE)/processes/hadronic/models/cascade/utils/include \
               -I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/body/include \
               -I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/interface/include \
               -I$(G4BASE)/processes/hadronic/models/coherent_elastic/include \
-	      -I$(G4BASE)/processes/hadronic/models/de_excitation/ablation/include \
+              -I$(G4BASE)/processes/hadronic/models/de_excitation/ablation/include \
               -I$(G4BASE)/processes/hadronic/models/de_excitation/evaporation/include \
               -I$(G4BASE)/processes/hadronic/models/de_excitation/fermi_breakup/include \
-	      -I$(G4BASE)/processes/hadronic/models/de_excitation/fission/include \
+              -I$(G4BASE)/processes/hadronic/models/de_excitation/fission/include \
               -I$(G4BASE)/processes/hadronic/models/de_excitation/gem_evaporation/include \
               -I$(G4BASE)/processes/hadronic/models/de_excitation/handler/include \
@@ -104,4 +105,5 @@
               -I$(G4BASE)/processes/hadronic/models/isotope_production/include \
               -I$(G4BASE)/processes/hadronic/models/leading_particle/include \
+              -I$(G4BASE)/processes/hadronic/models/lll_fission/include \
               -I$(G4BASE)/processes/hadronic/models/low_energy/include \
               -I$(G4BASE)/processes/hadronic/models/management/include \
@@ -118,4 +120,5 @@
               -I$(G4BASE)/processes/hadronic/models/relativistic_qmd/include \
               -I$(G4BASE)/processes/hadronic/models/relativistic_qmd/uplusplus/include \
+              -I$(G4BASE)/processes/hadronic/models/rpg/include \
               -I$(G4BASE)/processes/hadronic/models/theo_high_energy/include \
               -I$(G4BASE)/processes/hadronic/models/util/include \
@@ -138,8 +141,10 @@
               -I$(G4BASE)/digits_hits/hits/include \
               -I$(G4BASE)/digits_hits/digits/include \
+              -I$(G4BASE)/digits_hits/scorer/include \
               -I$(G4BASE)/digits_hits/utils/include \
               -I$(G4BASE)/persistency/include \
               -I$(G4BASE)/readout/include \
               -I$(G4BASE)/event/include \
+              -I$(G4BASE)/error_propagation/include \
               -I$(G4BASE)/graphics_reps/include \
               -I$(G4BASE)/intercoms/include
@@ -207,14 +212,11 @@
   endif
 
-  LDLIBS2 += -lG4readout
-
-  ifeq ($(G4LIB_BUILD_LISTS),1)
-    LDLIBS2 += -lG4physicslists
-  endif
-    
-  LDLIBS2 += -lG4run \
+  LDLIBS2 += -lG4error_propagation \
+             -lG4readout \
+             -lG4physicslists \
+             -lG4run \
              -lG4event \
              -lG4tracking \
-	     -lG4parmodels \
+             -lG4parmodels \
              -lG4processes \
              -lG4digits_hits \
@@ -232,17 +234,17 @@
     LDLIBS2 = $(shell \
         G4TMP=$(G4TMP); export G4TMP; \
-	if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
-	  -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
-	$(G4LIB)/$(G4SYSTEM)/liblist \
-	  -m $(G4LIB)/$(G4SYSTEM) \
-	  < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
+        if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
+          -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
+        $(G4LIB)/$(G4SYSTEM)/liblist \
+          -m $(G4LIB)/$(G4SYSTEM) \
+          < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
   else
     LDLIBS2 = $(shell \
         G4TMP=$(G4TMP); export G4TMP; \
-	if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
-	  -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
-	$(G4LIB)/$(G4SYSTEM)/liblist \
-	  -d $(G4TMPDIR) \
-	  < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
+        if [ \( -f $(G4LIB)/$(G4SYSTEM)/liblist \
+          -a -f $(G4LIB)/$(G4SYSTEM)/libname.map \) ]; then \
+        $(G4LIB)/$(G4SYSTEM)/liblist \
+          -d $(G4TMPDIR) \
+          < $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
 # Warning: do not add to LDLIBS2 with += because this causes it to be
 # expanded too soon.  Hence extra libraries must have a different name...
@@ -283,4 +285,5 @@
 
 ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
+  # Windows
   WIN32TMP := $(patsubst -L%,$(LIB_PATH)%,$(LDFLAGS))
   LDFLAGS  = $(patsubst /,$(PATH_DEL),$(WIN32TMP))
@@ -292,11 +295,14 @@
         LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.a,$(WIN32TMP3)) $(patsubst -l%,lib%.lib,$(WIN32TMP4))
     else
-	LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.lib,$(WIN32TMP2))
+        LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.lib,$(WIN32TMP2))
     endif
   else
-  	LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.a,$(WIN32TMP2))
-  endif
-else
+    LDLIBS = $(TARGETLIB) $(patsubst -l%,lib%.a,$(WIN32TMP2))
+  endif
+  OUT   := /Fe
+else
+  # Unix
   LDLIBS = $(TARGETLIB) $(LDLIBS_PREFINAL)
+  OUT   := -o 
 endif
 
@@ -305,5 +311,5 @@
 include $(G4INSTALL)/config/sys/$(G4SYSTEM)-runpath.gmk
 endif
-	
+
 sources := $(wildcard $(G4TARGET).cc)
 objects := $(patsubst %.cc,$(G4TMPDIR)/exe/%.$(TARGOBJEXT),$(sources))
@@ -340,10 +346,10 @@
 ifdef CPPVERBOSE
 	$(CXX) $(CXXFLAGS) $(CPPFLAGS) \
-	  -o $(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
+	  $(OUT)$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
 	  $(LDLIBS)
 else
 	@echo Linking $(G4TARGET) ...
 	@$(CXX) $(CXXFLAGS) $(CPPFLAGS) \
-	  -o $(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
+	  $(OUT)$(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
 	  $(LDLIBS)
 	@if [ \( -f $(G4BINDIR)/$(G4TARGET) \) ]; then \
@@ -402,5 +408,7 @@
 	[ -s $@ ] || rm -f $@
 ifneq ($(dependencies),)
+ifneq ($(MAKECMDGOALS),clean)
 -include $(dependencies)
+endif
 endif
 
Index: trunk/geant4/config/common.gmk
===================================================================
--- trunk/geant4/config/common.gmk	(revision 592)
+++ trunk/geant4/config/common.gmk	(revision 593)
@@ -1,3 +1,3 @@
-# $Id: common.gmk,v 1.41 2005/12/07 09:41:54 gcosmo Exp $
+# $Id: common.gmk,v 1.43 2007/06/28 14:33:38 gcosmo Exp $
 # ----------------------------------------------------------------
 # Common part of GNUmakefile for libraries.  John Allison, 5/7/95.
@@ -111,5 +111,7 @@
 	[ -s $@ ] || rm -f $@
 ifneq ($(dependencies),)
+ifneq ($(MAKECMDGOALS),clean)
 -include $(dependencies)
+endif
 endif
 
@@ -122,8 +124,8 @@
 # NOTE: the double colon rule allows to add other rules for the same target
 #
-includes::	$(installed_includes)
+includes:: $(installed_includes)
 
 # Static Pattern rules, see GNU make manual for details.
-#           target(s): target-pattern : dep-pattern	
+#           target(s): target-pattern : dep-pattern
 #
 $(installed_includes): $(G4INCLUDE)/% : include/%
Index: trunk/geant4/config/liblist.c
===================================================================
--- trunk/geant4/config/liblist.c	(revision 592)
+++ trunk/geant4/config/liblist.c	(revision 593)
@@ -1,3 +1,3 @@
-/* $Id: liblist.c,v 1.18 2006/10/05 14:22:06 gcosmo Exp $ */
+/* $Id: liblist.c,v 1.19 2007/07/18 14:21:15 gcosmo Exp $ */
 
 /*
@@ -304,5 +304,4 @@
 #if defined ( _WIN32 ) || defined ( __CYGWIN__ ) || defined ( __CYGWIN32__ )
       ptr=strchr(ntg4tmp1,':');
-      if ( ptr ) *(ptr+1)='\0';
 
       while ( ptr=strchr(buffer,'\\') ) *ptr='/';
Index: trunk/geant4/config/scripts/env.csh.SH
===================================================================
--- trunk/geant4/config/scripts/env.csh.SH	(revision 592)
+++ trunk/geant4/config/scripts/env.csh.SH	(revision 593)
@@ -38,5 +38,5 @@
 unsetenv  G4LEDATA
 unsetenv  G4LEVELGAMMADATA
-unsetenv  NeutronHPCrossSections
+unsetenv  G4NEUTRONHPDATA
 unsetenv  G4RADIOACTIVEDATA
 
@@ -141,6 +141,6 @@
 #+
 if ( X$g4neutronhpcrosssections != X ) then
-setenv NeutronHPCrossSections "$g4neutronhpcrosssections"
-echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
+setenv G4NEUTRONHPDATA "$g4neutronhpcrosssections"
+echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA"
 endif
 
Index: trunk/geant4/config/scripts/env.sh.SH
===================================================================
--- trunk/geant4/config/scripts/env.sh.SH	(revision 592)
+++ trunk/geant4/config/scripts/env.sh.SH	(revision 593)
@@ -38,5 +38,5 @@
 unset  G4LEDATA
 unset  G4LEVELGAMMADATA
-unset  NeutronHPCrossSections
+unset  G4NEUTRONHPDATA
 unset  G4RADIOACTIVEDATA
 
@@ -164,8 +164,8 @@
 #+
 if [ X$g4neutronhpcrosssections != X ] ; then 
-NeutronHPCrossSections="$g4neutronhpcrosssections"
-export NeutronHPCrossSections
-if [ X\$g4non_display = X ] ; then
-echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
+G4NEUTRONHPDATA="$g4neutronhpcrosssections"
+export G4NEUTRONHPDATA
+if [ X\$g4non_display = X ] ; then
+echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA"
 fi
 fi
@@ -618,5 +618,5 @@
 if [ $G4WORKDIR ] ; then
 
-if [ X$g4non_display = X ] ; then
+if [ X\$g4non_display = X ] ; then
 echo "In your environment you have the G4WORKDIR=$G4WORKDIR"
 fi
@@ -627,5 +627,5 @@
 if test "X$G4SYSTEM" = "XWIN32-VC" -o "X$G4SYSTEM" = "XWIN32-VC7"; then
 
-if [ X$g4non_display = X ] ; then
+if [ X\$g4non_display = X ] ; then
 echo "G4WORKDIR will be set to c:/geant4 (in "native" Windows syntax)"
 fi
@@ -636,5 +636,5 @@
 else # if Unix
 
-if [ X$g4non_display = X ] ; then
+if [ X\$g4non_display = X ] ; then
 echo "G4WORKDIR will be set to HOME/geant4=$HOME/geant4"
 fi
@@ -657,5 +657,4 @@
 # Warning about LD_LIBRARY_PATH
 #
-if [ X$g4non_display = X ] ; then
 echo ''
 echo 'LD_LIBRARY_PATH is set to include CLHEP and Geant4 libraries. '
@@ -667,5 +666,4 @@
 echo 'present in your system !'
 echo ''
-fi
 
 if [ $LD_LIBRARY_PATH ] ; then
Index: trunk/geant4/config/scripts/install.sh.SH
===================================================================
--- trunk/geant4/config/scripts/install.sh.SH	(revision 592)
+++ trunk/geant4/config/scripts/install.sh.SH	(revision 593)
@@ -38,5 +38,5 @@
 unset  G4LEDATA
 unset  G4LEVELGAMMADATA
-unset  NeutronHPCrossSections
+unset  G4NEUTRONHPDATA
 unset  G4RADIOACTIVEDATA
 
@@ -145,7 +145,7 @@
 #+
 if [ X$g4neutronhpcrosssections != X ] ; then 
-NeutronHPCrossSections="$g4neutronhpcrosssections"
-export NeutronHPCrossSections
-echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
+G4NEUTRONHPDATA="$g4neutronhpcrosssections"
+export G4NEUTRONHPDATA
+echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA"
 fi
 
Index: trunk/geant4/config/scripts/move.sh.SH
===================================================================
--- trunk/geant4/config/scripts/move.sh.SH	(revision 592)
+++ trunk/geant4/config/scripts/move.sh.SH	(revision 593)
@@ -90,7 +90,7 @@
 #+
 if [ X$g4neutronhpcrosssections != X ] ; then 
-NeutronHPCrossSections="$g4neutronhpcrosssections"
-export NeutronHPCrossSections
-echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
+G4NEUTRONHPDATA="$g4neutronhpcrosssections"
+export G4NEUTRONHPDATA
+echo "On this machine the G4NEUTRONHPDATA=\$G4NEUTRONHPDATA"
 fi
 
@@ -385,5 +385,5 @@
 echo ""
 mkdir -p $g4final_install/src/geant4/
-tar cf - Configure config/ source/ environments/ physics_lists/ examples/ |(cd $g4final_install/src/geant4/; tar xf -)
+tar cf - Configure config/ source/ environments/ examples/ include/ |(cd $g4final_install/src/geant4/; tar xf -)
 fi
 fi
@@ -399,5 +399,5 @@
 
 mkdir -p $g4final_install/src/geant4/
-tar cf - Configure config/ source/ environments/ physics_lists/ examples/ |(cd $g4final_install/src/geant4/; tar xf -)
+tar cf - Configure config/ source/ environments/ examples/ |(cd $g4final_install/src/geant4/; tar xf -)
 fi
 
Index: trunk/geant4/config/sys/Darwin-g++.gmk
===================================================================
--- trunk/geant4/config/sys/Darwin-g++.gmk	(revision 592)
+++ trunk/geant4/config/sys/Darwin-g++.gmk	(revision 593)
@@ -43,17 +43,23 @@
 #   XMFLAGS   := -I/usr/X11R6/include          ##### some installations.
   endif
-  ifndef QTFLAGS
-    QTHOME    := /usr/local/Qt/4.2.2
-#    QTFLAGS   := -I$(QTHOME)/lib/QtCore.framework/Versions/Current/Headers -I$(QTHOME)/lib/QtGui.framework/Versions/Current/Headers -I$(QTHOME)/lib/QtOpenGL.framework/Versions/Current/Headers -I$(QTHOME)/lib/QtSql.framework/Versions/Current/Headers -I$(QTHOME)/lib/QtXml.framework/Versions/Current/Headers -F$(QTHOME)/lib
-    QTFLAGS   := -I$(QTHOME)/include/Qt -F$(QTHOME)/lib
-    MOC       := $(QTHOME)/bin/moc
-  endif
   ifndef XMLIBS
     XMLIBS    := -L/sw/lib -lXm -lXpm
 #   XMLIBS    := -L/usr/X11R6/lib -lXm -lXpm   ##### some installations.
   endif
+  ifndef QTHOME
+    QTHOME  := /sw
+  endif
+  ifndef QTFLAGS
+    QTFLAGS   := -I$(QTHOME)/include
+    QTFLAGS   += -I$(QTHOME)/lib/QtCore.framework/Versions/Current/Headers
+    QTFLAFS   += -I$(QTHOME)/lib/QtGui.framework/Versions/Current/Headers
+    QTFLAGS   += -I$(QTHOME)/lib/QtOpenGL.framework/Versions/Current/Headers
+    QTFLAGS   += -I$(QTHOME)/lib/QtSql.framework/Versions/Current/Headers
+    QTFLAGS   += -I$(QTHOME)/lib/QtXml.framework/Versions/Current/Headers
+    MOC       := $(QTHOME)/bin/moc
+  endif
   ifndef QTLIBS
-    QTHOME    := /usr/local/Qt/4.2.2
-    QTLIBS    := -F$(QTHOME)/lib -framework QtCore -framework QtGui -framework QtOpenGL -framework QtSql -framework QtXml
+    QTLIBS    := -F$(QTHOME)/lib -framework QtCore -framework QtGui
+    QTLIBS    += -framework QtOpenGL -framework QtSql -framework QtXml
   endif
   ifndef XAWFLAGS
Index: trunk/geant4/config/sys/SUN-CC.gmk
===================================================================
--- trunk/geant4/config/sys/SUN-CC.gmk	(revision 592)
+++ trunk/geant4/config/sys/SUN-CC.gmk	(revision 593)
@@ -5,5 +5,5 @@
   CXX       := CC
   ifdef G4OPTIMISE
-    CXXFLAGS  := -O
+    CXXFLAGS  := -xO2
   else
     ifdef G4DEBUG
Index: trunk/geant4/interfaces/GAG/include/G4UIGAG.hh
===================================================================
--- trunk/geant4/interfaces/GAG/include/G4UIGAG.hh	(revision 592)
+++ trunk/geant4/interfaces/GAG/include/G4UIGAG.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIGAG.hh,v 1.7 2006/06/29 19:09:18 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G4UIGAG.hh
Index: trunk/geant4/interfaces/GAG/include/G4UIGainServer.hh
===================================================================
--- trunk/geant4/interfaces/GAG/include/G4UIGainServer.hh	(revision 592)
+++ trunk/geant4/interfaces/GAG/include/G4UIGainServer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIGainServer.hh,v 1.5 2006/06/29 19:09:21 gunter Exp $
-// $Name: geant4-08-01-patch-01 $
+// $Name: geant4-09-00-ref-01 $
 //
 
Index: trunk/geant4/interfaces/GAG/src/G4UIGAG.cc
===================================================================
--- trunk/geant4/interfaces/GAG/src/G4UIGAG.cc	(revision 592)
+++ trunk/geant4/interfaces/GAG/src/G4UIGAG.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIGAG.cc,v 1.18 2006/06/29 19:09:23 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G4UIGAG.cc
Index: trunk/geant4/interfaces/GAG/src/G4UIGainServer.cc
===================================================================
--- trunk/geant4/interfaces/GAG/src/G4UIGainServer.cc	(revision 592)
+++ trunk/geant4/interfaces/GAG/src/G4UIGainServer.cc	(revision 593)
@@ -27,5 +27,5 @@
 // 12/06/2002 G4UIGainServer H. MInamimoto and H. Yoshida created
 // $Id: G4UIGainServer.cc,v 1.10 2006/06/29 19:09:25 gunter Exp $
-// $Name: geant4-08-01-patch-01 $
+// $Name: geant4-09-00-ref-01 $
 //
 #ifndef WIN32
Index: trunk/geant4/interfaces/History
===================================================================
--- trunk/geant4/interfaces/History	(revision 592)
+++ trunk/geant4/interfaces/History	(revision 593)
@@ -1,3 +1,3 @@
-$Id: History,v 1.78 2005/11/28 18:20:20 gcosmo Exp $
+$Id: History,v 1.82 2007/06/19 10:38:28 gcosmo Exp $
 -------------------------------------------------------------------
 
@@ -18,4 +18,16 @@
      ----------------------------------------------------------
 
+19 June 2007, Gabriele Cosmo (interfaces-V08-03-02)
+- Fix compilation error on Windows ('theShell' not declared).
+
+14 June 2007, Koichi Murakami (interfaces-V08-03-01)
+- fixed the problem with Ctl-C termination for bash users.
+ * G4VUIshell   : add a virtual method ResetTerminal()
+ * G4UItcsh     : add a method ResetTerminal()
+ * G4UIterminal : add terminal reset when Ctl-C termination
+
+22 May 2007, Koichi Murakami (interface-V08-03-00)
+- G4UIterminal.cc: implement signal handler for soft-abort
+
 28 November 2005, Gabriele Cosmo (interface-V07-01-02)
 - G4UIXm.cc migrated to sstream
Index: trunk/geant4/interfaces/basic/GNUmakefile
===================================================================
--- trunk/geant4/interfaces/basic/GNUmakefile	(revision 592)
+++ trunk/geant4/interfaces/basic/GNUmakefile	(revision 593)
@@ -1,11 +1,5 @@
-# $Id: GNUmakefile,v 1.2 2005/01/26 08:50:58 gcosmo Exp $
+# $Id: GNUmakefile,v 1.3 2007/05/21 07:30:33 kmura Exp $
 # -------------------------------------------------------------
 # GNUmakefile for interfaces/basic library.  John Allison, 6/7/98.
-
-#ifdef G4UI_USE_QT
-# This is not  good solution, we have to 'make' twice, but it works...
-#moc :
-#	@$(MOC) -DG4UI_USE_QT include/G4UIQt.hh -o src/G4UIQt_moc.cc
-#endif
 
 name := G4UIbasic
@@ -22,6 +16,31 @@
 CPPFLAGS += -I$(G4BASE)/interfaces/common/include
 CPPFLAGS += -I$(G4BASE)/intercoms/include
-
-
+CPPFLAGS += -I$(G4BASE)/global/management/include \
+            -I$(G4BASE)/global/HEPRandom/include \
+            -I$(G4BASE)/global/HEPGeometry/include \
+            -I$(G4BASE)/run/include \
+            -I$(G4BASE)/event/include \
+            -I$(G4BASE)/track/include \
+            -I$(G4BASE)/tracking/include \
+            -I$(G4BASE)/particles/management/include \
+            -I$(G4BASE)/processes/management/include \
+            -I$(G4BASE)/processes/cuts/include \
+            -I$(G4BASE)/processes/electromagnetic/utils/include \
+            -I$(G4BASE)/processes/transportation/include \
+            -I$(G4BASE)/processes/decay/include \
+            -I$(G4BASE)/materials/include \
+            -I$(G4BASE)/geometry/management/include \
+            -I$(G4BASE)/geometry/volumes/include \
+            -I$(G4BASE)/geometry/navigation/include \
+            -I$(G4BASE)/geometry/magneticfield/include \
+            -I$(G4BASE)/geometry/biasing/include \
+            -I$(G4BASE)/digits_hits/detector/include \
+            -I$(G4BASE)/digits_hits/hits/include \
+            -I$(G4BASE)/digits_hits/digits/include \
+            -I$(G4BASE)/interfaces/common/include \
+            -I$(G4BASE)/interfaces/basic/include \
+            -I$(G4BASE)/intercoms/include \
+            -I$(G4BASE)/graphics_reps/include
 
 include $(G4INSTALL)/config/common.gmk
+
Index: trunk/geant4/interfaces/basic/include/G4UIArrayString.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UIArrayString.hh	(revision 592)
+++ trunk/geant4/interfaces/basic/include/G4UIArrayString.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIArrayString.hh,v 1.3 2006/06/29 19:09:27 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
Index: trunk/geant4/interfaces/basic/include/G4UIQt.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UIQt.hh	(revision 592)
+++ trunk/geant4/interfaces/basic/include/G4UIQt.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4UIQt.hh,v 1.13 2006/06/29 19:09:33 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4UIQt.hh,v 1.2 2007/11/08 17:00:09 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 #ifndef G4UIQt_h
@@ -38,15 +38,15 @@
 #include "G4VInteractiveSession.hh"
 
-#include <QtGui/qmainwindow.h>
-#include <QtGui/qlineedit.h>
-#include <QtGui/qlistwidget.h>
-#include <QtGui/qtextedit.h>
-#include <QtGui/qlabel.h>
-#include <QtGui/qtreewidget.h>
-#include <QSignalMapper.h>
-#include <QObject>
+#include <QtCore/QObject>
 
+class QMainWindow;
+class QLineEdit;
 class G4UIsession;
-
+class QListWidget;
+class QTextEdit;
+class QLabel;
+class QDialog;
+class QTreeWidgetItem;
+class QTreeWidget;
 
 // Class description :
Index: trunk/geant4/interfaces/basic/include/G4UIWin32.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UIWin32.hh	(revision 592)
+++ trunk/geant4/interfaces/basic/include/G4UIWin32.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIWin32.hh,v 1.14 2006/06/29 19:09:29 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 #ifndef G4UIWin32_h
Index: trunk/geant4/interfaces/basic/include/G4UIXaw.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UIXaw.hh	(revision 592)
+++ trunk/geant4/interfaces/basic/include/G4UIXaw.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIXaw.hh,v 1.6 2006/06/29 19:09:31 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 #ifndef G4UIXaw_h
Index: trunk/geant4/interfaces/basic/include/G4UIXm.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UIXm.hh	(revision 592)
+++ trunk/geant4/interfaces/basic/include/G4UIXm.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIXm.hh,v 1.13 2006/06/29 19:09:33 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 #ifndef G4UIXm_h
Index: trunk/geant4/interfaces/basic/include/G4UIcsh.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UIcsh.hh	(revision 592)
+++ trunk/geant4/interfaces/basic/include/G4UIcsh.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIcsh.hh,v 1.4 2006/06/29 19:09:35 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
Index: trunk/geant4/interfaces/basic/include/G4UItcsh.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UItcsh.hh	(revision 592)
+++ trunk/geant4/interfaces/basic/include/G4UItcsh.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4UItcsh.hh,v 1.7 2006/06/29 19:09:37 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4UItcsh.hh,v 1.8 2007/06/14 05:44:58 kmura Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
@@ -40,5 +40,5 @@
 #include "G4UIcommandTree.hh"
 
-//
+// ====================================================================
 //   Description:
 //   This class gives tcsh-like shell.
@@ -68,4 +68,5 @@
 //   %h ... history# (different from G4 history#)
 //
+// ====================================================================
 
 class G4UItcsh : public G4VUIshell {
@@ -125,6 +126,11 @@
   void SetLsColor(TermColorIndex dirColor, TermColorIndex cmdColor);
   virtual G4String GetCommandLine(const char* msg=0);
+
+  virtual void ResetTerminal();
 };
 
+// ====================================================================
+//   inline functions
+// ====================================================================
 inline G4bool G4UItcsh::IsCursorLast() const
 {
Index: trunk/geant4/interfaces/basic/include/G4UIterminal.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UIterminal.hh	(revision 592)
+++ trunk/geant4/interfaces/basic/include/G4UIterminal.hh	(revision 593)
@@ -24,17 +24,9 @@
 // ********************************************************************
 //
+// $Id: G4UIterminal.hh,v 1.10 2007/05/22 01:51:05 kmura Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
-// $Id: G4UIterminal.hh,v 1.9 2006/06/29 19:09:39 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
-//
-
-#ifndef G4UIterminal_h
-#define G4UIterminal_h 1
-
-#include <fstream>
-#include "G4UImanager.hh"
-#include "G4VBasicShell.hh"
-#include "G4VUIshell.hh"
-
+// ====================================================================
+//   G4UIterminal.cc
 //
 //   Description:
@@ -69,5 +61,12 @@
 //
 //   For more detail, see source codes.
-//
+// ====================================================================
+#ifndef G4UIterminal_h
+#define G4UIterminal_h 1
+
+#include <fstream>
+#include "G4UImanager.hh"
+#include "G4VBasicShell.hh"
+#include "G4VUIshell.hh"
 
 class G4UIterminal : public G4VBasicShell {
@@ -82,5 +81,5 @@
 
 public:
-  G4UIterminal(G4VUIshell* aShell=0);
+  G4UIterminal(G4VUIshell* aShell=0, G4bool qsig=true);
   ~G4UIterminal();
 
Index: trunk/geant4/interfaces/basic/include/G4VUIshell.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4VUIshell.hh	(revision 592)
+++ trunk/geant4/interfaces/basic/include/G4VUIshell.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VUIshell.hh,v 1.6 2006/06/29 19:09:41 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4VUIshell.hh,v 1.7 2007/06/14 05:44:58 kmura Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
@@ -34,5 +34,5 @@
 #include "globals.hh"
 
-//
+// ====================================================================
 //   Description: 
 //   This class is the abstract base class for various UI shells.
@@ -50,4 +50,5 @@
 //   %/ ... current working directory
 //
+// ====================================================================
 
 // terminal color index
@@ -95,8 +96,11 @@
   // get command string from a command line
   virtual G4String GetCommandLine(const char* msg=0)= 0;
+
+  virtual void ResetTerminal();
 };
 
-
-// inlines...
+// ====================================================================
+//   inline functions
+// ====================================================================
 inline void G4VUIshell::SetNColumn(G4int ncol)
 {
Index: trunk/geant4/interfaces/basic/src/G4UIArrayString.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIArrayString.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4UIArrayString.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIArrayString.cc,v 1.8 2006/06/29 19:09:43 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
Index: trunk/geant4/interfaces/basic/src/G4UIQt.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIQt.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4UIQt.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4UIQt.cc,v 1.14 2007/05/29 11:09:49 $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4UIQt.cc,v 1.3 2007/11/08 17:00:09 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // L. Garnier
@@ -46,15 +46,22 @@
 #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 <QtGui/qevent.h>
+#include <QtGui/QApplication.h>
+#include <QtGui/QMainWindow.h>
+#include <QtGui/QLineEdit.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 <QtGui/QEvent.h>
+#include <QtGui/QListWidget.h>
+#include <QtGui/QTextEdit.h>
+#include <QtGui/QTreeWidget.h>
+#include <QtCore/QSignalMapper.h>
+
 
 #include <stdlib.h>
Index: trunk/geant4/interfaces/basic/src/G4UIQt_moc.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIQt_moc.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4UIQt_moc.cc	(revision 593)
@@ -2,9 +2,11 @@
 ** Meta object code from reading C++ file 'G4UIQt.hh'
 **
-** Created: Mon Sep 17 14:28:15 2007
+** Created: Mon Oct 1 10:59:35 2007
 **      by: The Qt Meta Object Compiler version 59 (Qt 4.2.2)
 **
 ** WARNING! All changes made in this file will be lost!
 *****************************************************************************/
+
+#ifdef G4UI_BUILD_QT_SESSION
 
 #include "../include/G4UIQt.hh"
@@ -99,2 +101,4 @@
     QMetaObject::activate(this, &staticMetaObject, 0, _a);
 }
+
+#endif
Index: trunk/geant4/interfaces/basic/src/G4UIWin32.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIWin32.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4UIWin32.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIWin32.cc,v 1.13 2006/06/29 19:09:45 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G.Barrand
Index: trunk/geant4/interfaces/basic/src/G4UIXaw.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIXaw.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4UIXaw.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIXaw.cc,v 1.6 2006/06/29 19:09:47 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G.Barrand
Index: trunk/geant4/interfaces/basic/src/G4UIXm.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIXm.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4UIXm.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIXm.cc,v 1.14 2006/06/29 19:09:49 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G.Barrand
Index: trunk/geant4/interfaces/basic/src/G4UIcsh.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIcsh.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4UIcsh.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4UIcsh.cc,v 1.8 2006/06/29 19:09:51 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
Index: trunk/geant4/interfaces/basic/src/G4UItcsh.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UItcsh.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4UItcsh.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4UItcsh.cc,v 1.12 2006/06/29 19:09:54 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4UItcsh.cc,v 1.15 2007/11/06 09:36:23 kmura Exp $
+// GEANT4 tag $Name:  $
 //
 
@@ -37,4 +37,6 @@
 #include <ctype.h>
 #include <sstream>
+#include <fstream>
+#include <stdlib.h>
 
 // ASCII character code
@@ -59,4 +61,7 @@
 static const int AsciiPrintableMin = 32;
 
+// history file
+static const G4String historyFileName= "/.g4_hist";
+
 /////////////////////////////////////////////////////////
 G4UItcsh::G4UItcsh(const G4String& prompt, G4int maxhist)
@@ -69,4 +74,22 @@
   // get current terminal mode
   tcgetattr(0, &tios);
+
+  // read a shell history file
+  G4String homedir= getenv("HOME");
+  G4String fname= homedir + historyFileName;
+
+  std::ifstream histfile;
+  enum { BUFSIZE= 1024 }; char linebuf[BUFSIZE];
+
+  histfile.open(fname, std::ios::in);
+  while (histfile.good()) {
+    if(histfile.eof()) break;
+
+    histfile.getline(linebuf, BUFSIZE);
+    G4String aline= linebuf;
+    aline.strip(G4String::both);
+    if(aline.size() !=  0) StoreHistory(linebuf);
+  }
+  histfile.close();
 }
 
@@ -75,9 +98,24 @@
 /////////////////////
 {
-}
+  // store a shell history
+  G4String homedir= getenv("HOME");
+  G4String fname= homedir + historyFileName;
+
+  std::ofstream histfile;
+  histfile.open(fname, std::ios::out);
+
+  G4int n0hist= 1;
+  if( currentHistoryNo > maxHistory ) n0hist= currentHistoryNo-maxHistory+1;
+
+  for (G4int i=n0hist; i<= currentHistoryNo; i++) {
+    histfile << RestoreHistory(i) << G4endl;
+  }
   
-///////////////////////////
+  histfile.close();
+}
+
+//////////////////////////////////////////
 void G4UItcsh::MakePrompt(const char* msg)
-///////////////////////////
+//////////////////////////////////////////
 {
   if(promptSetting.length()<=1) {
@@ -130,4 +168,13 @@
 }
 
+
+//////////////////////////////
+void G4UItcsh::ResetTerminal()
+//////////////////////////////
+{
+  RestoreTerm();
+}
+
+
 // --------------------------------------------------------------------
 //      commad line operations
@@ -465,5 +512,5 @@
 
   G4int jt= input.find_last_of('/');
-  if(jt<jhead) jt=G4String::npos;
+  if(jt<jhead) jt=G4int(G4String::npos);
 
   if(jt==G4int(G4String::npos)) jt= jhead;
@@ -472,5 +519,5 @@
   G4String dspstr; 
   G4int i;
-  for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(AsciiBS); // cleanup
+  for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(AsciiBS); 
   for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(' '); 
   for(i=jt; i<=G4int(input.length())-1; i++) dspstr+= G4String(AsciiBS); 
@@ -592,7 +639,7 @@
 }
 
-///////////////////////////////////
+//////////////////////////////////////////////////
 G4String G4UItcsh::GetCommandLine(const char* msg)
-///////////////////////////////////
+//////////////////////////////////////////////////
 {
   SetTermToInputMode();
Index: trunk/geant4/interfaces/basic/src/G4UIterminal.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIterminal.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4UIterminal.cc	(revision 593)
@@ -25,8 +25,11 @@
 //
 //
-// $Id: G4UIterminal.cc,v 1.21 2006/06/29 19:09:56 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
-//
-
+// $Id: G4UIterminal.cc,v 1.27 2007/10/29 18:49:45 asaim Exp $
+// GEANT4 tag $Name:  $
+//
+// ====================================================================
+//   G4UIterminal.cc
+//
+// ====================================================================
 #include "G4Types.hh"
 #include "G4StateManager.hh"
@@ -38,8 +41,52 @@
 #include <sstream>
 
-
-//////////////////////////////////////////////
-G4UIterminal::G4UIterminal(G4VUIshell* aShell)
-//////////////////////////////////////////////
+#ifndef WIN32
+#include <signal.h>
+#endif
+
+// ====================================================================
+// signal handler for soft-abort
+// ====================================================================
+
+static G4VUIshell* theshell= 0;
+
+#ifndef WIN32
+
+extern "C" {
+
+////////////////////////////////
+static void SignalHandler(G4int)
+////////////////////////////////
+{
+  G4StateManager* stateManager= G4StateManager::GetStateManager();
+  G4ApplicationState state= stateManager-> GetCurrentState();
+
+  if(state==G4State_GeomClosed || state==G4State_EventProc) {
+    G4cout << "aborting Run ...";
+    G4UImanager::GetUIpointer()->ApplyCommand("/run/abort");
+    G4cout << G4endl;
+  } else {
+    G4cout << G4endl
+           << "Session terminated." << G4endl;
+    theshell-> ResetTerminal();
+    exit(0);
+  }
+
+  // for original Unix / System V
+  signal(SIGINT, SignalHandler);
+}
+
+}
+#endif
+
+// ====================================================================
+//
+// class description
+//
+// ====================================================================
+
+///////////////////////////////////////////////////////////
+G4UIterminal::G4UIterminal(G4VUIshell* aShell, G4bool qsig)
+///////////////////////////////////////////////////////////
 {
   UI= G4UImanager::GetUIpointer();
@@ -52,4 +99,12 @@
   if(aShell) shell= aShell;
   else shell= new G4UIcsh;
+  theshell= shell; // locally stored for the signal handler
+
+  // add signal handler
+  if(qsig) {
+#ifndef WIN32
+  signal(SIGINT, SignalHandler);
+#endif
+  }
 }
 
Index: trunk/geant4/interfaces/basic/src/G4VUIshell.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4VUIshell.cc	(revision 592)
+++ trunk/geant4/interfaces/basic/src/G4VUIshell.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VUIshell.cc,v 1.9 2006/06/29 19:09:59 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4VUIshell.cc,v 1.10 2007/06/14 05:44:58 kmura Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
@@ -59,7 +59,7 @@
 }
 
-/////////////////////////////
+////////////////////////////////////////////
 void G4VUIshell::MakePrompt(const char* msg) 
-/////////////////////////////
+////////////////////////////////////////////
 {
   if(promptSetting.length()<=1) {
@@ -106,4 +106,11 @@
 
 
+////////////////////////////////
+void G4VUIshell::ResetTerminal()
+////////////////////////////////
+{
+
+}
+
 // --------------------------------------------------------------------
 //      G4command operations
@@ -308,2 +315,3 @@
   arrayString.Show(nColumn);
 }
+
Index: trunk/geant4/interfaces/common/include/G4Qt.hh
===================================================================
--- trunk/geant4/interfaces/common/include/G4Qt.hh	(revision 592)
+++ trunk/geant4/interfaces/common/include/G4Qt.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4Qt.hh,v 1.6 2007/05/29 11:10:14 $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4Qt.hh,v 1.2 2007/11/08 17:00:09 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 //  To unify Qt event treatment between 
@@ -38,8 +38,4 @@
 
 #include "G4VInteractorManager.hh"
-
-#include <QtGui/qapplication.h>
-#include <QtGui/qwidget.h>
-#include <QtGui/qmainwindow.h>
 
 // Class description :
Index: trunk/geant4/interfaces/common/include/G4VBasicShell.hh
===================================================================
--- trunk/geant4/interfaces/common/include/G4VBasicShell.hh	(revision 592)
+++ trunk/geant4/interfaces/common/include/G4VBasicShell.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VBasicShell.hh,v 1.7 2006/06/29 19:10:03 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
Index: trunk/geant4/interfaces/common/include/G4VInteractorManager.hh
===================================================================
--- trunk/geant4/interfaces/common/include/G4VInteractorManager.hh	(revision 592)
+++ trunk/geant4/interfaces/common/include/G4VInteractorManager.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VInteractorManager.hh,v 1.9 2006/06/29 19:10:08 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G.Barrand
Index: trunk/geant4/interfaces/common/include/G4Win32.hh
===================================================================
--- trunk/geant4/interfaces/common/include/G4Win32.hh	(revision 592)
+++ trunk/geant4/interfaces/common/include/G4Win32.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4Win32.hh,v 1.8 2006/06/29 19:10:11 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //  To unify Windows message treatment between 
Index: trunk/geant4/interfaces/common/include/G4Xt.hh
===================================================================
--- trunk/geant4/interfaces/common/include/G4Xt.hh	(revision 592)
+++ trunk/geant4/interfaces/common/include/G4Xt.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4Xt.hh,v 1.6 2006/06/29 19:10:14 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //  To unify X11 event treatment between 
Index: trunk/geant4/interfaces/common/src/G4Qt.cc
===================================================================
--- trunk/geant4/interfaces/common/src/G4Qt.cc	(revision 592)
+++ trunk/geant4/interfaces/common/src/G4Qt.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4Qt.cc,v 1.11 2007/05/29 11:10:28 $
-// GEANT4 tag $Name: geant4-08-01 $
+// $Id: G4Qt.cc,v 1.3 2007/11/08 17:00:09 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // L. Garnier
@@ -38,4 +38,7 @@
 
 #include "G4Qt.hh"
+
+#include <QtGui/QApplication.h>
+
 
 #define NewString(str)  \
@@ -135,4 +138,5 @@
 //  return         &event;
   printf("*");
+  return 0;
 }
 /***************************************************************************/
Index: trunk/geant4/interfaces/common/src/G4VBasicShell.cc
===================================================================
--- trunk/geant4/interfaces/common/src/G4VBasicShell.cc	(revision 592)
+++ trunk/geant4/interfaces/common/src/G4VBasicShell.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VBasicShell.cc,v 1.12 2006/06/29 19:10:20 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
@@ -197,5 +197,5 @@
     std::vector<G4UIcommand*> commands;
     G4int n_commandEntry = aTree->GetCommandEntry();
-    for( int i_thCommand = 1; i_thCommand <= n_commandEntry; i_thCommand++ ) {
+    for( G4int i_thCommand = 1; i_thCommand <= n_commandEntry; i_thCommand++ ) {
       G4UIcommand* cmd = aTree->GetCommand(i_thCommand);
       G4String ss = cmd->GetCommandName();
Index: trunk/geant4/interfaces/common/src/G4VInteractorManager.cc
===================================================================
--- trunk/geant4/interfaces/common/src/G4VInteractorManager.cc	(revision 592)
+++ trunk/geant4/interfaces/common/src/G4VInteractorManager.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VInteractorManager.cc,v 1.13 2006/06/29 19:10:24 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G.Barrand
Index: trunk/geant4/interfaces/common/src/G4Win32.cc
===================================================================
--- trunk/geant4/interfaces/common/src/G4Win32.cc	(revision 592)
+++ trunk/geant4/interfaces/common/src/G4Win32.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4Win32.cc,v 1.9 2006/06/29 19:10:26 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G.Barrand
Index: trunk/geant4/interfaces/common/src/G4Xt.cc
===================================================================
--- trunk/geant4/interfaces/common/src/G4Xt.cc	(revision 592)
+++ trunk/geant4/interfaces/common/src/G4Xt.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4Xt.cc,v 1.11 2006/06/29 19:10:28 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G.Barrand
Index: trunk/geant4/visualization/G4History.macro
===================================================================
--- trunk/geant4/visualization/G4History.macro	(revision 592)
+++ trunk/geant4/visualization/G4History.macro	(revision 593)
@@ -6,20 +6,4 @@
 /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
@@ -31,12 +15,12 @@
 /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 "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/addButton gun "proton" "/gun/particle proton"
 /gui/addMenu vis Vis
 /gui/addButton vis Vis0(OGLIX) "/control/execute visTutor/exN03Vis0.mac"
@@ -45,7 +29,5 @@
 /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 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"
@@ -59,3 +41,2 @@
 /gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
 /N03/event/printModulo 100
-/run/beamOn 1
Index: trunk/geant4/visualization/History
===================================================================
--- trunk/geant4/visualization/History	(revision 592)
+++ trunk/geant4/visualization/History	(revision 593)
@@ -1,3 +1,3 @@
-$Id: History,v 1.398 2006/11/26 22:07:44 allison Exp $
+$Id: History,v 1.414 2007/07/10 17:54:09 allison Exp $
 -------------------------------------------------------------------
 
@@ -24,4 +24,99 @@
 History file for visualization category
 ---------------------------------------
+
+10th July 2007  John Allison  (vis-V09-00-00)
+- visman-V09-00-00: Remove redundant method declarations and minor tidies.
+
+14th June 2007  John Allison  (vis-V08-03-07)
+- raytracer-V08-03-01: Fixed memory leak in G4RayTracer.
+
+30th May 2007  John Allison  (vis-V08-03-06)
+- modeling-V08-03-02: Fixed gcc-4.2.0 warning.
+
+30th May 2007  John Allison  (vis-V08-03-05)
+- modeling-V08-03-01: Fix for SUN.
+
+25th May 2007  John Allison  (vis-V08-03-04)
+- opengl-V08-03-03: Fixed gcc-4.1.2 compiler warnings.
+
+25th May 2007  John Allison  (vis-V08-03-03)
+- visman-V08-03-01: Improved error trapping and big fix.
+- opengl-V08-03-02: Improved error trapping.
+
+24th May 2007  John Allison  (vis-V08-03-02)
+- opengl-V08-03-01: Fixes for SUN.
+
+22nd May 2007  John Allison  (vis-V08-03-01)
+- modeling-V08-03-00: Simplified G4Atts for Physical Volume Path.
+- vis-HepRep-V08-03-00: Fixed memory leak in G4HepRepFile.
+- raytracer-V08-03-00: Fixed for dubious ValGrind diagnostic.
+
+16th May 2007  John Allison  (vis-V08-03-00)
+- visman-V08-03-00: Fix for Windows compiler.
+- opengl-V08-03-00: Fix compiler warnings and bug fixes in opengl-V08-02-06.
+
+8th May 2007  John Allison
+- opengl-V08-02-06: /vis/ogl/printEPS should work for all viewers.
+
+4th April 2007  John Allison  (vis-V08-02-04)
+- visman-V08-02-04: Bug fix for zero pointer in G4VscenHamdler::LoadAtts.
+- opengl-V08-02-05: Implemented picking for OGLSX (as well as OGLIX).
+
+3rd April 2007  John Allison  (vis-V08-02-03)
+- modeling-V08-02-02: Added further information on volume G4Atts.
+- visman-V08-02-03: Added /vis/viewer/set/picking.  Picking is "false"
+  by default, except for Open Inventor.
+- opengl-V08-02-04:
+  o Implemented picking for OGLIX.
+  o Some reorganisation of display list construction to fix rare bug\
+    in Display-by-Time feature
+- openinventor-V08-02-02: Picking is "true" by default for OI.
+
+25th March 2007  John Allison  (vis-V08-02-02)
+-  modeling-V08-02-01: Added solid dump and volume transformation to G4Atts.
+- visman-V08-02-02:
+  o Removed G4GAGTree.
+  o Removed /vis/scene/add/eventID (once again) from /vis/drawVolume.
+- opengl-V08-02-03: Fix compiler warnings.
+- vistree-V08-02-01: Removed GAGTree.
+- openinventor-V08-02-01): Added scale factor to list of changes
+  requiring kernel visit, and some rationalisation.
+
+11th January 2007  John Allison  (vis-V08-02-01)
+- visman-V08-02-01:
+  o Added /vis/abortReviewKeptEvents.
+  o /vis/reviewKeptEvents: Improved guidance.
+  o Bug fix: /vis/open in /vis/reviewKeptEvents loop.
+  o Reduced WARNING noise.
+
+9th January 2007  John Allison
+- opengl-V08-02-01:
+  o Implemented bitmap markers (for MarkerSizeType == screen).
+  o Bug fix: Added missing break in X colormap lookup routine.
+
+5th January 2007  John Allison  (vis-V08-02-00 - needs greps-V08-02-00)
+- modeling-V08-02-00 (needs greps-V08-02-00):
+  o Bug fix: Correct treatment of ForcedLineSegmentsPerCircle when clipping.
+- visman-V08-02-00:
+  o G4VSceneHandler:
+    ~ Introduced utility LoadAtts for G4AttValues and G4AttDefs.
+    ~ Improved other utilities (changed signature of GetLineWidth).
+  o Introduced /vis/geometry/set/forceLineSegmentsPerCircle.
+  o Re-introduced /vis/scene/add/eventID into /vis/drawVolume (removed
+    in visman-V08-01-16 for release 8.2).
+  o Other minor improvements.
+- opengl-V08-02-00:
+  o Followed change of signature of GetLineWidth in visman-V08-02-00.
+- openinventor-V08-02-00: Moved LoadAtts to vis management.
+- raytracer-V08-02-00: Bug fix: use of window size hints.
+- vistree-V08-02-00: Bug fix: Format of total mass.
+- vistest-V08-02-00: test19.cc: Refined usage.
+
+12th December 2006  Gabriele Cosmo
+- visman-V08-01-16: Commented command "vis/scene/add/eventID" forcing
+  event ID to scene in G4VisCommandsCompound.cc.
+
+11th December 2006  John Allison
+- Tree: Trapped sequential G4PVPlacements.
 
 25th November 2006  John Allison  (vis-V08-01-17)
Index: trunk/geant4/visualization/OpenGL/GNUmakefile
===================================================================
--- trunk/geant4/visualization/OpenGL/GNUmakefile	(revision 592)
+++ trunk/geant4/visualization/OpenGL/GNUmakefile	(revision 593)
@@ -28,5 +28,4 @@
 CPPFLAGS += -I$(G4BASE)/intercoms/include
 CPPFLAGS += -I$(G4BASE)/interfaces/common/include
-CPPFLAGS += -I$(G4BASE)/interfaces/basic/include
 CPPFLAGS += -I$(G4BASE)/tracking/include
 CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
Index: trunk/geant4/visualization/OpenGL/History
===================================================================
--- trunk/geant4/visualization/OpenGL/History	(revision 592)
+++ trunk/geant4/visualization/OpenGL/History	(revision 593)
@@ -1,3 +1,3 @@
-$Id: History,v 1.82 2006/11/21 16:24:58 allison Exp $
+$Id: History,v 1.94 2007/08/21 14:05:50 allison Exp $
 -------------------------------------------------------------------
 
@@ -20,4 +20,72 @@
 History file for visualization/OpenGL
 -------------------------------------
+
+21st August 2007  John Allison  (opengl-V09-00-00)
+- Removed redundant G4OpenGLXViewerMessenger.
+
+25th May 2007  John Allison  (opengl-V08-03-03)
+- G4OpenGLSceneHandler and G4OpenGLXViewerMessenger:
+  Fixed gcc-4.1.2 compiler warnings.
+
+G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function.
+
+25th May 2007  John Allison  (opengl-V08-03-02)
+- G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function.
+
+24th May 2007  John Allison  (opengl-V08-03-01)
+- Fixes for SUN.
+
+16th May 2007  John Allison  (opengl-V08-03-00)
+- Fix compiler warnings on SLC4.
+- Bug fixes:
+  o Correct path /vis/ogl/set/printMode.
+  o Add SetView to pixmap screen dump ("/vis/ogl/set/printMode pixmap"
+    and "/vis/ogl/printEPS").
+
+8th May 2007  John Allison  (opengl-V08-02-06)
+- Moved vectored PostScript printing to G4OpenGLViewer.
+- /vis/ogl/printEPS should work for all viewers, including Win32.
+- Introduced /vis/ogl/set/printMode vectored|pixmap, currently only
+  effective on X windows (and still somewhat buggy).
+
+4th April 2007  John Allison  (opengl-V08-02-05 - needs visman-V08-02-04)
+- Implemented picking for OGLSX ( as well as OGLIX).  Hopefully works
+  for OGL*Win32.  Still doesn't work for OGL*Xm.
+
+3rd April 2007  John Allison  (opengl-V08-02-04 - needs visman-V08-02-03)
+- G4OpenGLStoredSceneHandler:
+  o Re-organised display lists on a per-primitive basis, i.e., one
+    display list per primitive.  (This is so that, except for text,
+    the colour - or, rather, intensity - can be brought out of the
+    display list into the TOList (Transient Object List) and
+    controlled for the Display-by-Time feature.  Previously, if more
+    than one primitive were drawn between BeginPrimitives and
+    EndPrimitives, it would finish up all in one display list, colour
+    commands included. Rationalises and fixes a rare bug in the
+    Display-by-Time feature - see August 2006.)
+  o Added AddPrimitive(const G4Polymarker&) so that it is treated as
+    one primoitive to fit with the above re-organisation.
+- Implemented picking for OGLIX.
+
+25th March 2007  John Allison  (opengl-V08-02-03)
+- Fix compiler warnings.
+
+8th February 2007  John Allison  (opengl-V08-02-02)
+- Fixed Windows problem with DBL_MAX.  (Introduced G4OPENGL_DBL_MAX.)
+- G4OpenGLXViewer.cc: Small bug fix in print().  (Context was switched
+  .but not switched back.  Not serious, because context was always set
+  before normal drawing.)
+
+9th January 2007  John Allison  (opengl-V08-02-01)
+- Implemented bitmap markers for MarkerSizeType == screen.  (The old
+  polygon implementation remains for MarkerSizeType == world.)
+- Added G4OpenGLBitMapStore to assist the above.
+- G4OpenGLXViewer::CreateGLXContext:
+  o Bug fix: Added missing break in colormap lookup routine.
+
+5th January 2007  John Allison  (opengl-V08-02-00)
+- G4OpenGLSceneHandler.cc:
+  o Followed change of signature of GetLineWidth in visman-V08-02-00.
+  o Minor efficiency improvements.
 
 21st November 2006  John Allison  (opengl-V08-01-09)
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGL.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGL.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGL.hh	(revision 593)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4OpenGL.hh,v 1.4 2006/06/29 21:17:36 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4OpenGL.hh,v 1.5 2007/02/08 14:01:55 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // G.Barrand.
@@ -39,3 +39,5 @@
 #include <GL/glu.h>
 
+#define G4OPENGL_DBL_MAX 1.e308
+
 #endif
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLFontBaseStore.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLFontBaseStore.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLFontBaseStore.hh	(revision 593)
@@ -25,5 +25,5 @@
 //
 // $Id: G4OpenGLFontBaseStore.hh,v 1.3 2006/06/29 21:17:38 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // J.Allison  Apr 2005.
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQt.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQt.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQt.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLImmediateQt.hh,v 1.7 2007/06/25 21:17:44 $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4OpenGLImmediateQt.hh,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLImmediateQtViewer.hh,v 1.9 2007/06/25 21:17:46 $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4OpenGLImmediateQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
@@ -40,5 +40,6 @@
 #include "G4OpenGLImmediateViewer.hh"
 #include "G4OpenGLQtViewer.hh"
-#include <QGLWidget>
+
+#include <QtOpenGL/QGLWidget>
 
 #include "globals.hh"
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateSceneHandler.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateSceneHandler.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateSceneHandler.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLImmediateSceneHandler.hh,v 1.11 2006/08/16 10:34:36 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLImmediateSceneHandler.hh,v 1.13 2007/04/04 16:50:26 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -59,23 +59,11 @@
   void EndModeling ();
   void AddPrimitive (const G4Polyline&);
+  void AddPrimitive (const G4Polymarker&);
+  void AddPrimitive (const G4Text& text);
   void AddPrimitive (const G4Circle&);
   void AddPrimitive (const G4Square&);
-  // Explicitly invoke base class methods to avoid warnings about
-  // hiding of base class methods...
-  void AddPrimitive (const G4Text& text) {
-    G4OpenGLSceneHandler::AddPrimitive (text);
-  }
-  void AddPrimitive (const G4Polyhedron& polyhedron) {
-    G4OpenGLSceneHandler::AddPrimitive (polyhedron);
-  }
-  void AddPrimitive (const G4NURBS& nurbs) {
-    G4OpenGLSceneHandler::AddPrimitive (nurbs);
-  }
-  void AddPrimitive(const G4Polymarker& polymarker) {
-    G4OpenGLSceneHandler::AddPrimitive (polymarker);
-  }
-  void AddPrimitive (const G4Scale& scale) {
-    G4OpenGLSceneHandler::AddPrimitive (scale);
-  }
+  void AddPrimitive (const G4Scale& scale);
+  void AddPrimitive (const G4Polyhedron&);
+  void AddPrimitive (const G4NURBS&);
   void ClearTransientStore ();
 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateViewer.hh,v 1.9 2006/09/04 12:07:59 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateWin32.hh,v 1.7 2006/06/29 21:17:44 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateWin32Viewer.hh,v 1.9 2006/06/29 21:17:46 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateX.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateX.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateX.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateX.hh,v 1.7 2006/06/29 21:17:48 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateXViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXm.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXm.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXm.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateXm.hh,v 1.7 2006/06/29 21:17:52 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXmViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXmViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXmViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateXmViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLQtExportDialog.hh,v 0.1 2007/09/20 15:18:20 garnier $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLQtExportDialog.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
+// GEANT4 tag $Name: 
 //
 // 
@@ -35,6 +35,5 @@
 #define G4OPENGLQTEXPORTDIALOG_HH
 
-#include <qvariant.h>
-#include <qdialog.h>
+#include <QtGui/QDialog.h>
 
 class QButtonGroup;
@@ -47,4 +46,7 @@
 class QLineEdit;
 
+/** The G4OpenGLQtExportDialog class provide a Dialog displaying differents options
+  for each file format
+ */
 class G4OpenGLQtExportDialog : public QDialog
 {
@@ -52,21 +54,44 @@
 
 public:
-  G4OpenGLQtExportDialog(QWidget* parent, QString name, int, int);
+  /** Construct a G4OpenGLQtExportDialog
+      @param parent : parent widget
+      @param name : name of the saved file with extention
+      @param height : height of the original file
+      @param width : width of the original file
+  */
+  G4OpenGLQtExportDialog(QWidget* parent, QString name, int height =0, int width=0);
+
+  /** Destroys G4OpenGLQtExportDialog */
   ~G4OpenGLQtExportDialog();
 
+  /** @return the value of the slider if format has a slider widget, instead return -1 */
   int getSliderValue();
+
+  /** return the new width for file if format has a width widget, instead return -1 */
   int getWidth();
+
+  /** return the new height for file if format has a height widget, instead return -1 */
   int getHeight();
-  int getTransparency();
+
+  /** return the value of the transparency if format has a transparency, instead return -1 */
+  bool getTransparency();
+
+  /** return the numbers of colors in the picture if format has a BW/Color widget, instead return -1 */
   int getNbColor();
 
 public slots:
+
+/** Called by a clic on modify/original size button.This will 
+    invert buttons and hide/unhide size
+*/
   void changeSizeBox(bool);  
+
+  /** Called by changing value in height lineEdit. If ratio is keep, will also change the width
+   */
   void textWidthChanged(const QString &); 
+
+  /** Called by changing value in width lineEdit. If ratio is keep, will also change the height
+   */
   void textHeightChanged(const QString &); 
-
-signals:
-  void options(const QString&, const QString&, int, bool);
-  void exportAll(const QString&, const QString&, int, bool);
 
 private:
@@ -80,5 +105,5 @@
   QSlider * qualitySlider;
   QLabel *formatLabel;
-  QRadioButton* color,*BW;
+  QRadioButton* colorButton,*BWButton;
   QRadioButton* original,* modify;
   QLineEdit* height,*width;
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLQtViewer.hh,v 1.13 2006/06/29 21:18:20 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4OpenGLQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
@@ -42,11 +42,13 @@
 #include "G4OpenGLSceneHandler.hh"
 
-#include <QObject>
-#include <QGLWidget>
-#include <QDialog>
-#include <QContextMenuEvent>
-#include <QMenu>
-#include <QPoint>
-#include <QImage>
+#include <QtCore/QObject>
+#include <QtCore/QPoint>
+
+class QGLWidget;
+class QDialog;
+class QContextMenuEvent;
+class QMenu;
+class QImage;
+class QAction;
 
 class G4OpenGLSceneHandler;
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLSceneHandler.hh,v 1.20 2006/08/30 11:37:34 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLSceneHandler.hh,v 1.23 2007/04/04 16:50:26 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -45,24 +45,30 @@
 #include "G4VSceneHandler.hh"
 #include "G4OpenGLViewer.hh"
+#include "G4OpenGLBitMapStore.hh"
+#include <map>
 
-// Base class for various OpenGLScene classes.
+class G4AttHolder;
+
+// Base class for various OpenGLSceneHandler classes.
 class G4OpenGLSceneHandler: public G4VSceneHandler {
 
+  friend class G4OpenGLViewer;
+
 public:
+  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
+  virtual void EndPrimitives ();
+  virtual void BeginPrimitives2D ();
+  virtual void EndPrimitives2D ();
   void AddPrimitive (const G4Polyline&);
+  void AddPrimitive (const G4Polymarker&);
   void AddPrimitive (const G4Text&);
   void AddPrimitive (const G4Circle&);
   void AddPrimitive (const G4Square&);
+  void AddPrimitive (const G4Scale&);
   void AddPrimitive (const G4Polyhedron&);
   void AddPrimitive (const G4NURBS&);
-  // Explicitly invoke base class methods to avoid warnings about
-  // hiding of base class methods...
-  void AddPrimitive(const G4Polymarker& polymarker) {
-    G4VSceneHandler::AddPrimitive (polymarker);
-  }
-  void AddPrimitive (const G4Scale& scale) {
-    G4VSceneHandler::AddPrimitive (scale);
-  }
 
+  void PreAddSolid (const G4Transform3D& objectTransformation,
+		    const G4VisAttributes&);
   void AddSolid (const G4Box&);
   void AddSolid (const G4Cons&);
@@ -89,22 +95,23 @@
   const G4Polyhedron* CreateCutawayPolyhedron ();
 
+  GLuint fPickName;
+  std::map<GLuint, G4AttHolder*> fPickMap;  // For picking.
+  void ClearAndDestroyAtts();  // Destroys att holders and clears pick map.
+
 private:
 
-  void AddCircleSquare (const G4VMarker&, G4int nSides);
-  /**************************************************
-  Not needed - but see note on future development in .cc.
-  void DrawScreenPolygon (G4double size,
-		          const G4Point3D& centre,
-		          G4int nSides);
-  // Draws in screen coordinates.
-  *********************************/
+  void AddCircleSquare (const G4VMarker&, G4OpenGLBitMapStore::Shape);
 
-  void DrawXYPolygon (G4double size,
-		      const G4Point3D& centre,
-		      G4int nSides);
+  void DrawXYPolygon
+  (G4OpenGLBitMapStore::Shape,
+   G4double size,
+   const G4Point3D& centre,
+   const G4VisAttributes* pApplicableVisAtts);
   // Draws in world coordinates a polygon in the screen plane knowing
   // viewpoint direction and up vector.
 
   static const GLubyte fStippleMaskHashed [128];
+
+  G4bool fProcessingPolymarker;
 };
 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.icc
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.icc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.icc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLSceneHandler.icc,v 1.7 2006/06/29 21:17:58 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQt.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQt.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQt.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredQt.hh,v 1.7 2007/06/25 21:17:44 $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4OpenGLStoredQt.hh,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredQtViewer.hh,v 1.9 2007/06/25 21:17:46 $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4OpenGLStoredQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
@@ -40,8 +40,9 @@
 #include "G4OpenGLStoredViewer.hh"
 #include "G4OpenGLQtViewer.hh"
-#include <QGLWidget>
-#include <QApplication>
-#include <QMouseEvent>
-#include <QContextMenuEvent>
+
+#include <QtOpenGL/QGLWidget>
+
+class QMouseEvent;
+class QContextMenuEvent;
 
 class G4OpenGLStoredSceneHandler;
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredSceneHandler.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredSceneHandler.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredSceneHandler.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredSceneHandler.hh,v 1.21 2006/08/30 11:43:57 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLStoredSceneHandler.hh,v 1.24 2007/04/04 16:50:26 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -63,21 +63,11 @@
   void EndModeling ();
   void AddPrimitive (const G4Polyline&);
+  void AddPrimitive (const G4Polymarker&);
   void AddPrimitive (const G4Circle&);
   void AddPrimitive (const G4Square&);
-  void AddPrimitive (const G4Polymarker& polymarker);
-  // Explicitly invoke base class methods to avoid warnings about
-  // hiding of base class methods...
-  void AddPrimitive (const G4Text& text) {
-    G4OpenGLSceneHandler::AddPrimitive (text);
-  }
-  void AddPrimitive (const G4Polyhedron& polyhedron) {
-    G4OpenGLSceneHandler::AddPrimitive (polyhedron);
-  }
-  void AddPrimitive (const G4NURBS& nurbs) {
-    G4OpenGLSceneHandler::AddPrimitive (nurbs);
-  }
-  void AddPrimitive (const G4Scale& scale) {
-    G4OpenGLSceneHandler::AddPrimitive (scale);
-  }
+  void AddPrimitive (const G4Text&);
+  void AddPrimitive (const G4Scale&);
+  void AddPrimitive (const G4Polyhedron&);
+  void AddPrimitive (const G4NURBS&);
   void ClearStore ();
   void ClearTransientStore ();
@@ -98,7 +88,8 @@
   struct PO {
     PO(G4int id, const G4Transform3D& tr = G4Transform3D()):
-      fDisplayListId(id), fTransform(tr) {}
+      fDisplayListId(id), fTransform(tr), fPickName(0) {}
     G4int fDisplayListId;
     G4Transform3D fTransform;
+    GLuint fPickName;
   };
   std::vector<PO> fPOList; 
@@ -107,8 +98,9 @@
   struct TO {
     TO(G4int id, const G4Transform3D& tr = G4Transform3D()):
-      fDisplayListId(id), fTransform(tr),
-      fStartTime(-DBL_MAX), fEndTime(DBL_MAX) {}
+      fDisplayListId(id), fTransform(tr), fPickName(0),
+      fStartTime(-G4OPENGL_DBL_MAX), fEndTime(G4OPENGL_DBL_MAX) {}
     G4int fDisplayListId;
     G4Transform3D fTransform;
+    GLuint fPickName;
     G4double fStartTime, fEndTime;  // Time range (e.g., for trajectory steps).
     G4Colour fColour;
@@ -119,4 +111,7 @@
   // A proper implementation would use geometry hierarchy.
   std::map <const G4VSolid*, G4int, std::less <const G4VSolid*> > fSolidMap;
+
+private:
+  G4bool fProcessing2D;
 };
 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLStoredViewer.hh,v 1.9 2006/06/29 21:18:02 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLStoredWin32.hh,v 1.7 2006/06/29 21:18:04 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32Viewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32Viewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32Viewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLStoredWin32Viewer.hh,v 1.7 2006/06/29 21:18:06 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredX.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredX.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredX.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLStoredX.hh,v 1.7 2006/06/29 21:18:08 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLStoredXViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXm.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXm.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXm.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLStoredXm.hh,v 1.6 2006/06/29 21:18:12 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXmViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXmViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXmViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLStoredXmViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLTransform3D.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLTransform3D.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLTransform3D.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLTransform3D.hh,v 1.7 2006/06/29 21:18:16 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLViewer.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLViewer.hh,v 1.18 2006/09/19 16:13:15 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLViewer.hh,v 1.20 2007/05/08 11:04:11 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -38,4 +38,5 @@
 
 #include "G4VViewer.hh"
+#include "G4OpenGL.hh"
 
 class G4OpenGLSceneHandler;
@@ -62,5 +63,19 @@
   void HLRThirdPass ();
   void InitializeGLView ();
+  void Pick(GLdouble x, GLdouble y);
   virtual void CreateFontLists () {}
+  virtual void print();
+//////////////////////////////Vectored PostScript production functions///
+  void printBuffer(GLint, GLfloat*);
+  GLfloat* spewPrimitiveEPS (FILE*, GLfloat*);
+  void spewSortedFeedback (FILE*, GLint, GLfloat*);
+  void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*);
+  void print3DcolorVertex(GLint, GLint*, GLfloat*);
+  G4float                           pointSize;
+  char                              print_string[50];
+  G4bool                            print_colour;
+  G4bool                            vectored_ps;
+
+  G4OpenGLSceneHandler& fOpenGLSceneHandler;
   G4Colour background;      //the OpenGL clear colour
   G4bool
@@ -80,4 +95,14 @@
 };
 
+typedef struct G4OpenGLViewerFeedback3Dcolor {
+  GLfloat x;
+  GLfloat y;
+  GLfloat z;
+  GLfloat red;
+  GLfloat green;
+  GLfloat blue;
+  GLfloat alpha;
+} Feedback3Dcolor;
+
 #endif
 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLViewerMessenger.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLViewerMessenger.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLViewerMessenger.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLViewerMessenger.hh,v 1.4 2006/09/19 16:14:21 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLViewerMessenger.hh,v 1.5 2007/05/08 11:04:11 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #ifndef G4OPENGLVIEWERMESSENGER_HH
@@ -37,6 +37,8 @@
 class G4UIdirectory;
 class G4UIcommand;
+class G4UIcmdWithoutParameter;
 class G4UIcmdWithADouble;
 class G4UIcmdWithABool;
+class G4UIcmdWithAString;
 
 class G4OpenGLViewerMessenger: public G4UImessenger {
@@ -50,4 +52,5 @@
   static G4OpenGLViewerMessenger* fpInstance;
   G4UIdirectory* fpDirectory;
+  G4UIcmdWithoutParameter* fpCommandPrintEPS;
   G4UIdirectory* fpDirectorySet;
   G4UIcommand* fpCommandDisplayHeadTime;
@@ -55,4 +58,5 @@
   G4UIcommand* fpCommandEndTime;
   G4UIcmdWithADouble* fpCommandFade;
+  G4UIcmdWithAString* fpCommandPrintMode;
   G4UIcommand* fpCommandStartTime;
   G4UIcmdWithABool* fpCommandTransparency;
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLWin32Viewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLWin32Viewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLWin32Viewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLWin32Viewer.hh,v 1.13 2006/06/29 21:18:20 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXViewer.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLXViewer.hh,v 1.26 2006/11/01 11:22:27 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLXViewer.hh,v 1.27 2007/05/08 11:04:11 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -53,4 +53,5 @@
 
   friend class G4OpenGLXViewerMessenger;
+  friend class G4OpenGLXmViewer;
 
 public:
@@ -59,5 +60,4 @@
   void SetView ();
   void ShowView ();
-  void print();
 
 protected:
@@ -66,22 +66,10 @@
   virtual void CreateMainWindow ();
   virtual void CreateFontLists ();
+  void print();
 
   static int snglBuf_RGBA[12];
   static int dblBuf_RGBA[13];
 
-  char                              print_string[50];
-  G4bool                            print_colour,
-                                    vectored_ps;
-
-//////////////////////////////Vectored PostScript production functions//////////////////////////////
-  void printBuffer(GLint, GLfloat*);
-  GLfloat* spewPrimitiveEPS (FILE*, GLfloat*);
-  void spewSortedFeedback (FILE*, GLint, GLfloat*);
-  void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*);
-  void print3DcolorVertex(GLint, GLint*, GLfloat*);
-  G4float                           pointSize;
-
-
-//////////////////////////////Pixmap (screen dump) production functions//////////////////////////////
+//////////////////////////////Pixmap (screen dump) production functions/////
   GLubyte* grabPixels (int inColor,
 		       unsigned int width,
@@ -129,14 +117,4 @@
 };
 
-typedef struct G4OpenGLXViewerFeedback3Dcolor {
-  GLfloat x;
-  GLfloat y;
-  GLfloat z;
-  GLfloat red;
-  GLfloat green;
-  GLfloat blue;
-  GLfloat alpha;
-} Feedback3Dcolor;
-
 #endif
 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmBox.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmBox.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmBox.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmBox.hh,v 1.7 2006/06/29 21:18:24 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFourArrowButtons.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFourArrowButtons.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFourArrowButtons.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmFourArrowButtons.hh,v 1.6 2006/06/29 21:18:26 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFramedBox.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFramedBox.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFramedBox.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmFramedBox.hh,v 1.7 2006/06/29 21:18:28 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmPushButton.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmPushButton.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmPushButton.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmPushButton.hh,v 1.7 2006/06/29 21:18:30 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmRadioButton.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmRadioButton.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmRadioButton.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmRadioButton.hh,v 1.7 2006/06/29 21:18:32 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmResources.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmResources.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmResources.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmResources.hh,v 1.5 2006/06/29 21:18:34 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSeparator.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSeparator.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSeparator.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmSeparator.hh,v 1.6 2006/06/29 21:18:36 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSliderBar.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSliderBar.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSliderBar.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmSliderBar.hh,v 1.7 2006/06/29 21:18:38 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTextField.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTextField.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTextField.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmTextField.hh,v 1.7 2006/06/29 21:18:40 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTopLevelShell.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTopLevelShell.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTopLevelShell.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmTopLevelShell.hh,v 1.6 2006/06/29 21:18:42 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetComponent.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetComponent.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetComponent.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmVWidgetComponent.hh,v 1.6 2006/06/29 21:18:44 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetContainer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetContainer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetContainer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmVWidgetContainer.hh,v 1.6 2006/06/29 21:18:46 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetObject.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetObject.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetObject.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmVWidgetObject.hh,v 1.6 2006/06/29 21:18:48 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetShell.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetShell.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetShell.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmVWidgetShell.hh,v 1.6 2006/06/29 21:18:50 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmViewer.hh,v 1.10 2006/06/29 21:18:52 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewerMessenger.hh
===================================================================
--- trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewerMessenger.hh	(revision 592)
+++ trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewerMessenger.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmViewerMessenger.hh,v 1.4 2006/06/29 21:18:54 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLFontBaseStore.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLFontBaseStore.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLFontBaseStore.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQt.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQt.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQt.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLImmediateQt.cc,v 1.11 2007/06/24 12:07:19 $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLImmediateQt.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLImmediateQtViewer.cc,v 1.16 2007/06/25 16:38:13 $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLImmediateQtViewer.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 //
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.24 2006/09/04 12:03:25 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.27 2007/04/04 16:50:26 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -47,10 +47,14 @@
 #include "G4OpenGLTransform3D.hh"
 #include "G4Polyline.hh"
+#include "G4Polymarker.hh"
+#include "G4Text.hh"
 #include "G4Circle.hh"
 #include "G4Square.hh"
-
-G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler (G4VGraphicsSystem& system,
-						const G4String& name):
-G4OpenGLSceneHandler (system, fSceneIdCount++, name)
+#include "G4Scale.hh"
+#include "G4Polyhedron.hh"
+
+G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler
+(G4VGraphicsSystem& system,const G4String& name):
+  G4OpenGLSceneHandler (system, fSceneIdCount++, name)
 {}
 
@@ -62,4 +66,9 @@
 void G4OpenGLImmediateSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
 {
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    glLoadName(++fPickName);
+    fPickMap[fPickName] = 0;
+  }
+
   const G4Colour& c = GetColour (visible);
   glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
@@ -72,4 +81,18 @@
 }
 
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
+{
+  AddPrimitivePreamble(polymarker);
+  G4OpenGLSceneHandler::AddPrimitive(polymarker);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Text& text)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4Text&).
+  AddPrimitivePreamble(text);
+  G4OpenGLSceneHandler::AddPrimitive(text);
+}
+
 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Circle& circle)
 {
@@ -84,7 +107,29 @@
 }
 
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Scale& scale)
+{
+  AddPrimitivePreamble(scale);
+  G4OpenGLSceneHandler::AddPrimitive(scale);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&).
+  AddPrimitivePreamble(polyhedron);
+  G4OpenGLSceneHandler::AddPrimitive(polyhedron);
+}
+
+void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4NURBS& nurbs)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&).
+  AddPrimitivePreamble(nurbs);
+  G4OpenGLSceneHandler::AddPrimitive(nurbs);
+}
+
 void G4OpenGLImmediateSceneHandler::BeginPrimitives
 (const G4Transform3D& objectTransformation) {
-  G4VSceneHandler::BeginPrimitives (objectTransformation);
+  G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
   glPushMatrix();
   G4OpenGLTransform3D oglt (objectTransformation);
@@ -110,10 +155,10 @@
   glFlush ();
 
-  G4VSceneHandler::EndPrimitives ();
+  G4OpenGLSceneHandler::EndPrimitives ();
 }
 
 void G4OpenGLImmediateSceneHandler::BeginPrimitives2D()
 {
-  G4VSceneHandler::BeginPrimitives2D();
+  G4OpenGLSceneHandler::BeginPrimitives2D();
 
   // Push current 3D world matrices and load identity to define screen
@@ -122,5 +167,5 @@
   glPushMatrix();
   glLoadIdentity();
-  glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
+  glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
   glMatrixMode (GL_MODELVIEW);
   glPushMatrix();
@@ -139,5 +184,5 @@
   glFlush ();
 
-  G4VSceneHandler::EndPrimitives2D ();
+  G4OpenGLSceneHandler::EndPrimitives2D ();
 }
 
@@ -151,5 +196,7 @@
 
 void G4OpenGLImmediateSceneHandler::ClearTransientStore () {
+
   G4VSceneHandler::ClearTransientStore ();
+
   // Make sure screen corresponds to graphical database...
   if (fpViewer) {
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateViewer.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateViewer.cc,v 1.8 2006/09/04 12:07:59 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateWin32.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateX.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateX.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateX.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLImmediateX.cc,v 1.12 2006/08/14 12:07:19 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLImmediateX.cc,v 1.13 2007/08/21 14:05:51 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -41,5 +41,4 @@
 #include "G4OpenGLImmediateXViewer.hh"
 #include "G4OpenGLViewerMessenger.hh"
-#include "G4OpenGLXViewerMessenger.hh"
 
 G4OpenGLImmediateX::G4OpenGLImmediateX ():
@@ -50,5 +49,4 @@
 {
   G4OpenGLViewerMessenger::GetInstance();
-  G4OpenGLXViewerMessenger::GetInstance();
 }
 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXViewer.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateXViewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXm.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXm.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXm.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateXm.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLImmediateXmViewer.cc,v 1.17 2006/07/03 16:38:13 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLQtExportDialog.cc,v 0.1 2007/09/20 15:18:20 garnier $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLQtExportDialog.cc,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
@@ -34,15 +34,15 @@
 #include "G4OpenGLQtExportDialog.hh"
 
-#include <qvariant.h>
-#include <qpushbutton.h>
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qcombobox.h>
-#include <qslider.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qradiobutton.h>
-#include <qimage.h>
-#include <qlineedit.h>
+#include <QtCore/QVariant.h>
+#include <QtGui/QPushButton.h>
+#include <QtGui/QCheckBox.h>
+#include <QtGui/QLabel.h>
+#include <QtGui/QComboBox.h>
+#include <QtGui/QSlider.h>
+#include <QtGui/QLayout.h>
+#include <QtGui/QGroupBox.h>
+#include <QtGui/QRadioButton.h>
+#include <QtGui/QImage.h>
+#include <QtGui/QLineEdit.h>
 
 G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
@@ -57,4 +57,11 @@
   originalWidth = aWidth;
   originalHeight = aHeight;
+
+  // Initializations
+  qualitySlider = NULL;
+  width = NULL;
+  height = NULL;
+  colorButton = NULL;
+  BWButton = NULL;
 
   // global layout
@@ -95,13 +102,13 @@
     //    transparencyEPS->setChecked( true );
 
-    color = new QRadioButton("Color");
-    BW = new QRadioButton("Grayscale");
-    color->setChecked( true );
-    BW->setChecked( false );
+    colorButton = new QRadioButton("Color");
+    BWButton = new QRadioButton("Grayscale");
+    colorButton->setChecked( true );
+    BWButton->setChecked( false );
 
 
     //    EPSGroupBoxLayout->addWidget(transparencyEPS);    
-    EPSGroupBoxLayout->addWidget(color);    
-    EPSGroupBoxLayout->addWidget(BW);    
+    EPSGroupBoxLayout->addWidget(colorButton);    
+    EPSGroupBoxLayout->addWidget(BWButton);    
     EPSGroupBox->setLayout(EPSGroupBoxLayout);
     globalVLayout->addWidget(EPSGroupBox);
@@ -217,4 +224,5 @@
 int G4OpenGLQtExportDialog::getSliderValue()
 {
+  if (!qualitySlider) return -1;
   return qualitySlider->value();
 }
@@ -222,4 +230,5 @@
 int G4OpenGLQtExportDialog::getHeight()
 {
+  if (!height) return -1;
   return height->text().toInt();
 }
@@ -227,9 +236,11 @@
 int G4OpenGLQtExportDialog::getWidth()
 {
+  if (!width) return -1;
   return width->text().toInt();
 }
 
-int G4OpenGLQtExportDialog::getTransparency()
-{
+bool G4OpenGLQtExportDialog::getTransparency()
+{
+  if (!boxTransparency) return -1;
   return boxTransparency->isChecked();
 }
@@ -238,5 +249,5 @@
 {
   // Black and white
-  if (!color->isChecked())
+  if (!colorButton->isChecked())
     return 1;
   // rgb color
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLQtViewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4OpenGLQtViewer.cc,v 1.3 2007/11/08 17:00:51 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
@@ -50,12 +50,19 @@
 #include "G4UIsession.hh"
 #include "G4UImanager.hh"
-#include <QtGui/qboxlayout.h>
-#include <QtGui/qdialog.h>
-#include <QtGui/qmenu.h>
-#include <QImageWriter>
-#include <QMessageBox>
-#include <QFileDialog.h>
-#include <QPrinter.h>
-#include <QPainter.h>
+#include <QtGui/QApplication.h>
+#include <QtGui/QBoxLayout.h>
+#include <QtGui/QDialog.h>
+#include <QtGui/QMenu.h>
+#include <QtGui/QImageWriter>
+#include <QtGui/QMessageBox>
+#include <QtGui/QFileDialog.h>
+#include <QtGui/QPrinter.h>
+#include <QtGui/QPainter.h>
+#include <QtOpenGL/QGLWidget>
+#include <QtGui/QDialog>
+#include <QtGui/QContextMenuEvent>
+#include <QtGui/QMenu>
+#include <QtGui/QImage>
+
 
 //////////////////////////////////////////////////////////////////////////////
@@ -683,18 +690,22 @@
   G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width());
   if(  exportDialog->exec()) {
-    
-    printf("rescaling before\n");
-    //    QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ;
-    QImage image = fWindow->grabFrameBuffer();
-    printf("rescaling after\n");
+
+    QImage image;
+    //    if ((exportDialog->getWidth() !=fWindow->width()) ||
+    //        (exportDialog->getHeight() !=fWindow->height())) {
       
-    
-    if ((exportDialog->getWidth() !=fWindow->width()) ||
-         (exportDialog->getWidth() !=fWindow->width())) {
-
       //      rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image
       printf("rescaling\n");
-    }
-    
+      QGLWidget* glResized = fWindow;
+      fWindow->renderPixmap (exportDialog->getWidth()*2,exportDialog->getHeight()*2 ).save("/Users/laurentgarnier/Desktop/zzz.jpg","jpg");
+      QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ;
+      //      image = pixmap.toImage();
+      //      glResized->resize(exportDialog->getWidth()*2,exportDialog->getHeight()*2);
+      printf("rescaling after\n");
+      //      image = glResized->grabFrameBuffer();
+      
+      //    } else {
+      // image = fWindow->grabFrameBuffer();
+      //  }    
     // jpeg format
     if (nomFich.endsWith(".jpg") || 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLSceneHandler.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLSceneHandler.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLSceneHandler.cc,v 1.45 2006/08/30 11:37:34 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLSceneHandler.cc,v 1.51 2007/05/25 15:41:38 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -52,4 +52,5 @@
 #include "G4Transform3D.hh"
 #include "G4Polyline.hh"
+#include "G4Polymarker.hh"
 #include "G4Text.hh"
 #include "G4Circle.hh"
@@ -64,9 +65,12 @@
 #include "G4Scene.hh"
 #include "G4VisExtent.hh"
+#include "G4AttHolder.hh"
 
 G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system,
 			      G4int id,
 			      const G4String& name):
-  G4VSceneHandler (system, id, name)
+  G4VSceneHandler (system, id, name),
+  fPickName(0),
+  fProcessingPolymarker(false)
 {}
 
@@ -94,4 +98,39 @@
   0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
 };
+
+void G4OpenGLSceneHandler::ClearAndDestroyAtts()
+{
+  std::map<GLuint, G4AttHolder*>::iterator i;
+  for (i = fPickMap.begin(); i != fPickMap.end(); ++i) delete i->second;
+  fPickMap.clear();
+}
+
+void G4OpenGLSceneHandler::PreAddSolid
+(const G4Transform3D& objectTransformation,
+ const G4VisAttributes& visAttribs)
+{
+  G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
+}
+
+void G4OpenGLSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation)
+{
+  G4VSceneHandler::BeginPrimitives (objectTransformation);
+}
+
+void G4OpenGLSceneHandler::EndPrimitives ()
+{
+  G4VSceneHandler::EndPrimitives ();
+}
+
+void G4OpenGLSceneHandler::BeginPrimitives2D ()
+{
+  G4VSceneHandler::BeginPrimitives2D ();
+}
+
+void G4OpenGLSceneHandler::EndPrimitives2D ()
+{
+  G4VSceneHandler::EndPrimitives2D ();
+}
 
 const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron ()
@@ -120,4 +159,11 @@
   if (nPoints <= 0) return;
 
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    LoadAtts(line, holder);
+    fPickMap[fPickName] = holder;
+  }
+
   // Note: colour treated in sub-class.
 
@@ -128,5 +174,9 @@
   glDisable (GL_LIGHTING);
 
-  G4double lineWidth = GetLineWidth(line);
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (line.GetVisAttributes ());
+
+  G4double lineWidth = GetLineWidth(pVA);
   glLineWidth(lineWidth);
 
@@ -142,5 +192,62 @@
 }
 
+void G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
+{
+  G4int nPoints = polymarker.size ();
+  if (nPoints <= 0) return;
+
+  fProcessingPolymarker = true;
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    LoadAtts(polymarker, holder);
+    fPickMap[fPickName] = holder;
+  }
+
+  switch (polymarker.GetMarkerType()) {
+  default:
+  case G4Polymarker::dots:
+    {
+      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
+        G4Circle dot (polymarker);
+        dot.SetPosition (polymarker[iPoint]);
+        dot.SetWorldSize  (0.);
+        dot.SetScreenSize (0.1);  // Very small circle.
+        G4OpenGLSceneHandler::AddPrimitive (dot);
+      }
+    }
+    break;
+  case G4Polymarker::circles:
+    {
+      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
+        G4Circle circle (polymarker);
+        circle.SetPosition (polymarker[iPoint]);
+        G4OpenGLSceneHandler::AddPrimitive (circle);
+      }
+    }
+    break;
+  case G4Polymarker::squares:
+    {
+      for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
+        G4Square square (polymarker);
+        square.SetPosition (polymarker[iPoint]);
+        G4OpenGLSceneHandler::AddPrimitive (square);
+      }
+    }
+    break;
+  }
+
+  fProcessingPolymarker = false;
+}
+
 void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
+
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    LoadAtts(text, holder);
+    fPickMap[fPickName] = holder;
+  }
 
   const G4Colour& c = GetTextColour (text);  // Picks up default if none.
@@ -175,5 +282,5 @@
   glDisable (GL_LIGHTING);
   
-  glRasterPos3f(position.x(),position.y(),position.z());
+  glRasterPos3d(position.x(),position.y(),position.z());
   // No action on offset or layout at present.
   glPushAttrib(GL_LIST_BIT);
@@ -185,15 +292,24 @@
 void G4OpenGLSceneHandler::AddPrimitive (const G4Circle& circle) {
   glEnable (GL_POINT_SMOOTH);
-  AddCircleSquare (circle, 24);
+  AddCircleSquare (circle, G4OpenGLBitMapStore::circle);
 }
 
 void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) {
   glDisable (GL_POINT_SMOOTH);
-  AddCircleSquare (square, 4);
+  AddCircleSquare (square, G4OpenGLBitMapStore::square);
 }
 
 void G4OpenGLSceneHandler::AddCircleSquare
 (const G4VMarker& marker,
- G4int nSides) {
+ G4OpenGLBitMapStore::Shape shape) {
+
+  if (!fProcessingPolymarker) {  // Polymarker has already loaded atts.
+    // Loads G4Atts for picking...
+    if (fpViewer->GetViewParameters().IsPicking()) {
+      G4AttHolder* holder = new G4AttHolder;
+      LoadAtts(marker, holder);
+      fPickMap[fPickName] = holder;
+    }
+  }
 
   // Note: colour treated in sub-class.
@@ -205,172 +321,76 @@
   glDisable (GL_LIGHTING);
   
-  G4double lineWidth = GetLineWidth(marker);
+  // Get vis attributes - pick up defaults if none.
+  const G4VisAttributes* pVA =
+    fpViewer -> GetApplicableVisAttributes (marker.GetVisAttributes ());
+
+  G4double lineWidth = GetLineWidth(pVA);
   glLineWidth(lineWidth);
 
   G4VMarker::FillStyle style = marker.GetFillStyle();
+
+  G4bool filled = false;
+  static G4bool hashedWarned = false;
   
   switch (style) {
   case G4VMarker::noFill: 
     glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+    filled = false;
     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;
+    if (!hashedWarned) {
+      G4cout << "Hashed fill style in G4OpenGLSceneHandler."
+	     << "\n  Not implemented.  Using G4VMarker::filled."
+	     << G4endl;
+      hashedWarned = true;
+    }
+    // Maybe use
+    //glPolygonStipple (fStippleMaskHashed);
+    // Drop through to filled...
     
   case G4VMarker::filled:
     glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+    filled = true;
     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;
+  // Draw...
   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,
+
+    DrawXYPolygon (shape, size, centre, pVA);
+
+  } else { // Size specified in screen (window) coordinates.
+
+    glRasterPos3d(centre.x(),centre.y(),centre.z());
+    const GLubyte* marker =
+      G4OpenGLBitMapStore::GetBitMap(shape, size, filled);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+    glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker);
+  }
+}
+
+void G4OpenGLSceneHandler::DrawXYPolygon
+(G4OpenGLBitMapStore::Shape shape,
+ 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 G4VisAttributes* pApplicableVisAtts)
+{
+  G4int nSides;
+  G4double startPhi;
+  if (shape == G4OpenGLBitMapStore::circle) {
+    nSides = GetNoOfSides(pApplicableVisAtts);
+    startPhi = 0.;
+  } else {
+    nSides = 4;
+    startPhi = -pi / 4.;
+  }
+
   const G4Vector3D& viewpointDirection =
     fpViewer -> GetViewParameters().GetViewpointDirection();
@@ -381,6 +401,7 @@
   G4double phi;
   G4int i;
+
   glBegin (GL_POLYGON);
-  for (i = 0, phi = 0.; i < nSides; i++, phi += dPhi) {
+  for (i = 0, phi = startPhi; i < nSides; i++, phi += dPhi) {
     G4Vector3D r = start; r.rotate(phi, viewpointDirection);
     G4Vector3D p = centre + r;
@@ -388,4 +409,9 @@
   }
   glEnd ();
+}
+
+void G4OpenGLSceneHandler::AddPrimitive (const G4Scale& scale)
+{
+  G4VSceneHandler::AddPrimitive(scale);
 }
 
@@ -398,4 +424,11 @@
   if (polyhedron.GetNoFacets() == 0) return;
 
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    LoadAtts(polyhedron, holder);
+    fPickMap[fPickName] = holder;
+  }
+
   // Get vis attributes - pick up defaults if none.
   const G4VisAttributes* pVA =
@@ -410,5 +443,5 @@
   G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
   if (pViewer) transparency_enabled = pViewer->transparency_enabled;
-  const G4Colour& c = GetColour (polyhedron);
+  const G4Colour& c = pVA->GetColour();
   GLfloat materialColour [4];
   materialColour [0] = c.GetRed ();
@@ -421,5 +454,5 @@
   }
 
-  G4double lineWidth = GetLineWidth(polyhedron);
+  G4double lineWidth = GetLineWidth(pVA);
   glLineWidth(lineWidth);
 
@@ -681,4 +714,11 @@
 void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) {
 
+  // Loads G4Atts for picking...
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    G4AttHolder* holder = new G4AttHolder;
+    LoadAtts(nurb, holder);
+    fPickMap[fPickName] = holder;
+  }
+
   GLUnurbsObj *gl_nurb;
   gl_nurb = gluNewNurbsRenderer ();
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQt.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQt.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQt.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredQt.cc,v 1.11 2007/06/24 12:07:19 $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLStoredQt.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredQtViewer.cc,v 1.16 2007/06/25 16:38:13 $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLStoredQtViewer.cc,v 1.2 2007/11/08 17:00:51 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 //
@@ -38,4 +38,7 @@
 
 #include "G4ios.hh"
+
+#include <QtGui/QMouseEvent>
+#include <QtGui/QContextMenuEvent>
 
 G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredSceneHandler.cc,v 1.31 2006/08/30 11:43:57 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLStoredSceneHandler.cc,v 1.34 2007/04/04 16:50:27 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -46,8 +46,12 @@
 #include "G4PhysicalVolumeModel.hh"
 #include "G4VPhysicalVolume.hh"
+#include "G4LogicalVolume.hh"
 #include "G4Polyline.hh"
 #include "G4Polymarker.hh"
+#include "G4Text.hh"
 #include "G4Circle.hh"
 #include "G4Square.hh"
+#include "G4Polyhedron.hh"
+#include "G4AttHolder.hh"
 
 G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system,
@@ -56,5 +60,6 @@
 fMemoryForDisplayLists (true),
 fAddPrimitivePreambleNestingDepth (0),
-fTopPODL (0)
+fTopPODL (0),
+fProcessing2D (false)
 {}
 
@@ -69,78 +74,23 @@
   if (fAddPrimitivePreambleNestingDepth > 1) return;
 
+  // Because of our need to control colour of transients (display by
+  // time fading), display lists may only cover a single primitive.
+  // So display list setup is here.
+
+  if (fpViewer->GetViewParameters().IsPicking()) {
+    fPickMap[++fPickName] = 0;
+  }
+
   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;
+      G4cout <<
+	"********************* WARNING! ********************"
+	"\nUnable to allocate any more display lists in OpenGL."
+	"\n     Continuing drawing in IMMEDIATE MODE."
+	"\n***************************************************"
+	     << G4endl;
       fMemoryForDisplayLists = false;
     }
@@ -148,25 +98,57 @@
   if (fMemoryForDisplayLists) {
     if (fReadyForTransients) {
-      TO to(fDisplayListId, objectTransformation);
+      TO to(fDisplayListId, *fpObjectTransformation);
+      to.fPickName = fPickName;
+      to.fColour = c;
+      const G4VisAttributes* pVA =
+	fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());
+      to.fStartTime = pVA->GetStartTime();
+      to.fEndTime = pVA->GetEndTime();
       fTOList.push_back(to);
       glDrawBuffer (GL_FRONT);
       glPushMatrix();
-      G4OpenGLTransform3D oglt (objectTransformation);
+      G4OpenGLTransform3D oglt (*fpObjectTransformation);
       glMultMatrixd (oglt.GetGLMatrix ());
+      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
       glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
     }
     else {
-      fPOList.push_back(PO(fDisplayListId, objectTransformation));
+      PO po(fDisplayListId, *fpObjectTransformation);
+      po.fPickName = fPickName;
+      fPOList.push_back(po);
       glNewList (fDisplayListId, GL_COMPILE);
+      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
     }
   } else {
     glDrawBuffer (GL_FRONT);
     glPushMatrix();
-    G4OpenGLTransform3D oglt (objectTransformation);
+    G4OpenGLTransform3D oglt (*fpObjectTransformation);
     glMultMatrixd (oglt.GetGLMatrix ());
-  }
-}
-
-void G4OpenGLStoredSceneHandler::EndPrimitives () {
+    glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
+  }
+
+  if (fProcessing2D) {
+    // Push current 3D world matrices and load identity to define screen
+    // coordinates...
+    glMatrixMode (GL_PROJECTION);
+    glPushMatrix();
+    glLoadIdentity();
+    glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
+    glMatrixMode (GL_MODELVIEW);
+    glPushMatrix();
+    glLoadIdentity();
+  }
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitivePostamble()
+{
+  if (fProcessing2D) {
+    // Pop current 3D world matrices back again...
+    glMatrixMode (GL_PROJECTION);
+    glPopMatrix();
+    glMatrixMode (GL_MODELVIEW);
+    glPopMatrix();
+  }
+
   if (fMemoryForDisplayLists) {
     glEndList();
@@ -177,61 +159,94 @@
     glDrawBuffer (GL_BACK);
   }
-  G4VSceneHandler::EndPrimitives ();
+  fAddPrimitivePreambleNestingDepth--;
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)
+{
+  AddPrimitivePreamble(polyline);
+  G4OpenGLSceneHandler::AddPrimitive(polyline);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
+{
+  AddPrimitivePreamble(polymarker);
+  G4OpenGLSceneHandler::AddPrimitive(polymarker);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Text& text)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4Text&), so it still
+  // gets into the display list
+  AddPrimitivePreamble(text);
+  G4OpenGLSceneHandler::AddPrimitive(text);
+  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 G4Scale& scale)
+{
+  // Let base class split into primitives.
+  G4OpenGLSceneHandler::AddPrimitive(scale);
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&), so it still
+  // gets into the display list
+  AddPrimitivePreamble(polyhedron);
+  G4OpenGLSceneHandler::AddPrimitive(polyhedron);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::AddPrimitive (const G4NURBS& nurbs)
+{
+  // Note: colour is still handled in
+  // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&), so it still
+  // gets into the display list
+  AddPrimitivePreamble(nurbs);
+  G4OpenGLSceneHandler::AddPrimitive(nurbs);
+  AddPrimitivePostamble();
+}
+
+void G4OpenGLStoredSceneHandler::BeginPrimitives
+(const G4Transform3D& objectTransformation)
+{  
+  G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
+
+  // Display list setup moved to AddPrimitivePreamble.  See notes there.
+}
+
+void G4OpenGLStoredSceneHandler::EndPrimitives ()
+{
+  G4OpenGLSceneHandler::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();
+  G4OpenGLSceneHandler::BeginPrimitives2D();
+  fProcessing2D = true;
 }
 
 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 ();
+  fProcessing2D = false;
+  G4OpenGLSceneHandler::EndPrimitives2D ();
 }
 
@@ -253,6 +268,5 @@
       "  display List for fTopPODL - try OpenGL Immediated mode."
 	   << G4endl;
-  }
-  else {
+  } else {
     glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); {
       for (size_t i = 0; i < fPOList.size (); i++) {
@@ -260,4 +274,6 @@
 	G4OpenGLTransform3D oglt (fPOList[i].fTransform);
 	glMultMatrixd (oglt.GetGLMatrix ());
+	if (fpViewer->GetViewParameters().IsPicking())
+	  glLoadName(fPOList[i].fPickName);
 	glCallList (fPOList[i].fDisplayListId);
 	glPopMatrix();
@@ -288,4 +304,5 @@
   fPOList.clear ();
   fSolidMap.clear ();
+  ClearAndDestroyAtts();
 
   // ...and clear transient store...
@@ -375,5 +392,20 @@
 	(fSolidMap.find (pSolid) != fSolidMap.end ())) {
       fDisplayListId = fSolidMap [pSolid];
-      fPOList.push_back(PO(fDisplayListId,*fpObjectTransformation));
+      PO po(fDisplayListId,*fpObjectTransformation);
+      if (fpViewer->GetViewParameters().IsPicking()) {
+	G4AttHolder* holder = new G4AttHolder;
+	// Load G4Atts from G4VisAttributes, if any...
+	const G4VisAttributes* va = pPVModel->GetCurrentLV()->GetVisAttributes();
+	if (va) {
+	  const std::map<G4String,G4AttDef>* vaDefs = va->GetAttDefs();
+	  if (vaDefs) holder->AddAtts(va->CreateAttValues(), vaDefs);
+	}
+	// Load G4Atts from G4PhysicalVolumeModel...
+	const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
+	if (defs) holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
+	fPickMap[++fPickName] = holder;
+	po.fPickName = fPickName;
+      }
+      fPOList.push_back(po);
     }
     else {
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredViewer.cc,v 1.20 2006/10/24 06:23:18 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLStoredViewer.cc,v 1.23 2007/04/04 16:50:27 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -88,9 +88,9 @@
       (lastVP.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
       (lastVP.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
-      (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
-      ) {
-    return true;
-  }
-
+      (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
+      (lastVP.IsPicking ()          != fVP.IsPicking ())
+      )
+    return true;
+  
   if (lastVP.IsDensityCulling () &&
       (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
@@ -142,16 +142,17 @@
     }
 
-    if (fG4OpenGLStoredSceneHandler.fTopPODL)
+    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) {
+
+    for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) {
       G4OpenGLStoredSceneHandler::TO& to =
 	fG4OpenGLStoredSceneHandler.fTOList[i];
-      if ((!(to.fEndTime < fStartTime ))&& (!(to.fStartTime > fEndTime))) {
+      if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) {
 	glPushMatrix();
 	G4OpenGLTransform3D oglt (to.fTransform);
 	glMultMatrixd (oglt.GetGLMatrix ());
+	if (fVP.IsPicking()) glLoadName(to.fPickName);
 	G4Colour& c = to.fColour;
+	G4double bsf = 1.;  // Brightness scaling factor.
 	if (fFadeFactor > 0. && to.fEndTime < fEndTime)
 	  bsf = 1. - fFadeFactor *
@@ -167,9 +168,9 @@
 
   // Display time at "head" of time range, which is fEndTime...
-  if (fDisplayHeadTime && fEndTime < DBL_MAX) {
+  if (fDisplayHeadTime && fEndTime < G4OPENGL_DBL_MAX) {
     glMatrixMode (GL_PROJECTION);
     glPushMatrix();
     glLoadIdentity();
-    glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
+    glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
     glMatrixMode (GL_MODELVIEW);
     glPushMatrix();
@@ -183,5 +184,6 @@
 			      fDisplayHeadTimeBlue));
     headTimeText.SetVisAttributes(&visAtts);
-    fG4OpenGLStoredSceneHandler.AddPrimitive(headTimeText);
+    static_cast<G4OpenGLSceneHandler&>(fSceneHandler).
+      G4OpenGLSceneHandler::AddPrimitive(headTimeText);
     glMatrixMode (GL_PROJECTION);
     glPopMatrix();
@@ -191,5 +193,5 @@
 
   // Display light front...
-  if (fDisplayLightFront && fEndTime < DBL_MAX) {
+  if (fDisplayLightFront && fEndTime < G4OPENGL_DBL_MAX) {
     G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
     if (lightFrontRadius > 0.) {
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32Viewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32Viewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32Viewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.18 2006/09/04 12:07:59 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.19 2007/04/04 16:50:27 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -123,5 +123,7 @@
 
   glFlush ();
-  ::SwapBuffers(fHDC);
+  GLint renderMode;
+  glGetIntegerv(GL_RENDER_MODE, &renderMode);
+  if (renderMode == GL_RENDER) ::SwapBuffers(fHDC);
 
   // Empty the Windows message queue :
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredX.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredX.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredX.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredX.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLStoredX.cc,v 1.14 2007/08/21 14:05:51 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -42,5 +42,4 @@
 #include "G4OpenGLStoredXViewer.hh"
 #include "G4OpenGLViewerMessenger.hh"
-#include "G4OpenGLXViewerMessenger.hh"
 
 G4OpenGLStoredX::G4OpenGLStoredX ():
@@ -51,5 +50,4 @@
 {
   G4OpenGLViewerMessenger::GetInstance();
-  G4OpenGLXViewerMessenger::GetInstance();
 }
 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredXViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLStoredXViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -126,5 +126,7 @@
   glXWaitGL (); //Wait for effects of all previous OpenGL commands to
                 //be propogated before progressing.
-  glXSwapBuffers (dpy, win);  
+  GLint renderMode;
+  glGetIntegerv(GL_RENDER_MODE, &renderMode);
+  if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win);  
 }
 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXm.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXm.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXm.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLStoredXm.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLStoredXmViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLStoredXmViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -131,5 +131,7 @@
   glXWaitGL (); //Wait for effects of all previous OpenGL commands to
                 //be propogated before progressing.
-  glXSwapBuffers (dpy, win);  
+  GLint renderMode;
+  glGetIntegerv(GL_RENDER_MODE, &renderMode);
+  if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win);  
 }
 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLTransform3D.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLTransform3D.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLTransform3D.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -49,5 +49,5 @@
       *p++ = operator()(k,i);
     }
-    *p++ = 0.;
+    *p++ = 0.; 
   } 
   m[15] = 1.; 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLViewer.cc,v 1.29 2006/09/19 16:13:15 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLViewer.cc,v 1.34 2007/05/24 18:27:13 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -46,13 +46,50 @@
 #include "G4Normal3D.hh"
 #include "G4Plane3D.hh"
+#include "G4AttHolder.hh"
+#include "G4AttCheck.hh"
+#include <sstream>
+
+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
+};
 
 G4OpenGLViewer::G4OpenGLViewer (G4OpenGLSceneHandler& scene):
 G4VViewer (scene, -1),
+pointSize (0),
+print_colour (true),
+vectored_ps (true),
+fOpenGLSceneHandler(scene),
 background (G4Colour(0.,0.,0.)),
 transparency_enabled (true),
 antialiasing_enabled (false),
 haloing_enabled (false),
-fStartTime(-DBL_MAX),
-fEndTime(DBL_MAX),
+fStartTime(-G4OPENGL_DBL_MAX),
+fEndTime(G4OPENGL_DBL_MAX),
 fFadeFactor(0.),
 fDisplayHeadTime(false),
@@ -82,4 +119,5 @@
   //  glDisable (GL_POLYGON_SMOOTH);
 
+  strcpy (print_string, "G4OpenGL.eps");
 }
 
@@ -88,5 +126,4 @@
 void G4OpenGLViewer::InitializeGLView () 
 {
-  printf("G4OpenGLViewer::InitializeGLView () VVVVVVVVVVVVVVVVVVVVV \n");
   glClearColor (0.0, 0.0, 0.0, 0.0);
   glClearDepth (1.0);
@@ -94,5 +131,4 @@
   glDisable (GL_LINE_SMOOTH);
   glDisable (GL_POLYGON_SMOOTH);
-  printf("G4OpenGLViewer::InitializeGLView () ^^^^^^^^^^^^^^^^^^^^ \n");
 }  
 
@@ -275,3 +311,532 @@
 }
 
+void G4OpenGLViewer::Pick(GLdouble x, GLdouble y)
+{
+  //G4cout << "X: " << x << ", Y: " << y << G4endl;
+  const G4int BUFSIZE = 512;
+  GLuint selectBuffer[BUFSIZE];
+  glSelectBuffer(BUFSIZE, selectBuffer);
+  glRenderMode(GL_SELECT);
+  glInitNames();
+  glPushName(0);
+  glMatrixMode(GL_PROJECTION);
+  G4double currentProjectionMatrix[16];
+  glGetDoublev(GL_PROJECTION_MATRIX, currentProjectionMatrix);
+  glPushMatrix();
+  glLoadIdentity();
+  GLint viewport[4];
+  glGetIntegerv(GL_VIEWPORT, viewport);
+  // Define 5x5 pixel pick area
+  gluPickMatrix(x, viewport[3] - y, 5., 5., viewport);
+  glMultMatrixd(currentProjectionMatrix);
+  glMatrixMode(GL_MODELVIEW);
+  DrawView();
+  GLint hits = glRenderMode(GL_RENDER);
+  if (hits < 0)
+    G4cout << "Too many hits.  Zoom in to reduce overlaps." << G4cout;
+  else if (hits > 0) {
+    //G4cout << hits << " hit(s)" << G4endl;
+    GLuint* p = selectBuffer;
+    for (GLint i = 0; i < hits; ++i) {
+      GLuint nnames = *p++;
+      *p++; //OR GLuint zmin = *p++;
+      *p++; //OR GLuint zmax = *p++;
+      //G4cout << "Hit " << i << ": " << nnames << " names"
+      //     << "\nzmin: " << zmin << ", zmax: " << zmax << G4endl;
+      for (GLuint j = 0; j < nnames; ++j) {
+	GLuint name = *p++;
+	//G4cout << "Name " << j << ": PickName: " << name << G4endl;
+	std::map<GLuint, G4AttHolder*>::iterator iter =
+	  fOpenGLSceneHandler.fPickMap.find(name);
+	if (iter != fOpenGLSceneHandler.fPickMap.end()) {
+	  G4AttHolder* attHolder = iter->second;
+	  if(attHolder && attHolder->GetAttDefs().size()) {
+	    for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
+	      G4cout << G4AttCheck(attHolder->GetAttValues()[i],
+				   attHolder->GetAttDefs()[i]);
+	    }
+	  }
+	}
+      }
+      G4cout << G4endl;
+    }
+  }
+  glMatrixMode(GL_PROJECTION);
+  glPopMatrix();
+  glMatrixMode(GL_MODELVIEW);
+}
+
+void G4OpenGLViewer::print() {
+
+  // Print vectored PostScript
+  
+  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);
+  }
+
+  delete[] feedback_buffer;
+}
+
+void G4OpenGLViewer::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 G4OpenGLViewer::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 G4OpenGLViewer::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* G4OpenGLViewer::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("G4OpenGLViewer::spewPrimitiveEPS",
+		  "Unexpected token",
+		  JustWarning,
+		  oss.str().c_str());
+      spewPrimitiveEPSWarned = true;
+    }
+  }
+  return loc;
+}
+
+typedef struct G4OpenGLViewerDepthIndex {
+  GLfloat *ptr;
+  GLfloat depth;
+} DepthIndex;
+
+extern "C" {
+  int G4OpenGLViewercompare(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 G4OpenGLViewer::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("G4OpenGLViewer::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), G4OpenGLViewercompare);
+
+  /* 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);
+}
+
 #endif
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLViewerMessenger.cc,v 1.5 2006/10/24 06:20:42 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLViewerMessenger.cc,v 1.9 2007/06/15 09:52:52 gcosmo Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #include "G4OpenGLViewerMessenger.hh"
@@ -35,6 +35,8 @@
 #include "G4UIcommand.hh"
 #include "G4UIdirectory.hh"
+#include "G4UIcmdWithoutParameter.hh"
 #include "G4UIcmdWithADouble.hh"
 #include "G4UIcmdWithABool.hh"
+#include "G4UIcmdWithAString.hh"
 #include "G4VisManager.hh"
 #include <sstream>
@@ -56,4 +58,11 @@
   fpDirectory = new G4UIdirectory("/vis/ogl/");
   fpDirectory->SetGuidance("G4OpenGLViewer commands.");
+
+  fpCommandPrintEPS =
+    new G4UIcmdWithoutParameter("/vis/ogl/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.");
 
   fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
@@ -146,5 +155,5 @@
   fpCommandEndTime->SetGuidance("Set end and range of track time.");
   parameter = new G4UIparameter ("end-time", 'd', omitable = false);
-  parameter->SetDefaultValue(DBL_MAX);
+  parameter->SetDefaultValue(G4OPENGL_DBL_MAX);
   fpCommandEndTime->SetParameter(parameter);
   parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
@@ -165,9 +174,16 @@
   fpCommandFade->SetDefaultValue(0.);
 
+  fpCommandPrintMode = new G4UIcmdWithAString
+    ("/vis/ogl/set/printMode",this);
+  fpCommandPrintMode->SetGuidance("Set print mode");
+  fpCommandPrintMode->SetParameterName("print_mode",omitable = true);
+  fpCommandPrintMode->SetCandidates("vectored pixmap");
+  fpCommandPrintMode->SetDefaultValue("vectored");
+
   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);
+  parameter->SetDefaultValue(-G4OPENGL_DBL_MAX);
   fpCommandStartTime->SetParameter(parameter);
   parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
@@ -192,4 +208,5 @@
 G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
 {
+  delete fpCommandPrintMode;
   delete fpCommandTransparency;
   delete fpCommandStartTime;
@@ -199,5 +216,8 @@
   delete fpCommandDisplayHeadTime;
   delete fpDirectorySet;
+  delete fpCommandPrintEPS;
   delete fpDirectory;
+
+  delete fpInstance;
 }
 
@@ -226,4 +246,22 @@
     return;
   }
+
+  if (command == fpCommandPrintEPS) 
+    {
+      // Keep copy of print_string to preserve Xm behaviour...
+      char* tmp_string = new char[50];
+      strcpy (tmp_string, pOGLViewer->print_string);
+      // Make new print string...
+      static G4int file_count = 0;
+      std::ostringstream oss;
+      oss << "G4OpenGL_" << file_count++ << ".eps";
+      strcpy (pOGLViewer->print_string, oss.str().c_str());
+      // Print eps file...
+      pOGLViewer->print();
+      // Restore print_string for Xm...
+      strcpy (pOGLViewer->print_string, tmp_string);
+      delete tmp_string;
+      return;
+    }
 
   G4OpenGLStoredViewer* pViewer =
@@ -303,4 +341,17 @@
     }
 
+  if (command == fpCommandPrintMode)
+    {
+      if (newValue == "vectored") pViewer->vectored_ps = true;
+      if (newValue == "pixmap") {
+	pViewer->vectored_ps = false;
+	if (pVisManager->GetVerbosity() >= G4VisManager::warnings) {
+	  G4cout <<
+	    "WARNING: Only implemented for X Windows at present."
+		 << G4endl;
+	}
+      }
+    }
+
   if (command == fpCommandStartTime)
     {
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLWin32Viewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLXViewer.cc,v 1.34 2006/11/01 11:22:26 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenGLXViewer.cc,v 1.42 2007/05/25 10:47:17 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -77,39 +77,9 @@
 #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) {
+  static Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
     return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
   }
@@ -125,4 +95,19 @@
                 //be propagated before progressing.
   glFlush ();
+
+  if (fVP.IsPicking()) {
+    G4cout <<
+      "Window activated for picking (left-mouse), exit (middle-mouse)."
+	   << G4endl;
+    while (true) {
+      if (XPending(dpy)) {
+	XNextEvent(dpy, &event);
+	if (event.type == ButtonPress && event.xbutton.button == 1) {
+	  Pick(event.xbutton.x, event.xbutton.y);
+	}
+	else if (event.type == ButtonPress && event.xbutton.button == 2) break;
+      }
+    }
+  }
 }
 
@@ -181,4 +166,5 @@
   
   if (status == 1) {
+    cmap = 0;
     status = XGetRGBColormaps (dpy, 
 			       XRootWindow (dpy, vi -> screen), 
@@ -187,9 +173,18 @@
 			       XA_RGB_DEFAULT_MAP);
     if (status == 1)
-      for (i = 0; i < numCmaps; i++)
+      for (i = 0; i < numCmaps; i++) {
 	if (standardCmaps[i].visualid == vi -> visualid) {
 	  cmap = standardCmaps[i].colormap;
 	  XFree (standardCmaps);
+	  break;
 	}
+      }
+    if (!cmap) {
+      fViewId = -1;  // This flags an error.
+      G4cerr <<
+   "G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap."
+	     << G4endl;
+      return;
+    }
     G4cout << "Got standard cmap" << G4endl;
   } else {
@@ -298,5 +293,15 @@
 
 // connect the context to a window
-  glXMakeCurrent (dpy, win, cx);
+  Bool success = glXMakeCurrent (dpy, win, cx);
+  if (!success) {
+    fViewId = -1;  // This flags an error.
+    G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to attach a GLX context."
+	 << G4endl;
+    GLint error = GL_NO_ERROR;
+    while ((error = glGetError()) != GL_NO_ERROR) {
+      G4cout << "GL Error: " << gluErrorString(error) << G4endl;
+    }
+    return;
+  }
 
 }
@@ -342,12 +347,9 @@
 G4VViewer (scene, -1),
 G4OpenGLViewer (scene),
-print_colour (true),
-vectored_ps (true),
 vi_immediate (0),
-vi_stored (0)
+vi_stored (0),
+vi (0),
+cmap (0)
 {
-
-  strcpy (print_string, "G4OpenGL.eps");
-
   GetXConnection ();
   if (fViewId < 0) return;
@@ -432,29 +434,6 @@
   
   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;
+
+    G4OpenGLViewer::print();
 
   } else {
@@ -462,4 +441,10 @@
     XVisualInfo* pvi;
     GLXContext pcx = create_GL_print_context(pvi);
+
+    if (!pcx) {
+      G4cout << "Unable to create print context." << G4endl;
+      return;
+    }
+
     GLXContext tmp_cx;
     tmp_cx = cx;
@@ -480,5 +465,5 @@
     
     glXMakeCurrent (dpy,
-		    glxpmap,
+		    win,
 		    cx);
     
@@ -486,4 +471,5 @@
     
     ClearView ();
+    SetView ();
     DrawView ();
     
@@ -496,5 +482,5 @@
     
     glXMakeCurrent (dpy,
-		    glxpmap,
+		    win,
 		    cx);
     
@@ -503,462 +489,51 @@
 }
 
-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);
+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;
 }
 
@@ -1040,51 +615,20 @@
 }
 
-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;
+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);
 }
 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmBox.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmBox.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmBox.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmBox.cc,v 1.6 2006/06/29 21:19:40 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Box container class
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.11 2006/06/29 21:19:42 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFourArrowButtons.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFourArrowButtons.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFourArrowButtons.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmFourArrowButtons.cc,v 1.5 2006/06/29 21:19:44 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFramedBox.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFramedBox.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFramedBox.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmFramedBox.cc,v 1.6 2006/06/29 21:19:46 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Framed box container class
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmPanningCallbacks.cc,v 1.8 2006/06/29 21:19:50 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPushButton.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPushButton.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPushButton.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmPushButton.cc,v 1.6 2006/06/29 21:19:52 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Push button class. Inherits from G4OpenGLXmVWidgetComponent
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRadioButton.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRadioButton.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRadioButton.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmRadioButton.cc,v 1.6 2006/06/29 21:19:54 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Radio button class. Inherits from G4OpenGLXmVWidgetComponent
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmRotationCallbacks.cc,v 1.14 2006/06/29 21:19:56 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSeparator.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSeparator.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSeparator.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmSeparator.cc,v 1.5 2006/06/29 21:19:58 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Separator class. Inherits from G4OpenGLXmVWidgetComponent
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSliderBar.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSliderBar.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSliderBar.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmStyleCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmStyleCallbacks.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmStyleCallbacks.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmStyleCallbacks.cc,v 1.14 2006/06/29 21:20:02 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTextField.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTextField.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTextField.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmTextField.cc,v 1.7 2006/06/29 21:20:04 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Text field class. Inherits from G4OpenGLXmVWidgetComponent
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTopLevelShell.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTopLevelShell.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTopLevelShell.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmTopLevelShell.cc,v 1.5 2006/06/29 21:20:06 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Top level shell class
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetComponent.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetComponent.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetComponent.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Base class for all Motif component widgets
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetContainer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetContainer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetContainer.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Base class for all Motif container widgets
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetObject.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetObject.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetObject.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmVWidgetObject.cc,v 1.5 2006/06/29 21:20:12 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Virtual base class for all Motif widgets.
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetShell.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetShell.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetShell.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 //Base class for all Motif shell widgets
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenGLXmViewer.cc,v 1.23 2006/06/29 21:20:16 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4OpenGLXmViewer.cc,v 1.24 2007/08/21 14:05:51 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -616,5 +616,5 @@
 rot_sens_limit (90.),
 pan_sens_limit (100.),
-rot_sens (4.),
+rot_sens (1.),
 wob_sens (20.),
 original_vp(fVP.GetViewpointDirection()),
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewerMessenger.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewerMessenger.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewerMessenger.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
Index: trunk/geant4/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc
===================================================================
--- trunk/geant4/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc	(revision 592)
+++ trunk/geant4/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.6 2006/06/29 21:20:20 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenInventor/History
===================================================================
--- trunk/geant4/visualization/OpenInventor/History	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/History	(revision 593)
@@ -1,3 +1,3 @@
-$Id: History,v 1.90 2006/11/05 20:49:09 allison Exp $
+$Id: History,v 1.93 2007/04/03 13:35:48 allison Exp $
 -------------------------------------------------------------------
 
@@ -20,4 +20,15 @@
 History file for visualization/OpenInventor
 -------------------------------------------
+
+3rd April 2007  John Allison  (openinventor-V08-02-02 - needs visman-V08-02-03)
+- Introduced picking control.  Default is "true" for Open Inventor.
+
+25th March 2007  John Allison  (openinventor-V08-02-01)
+- G4OpenInventorSceneHandler: Introduced AddProperties. Rationalises.
+- G4OpenInventorViewer.cc: Added scale factor to list of changes
+  requiring kernel visit.
+
+5th January 2007  John Allison  (openinventor-V08-02-00)
+- Moved LoadAtts to vis management.
 
 5th November 2006  John Allison  (openinventor-V08-01-04)
Index: trunk/geant4/visualization/OpenInventor/include/G4OpenInventor.hh
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/G4OpenInventor.hh	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/G4OpenInventor.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventor.hh,v 1.9 2006/06/29 21:20:22 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // Guy Barrand 26 Mar 1998.
Index: trunk/geant4/visualization/OpenInventor/include/G4OpenInventorSceneHandler.hh
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/G4OpenInventorSceneHandler.hh	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/G4OpenInventorSceneHandler.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenInventorSceneHandler.hh,v 1.31 2006/11/02 12:01:20 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenInventorSceneHandler.hh,v 1.33 2007/03/27 15:24:15 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -48,5 +48,5 @@
 class SoSeparator;
 class Geant4_SoStyleCache;
-class G4AttHolder;
+class G4VisAttributes;
 
 // Base class for various OpenInventorScene classes.
@@ -86,9 +86,9 @@
 private:
 
-  void LoadAtts(const G4Visible&, G4AttHolder*);
   static G4int fSceneIdCount;   // static counter for OpenInventor scenes.
   enum G4OIMarker {G4OICircle, G4OISquare};
   void AddCircleSquare (G4OIMarker markerType, const G4VMarker&);
   void GeneratePrerequisites();
+  void AddProperties(const G4VisAttributes*);
   std::map <G4LogicalVolume*, SoSeparator*,
     std::less <G4LogicalVolume*> > fSeparatorMap;
Index: trunk/geant4/visualization/OpenInventor/include/G4OpenInventorTransform3D.hh
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/G4OpenInventorTransform3D.hh	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/G4OpenInventorTransform3D.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorTransform3D.hh,v 1.7 2006/06/29 21:20:26 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin.hh
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin.hh	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorWin.hh,v 1.3 2006/06/29 21:20:30 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // OpenInventor graphics system factory.
Index: trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin32.hh
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin32.hh	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWin32.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorWin32.hh,v 1.7 2006/06/29 21:20:32 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // OpenInventor graphics system factory.
Index: trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWinViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWinViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/G4OpenInventorWinViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorWinViewer.hh,v 1.9 2006/06/29 21:20:34 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenInventor/include/G4OpenInventorX.hh
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/G4OpenInventorX.hh	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/G4OpenInventorX.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorX.hh,v 1.7 2006/06/29 21:20:36 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXt.hh
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXt.hh	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXt.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorXt.hh,v 1.3 2006/06/29 21:20:38 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXtViewer.hh
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXtViewer.hh	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/G4OpenInventorXtViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorXtViewer.hh,v 1.14 2006/06/29 21:20:40 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenInventor/include/HEPVis/SbMath.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/HEPVis/SbMath.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/HEPVis/SbMath.h	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: SbMath.h,v 1.4 2006/06/29 21:20:46 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 #ifndef HEPVis_SbMath_h
Index: trunk/geant4/visualization/OpenInventor/include/HEPVis/nodekits/SoDetectorTreeKit.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/HEPVis/nodekits/SoDetectorTreeKit.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/HEPVis/nodekits/SoDetectorTreeKit.h	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: SoDetectorTreeKit.h,v 1.5 2006/06/29 21:21:16 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------HEPVis----------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoBox.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoBox.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoBox.h	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: SoBox.h,v 1.3 2006/06/29 21:21:18 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------Hepvis----------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoCons.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoCons.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoCons.h	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: SoCons.h,v 1.3 2006/06/29 21:21:20 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------Hepvis----------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrap.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrap.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrap.h	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: SoTrap.h,v 1.4 2006/06/29 21:22:06 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------Hepvis----------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrd.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrd.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTrd.h	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: SoTrd.h,v 1.3 2006/06/29 21:22:08 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------Hepvis----------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTubs.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTubs.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/HEPVis/nodes/SoTubs.h	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: SoTubs.h,v 1.3 2006/06/29 21:22:10 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------Hepvis----------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/include/SoG4LineSet.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/SoG4LineSet.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/SoG4LineSet.h	(revision 593)
@@ -25,5 +25,5 @@
 //
 // $Id: SoG4LineSet.h,v 1.2 2006/12/13 15:49:51 gunter Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // John Allison  26th October 2006
Index: trunk/geant4/visualization/OpenInventor/include/SoG4MarkerSet.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/SoG4MarkerSet.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/SoG4MarkerSet.h	(revision 593)
@@ -25,5 +25,5 @@
 //
 // $Id: SoG4MarkerSet.h,v 1.2 2006/12/13 15:49:53 gunter Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // John Allison  26th October 2006
Index: trunk/geant4/visualization/OpenInventor/include/SoG4Polyhedron.h
===================================================================
--- trunk/geant4/visualization/OpenInventor/include/SoG4Polyhedron.h	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/include/SoG4Polyhedron.h	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: SoG4Polyhedron.h,v 1.2 2006/12/13 15:49:56 gunter Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // John Allison  26th October 2006
Index: trunk/geant4/visualization/OpenInventor/src/G4OpenInventor.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/G4OpenInventor.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/G4OpenInventor.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventor.cc,v 1.20 2006/06/29 21:22:12 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 #ifdef G4VIS_BUILD_OI_DRIVER
Index: trunk/geant4/visualization/OpenInventor/src/G4OpenInventorSceneHandler.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/G4OpenInventorSceneHandler.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/G4OpenInventorSceneHandler.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4OpenInventorSceneHandler.cc,v 1.50 2006/11/05 20:48:57 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenInventorSceneHandler.cc,v 1.53 2007/04/03 13:35:48 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -96,10 +96,4 @@
 #include "G4Trap.hh"
 #include "G4Trd.hh"
-#include "G4PhysicalVolumeModel.hh"
-#include "G4TrajectoriesModel.hh"
-#include "G4VTrajectory.hh"
-#include "G4VTrajectoryPoint.hh"
-#include "G4HitsModel.hh"
-#include "G4VHit.hh"
 #include "G4ModelingParameters.hh"
 #include "G4VPhysicalVolume.hh"
@@ -189,58 +183,11 @@
 }
 
-void G4OpenInventorSceneHandler::LoadAtts
-(const G4Visible& visible,
- G4AttHolder* holder)
-{
-  // Load G4Atts from G4VisAttributes, if any...
-  const std::map<G4String,G4AttDef>* vaDefs =
-    visible.GetVisAttributes()->GetAttDefs();
-  if (vaDefs) {
-    holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
-  }
-
-  G4PhysicalVolumeModel* pPVModel =
-    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
-  if (pPVModel) {
-    // Load G4Atts from G4PhysicalVolumeModel...
-    const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
-    if (defs) {
-      holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
-    }
-  }
-
-  G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
-  if (trajModel) {
-    // Load G4Atts from trajectory...
-    const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
-    const std::map<G4String,G4AttDef>* defs = traj->GetAttDefs();
-    if (defs) {
-      holder->AddAtts(traj->CreateAttValues(), defs);
-    }
-    G4int nPoints = traj->GetPointEntries();
-    for (G4int i = 0; i < nPoints; ++i) {
-      G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
-      const std::map<G4String,G4AttDef>* defs = trajPoint->GetAttDefs();
-      if (defs) {
-	holder->AddAtts(trajPoint->CreateAttValues(), defs);
-      }
-    }
-  }
-
-  G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
-  if (hitsModel) {
-    // Load G4Atts from hit...
-    const G4VHit* hit = hitsModel->GetCurrentHit();
-    const std::map<G4String,G4AttDef>* defs = hit->GetAttDefs();
-    if (defs) {
-      holder->AddAtts(hit->CreateAttValues(), defs);
-    }
-  }
-}
-
 //
 // Method for handling G4Polyline objects (from tracking).
 //
-void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line) {
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line)
+{
+  AddProperties(line.GetVisAttributes());  // Transformation, colour, etc.
+
   G4int nPoints = line.size();
   SbVec3f* pCoords = new SbVec3f[nPoints];
@@ -252,17 +199,4 @@
   }
 
-  // Don't understand why I have to do this again (done in
-  // GeneratePrerequisites) - JA.
-  //
-  // Color
-  //
-  const G4Colour& c = GetColour (line);
-  SoMaterial* material = 
-    fStyleCache->getMaterial((float)c.GetRed(),
-                             (float)c.GetGreen(),
-                             (float)c.GetBlue(),
-                             (float)(1-c.GetAlpha()));
-  fCurrentSeparator->addChild(material);
-  
   //
   // Point Set
@@ -281,5 +215,5 @@
 
   // Loads G4Atts for picking...
-  LoadAtts(line, pLine);
+  if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(line, pLine);
 
 #ifdef INVENTOR2_0
@@ -294,5 +228,8 @@
 }
 
-void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
+{
+  AddProperties(polymarker.GetVisAttributes()); // Transformation, colour, etc.
+
   G4int pointn = polymarker.size();
   if(pointn<=0) return;
@@ -305,14 +242,4 @@
   }
 
-  // Don't understand why I have to do this again (done in
-  // GeneratePrerequisites) - JA.
-  const G4Colour& c = GetColour (polymarker);
-  SoMaterial* material = 
-    fStyleCache->getMaterial((float)c.GetRed(),
-                             (float)c.GetGreen(),
-                             (float)c.GetBlue(),
-                             (float)(1-c.GetAlpha()));
-  fCurrentSeparator->addChild(material);
-  
   SoCoordinate3* coordinate3 = new SoCoordinate3;
   coordinate3->point.setValues(0,pointn,points);
@@ -336,5 +263,6 @@
 
   // Loads G4Atts for picking...
-  LoadAtts(polymarker, markerSet);
+  if (fpViewer->GetViewParameters().IsPicking())
+    LoadAtts(polymarker, markerSet);
 
   G4VMarker::FillStyle style = polymarker.GetFillStyle();
@@ -410,8 +338,11 @@
 // Method for handling G4Text objects
 //
-void G4OpenInventorSceneHandler::AddPrimitive (const G4Text& text) {
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Text& text)
+{
+  AddProperties(text.GetVisAttributes());  // Transformation, colour, etc.
+
   //
   // Color.  Note: text colour is worked out differently.  This
-  // over-rides the colour added in GeneratePrerequisites...
+  // over-rides the colour added in AddProperties...
   //
   const G4Colour& c = GetTextColour (text);
@@ -476,18 +407,7 @@
 
 void G4OpenInventorSceneHandler::AddCircleSquare
-(G4OIMarker markerType, const G4VMarker& marker) {
-
-  // Don't understand why I have to do this again (done in
-  // GeneratePrerequisites) - JA.
-  //
-  // Color
-  //
-  const G4Colour& c = GetColour (marker);
-  SoMaterial* material = 
-    fStyleCache->getMaterial((float)c.GetRed(),
-                             (float)c.GetGreen(),
-                             (float)c.GetBlue(),
-                             (float)(1-c.GetAlpha()));
-  fCurrentSeparator->addChild(material);
+(G4OIMarker markerType, const G4VMarker& marker)
+{
+  AddProperties(marker.GetVisAttributes());  // Transformation, colour, etc.
 
   MarkerSizeType sizeType;
@@ -519,5 +439,5 @@
 
   // Loads G4Atts for picking...
-  LoadAtts(marker, markerSet);
+  if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(marker, markerSet);
 
   G4VMarker::FillStyle style = marker.GetFillStyle();
@@ -574,11 +494,15 @@
 // Method for handling G4Polyhedron objects for drawing solids.
 //
-void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
+void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
+{
   if (polyhedron.GetNoFacets() == 0) return;
 
+  AddProperties(polyhedron.GetVisAttributes()); // Transformation, colour, etc.
+
   SoG4Polyhedron* soPolyhedron = new SoG4Polyhedron(polyhedron);
 
   // Loads G4Atts for picking...
-  LoadAtts(polyhedron, soPolyhedron);
+  if (fpViewer->GetViewParameters().IsPicking())
+    LoadAtts(polyhedron, soPolyhedron);
 
   SbString name = "Non-geometry";
@@ -600,4 +524,6 @@
 //
 void G4OpenInventorSceneHandler::AddPrimitive (const G4NURBS& nurb) {
+
+  AddProperties(nurb.GetVisAttributes()); // Transformation, colour, etc.
 
   G4float *u_knot_array, *u_knot_array_ptr;
@@ -618,15 +544,4 @@
   
   SoSeparator *surfSep = new SoSeparator();
-
-  //
-  // Color
-  //  
-  const G4Colour& c = GetColour (nurb);
-  SoMaterial* material = 
-    fStyleCache->getMaterial((float)c.GetRed(),
-                             (float)c.GetGreen(),
-                             (float)c.GetBlue(),
-                             (float)(1-c.GetAlpha()));
-  surfSep->addChild(material);
 
   //
@@ -686,33 +601,4 @@
   // location on in the scene database so that when the solid is
   // actually added (in addthis), it is put in the right place.
-
-  // Use the applicable vis attributes...
-  const G4VisAttributes* pApplicableVisAttribs =
-    fpViewer->GetApplicableVisAttributes (fpVisAttribs);
-
-  // First find the color attributes...
-  const G4Colour& g4Col =  pApplicableVisAttribs->GetColour ();
-  const double red = g4Col.GetRed ();
-  const double green = g4Col.GetGreen ();
-  const double blue = g4Col.GetBlue ();
-  double transparency = 1 - g4Col.GetAlpha();
-
-  // Drawing style...
-  G4ViewParameters::DrawingStyle drawing_style =
-    GetDrawingStyle(pApplicableVisAttribs);
-  switch (drawing_style) {
-  case (G4ViewParameters::wireframe):    
-    fModelingSolid = false;
-    break;
-  case (G4ViewParameters::hlr):
-  case (G4ViewParameters::hsr):
-  case (G4ViewParameters::hlhsr):
-    fModelingSolid = true;
-    break;
-  }	
-
-  // Edge visibility...
-  G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pApplicableVisAttribs);
-  fReducedWireFrame = !isAuxEdgeVisible;
 
   G4PhysicalVolumeModel* pPVModel =
@@ -771,4 +657,31 @@
       if(fPreviewAndFull) detectorTreeKit->setPreviewAndFull();
       else detectorTreeKit->setPreview(TRUE);
+
+      // Colour, etc., for SoDetectorTreeKit.  Treated differently to
+      // othere SoNodes(?).  Use fpVisAttribs stored away in
+      // PreAddSolid...
+      const G4VisAttributes* pApplicableVisAttribs =
+	fpViewer->GetApplicableVisAttributes (fpVisAttribs);
+
+      // First find the color attributes...
+      const G4Colour& g4Col =  pApplicableVisAttribs->GetColour ();
+      const double red = g4Col.GetRed ();
+      const double green = g4Col.GetGreen ();
+      const double blue = g4Col.GetBlue ();
+      double transparency = 1 - g4Col.GetAlpha();
+
+      // Drawing style...
+      G4ViewParameters::DrawingStyle drawing_style =
+	GetDrawingStyle(pApplicableVisAttribs);
+      switch (drawing_style) {
+      case (G4ViewParameters::wireframe):    
+	fModelingSolid = false;
+	break;
+      case (G4ViewParameters::hlr):
+      case (G4ViewParameters::hsr):
+      case (G4ViewParameters::hlhsr):
+	fModelingSolid = true;
+	break;
+      }
 
       SoMaterial* material = 
@@ -853,4 +766,36 @@
     }
   }
+}
+
+void G4OpenInventorSceneHandler::AddProperties(const G4VisAttributes* visAtts)
+{
+  // Use the applicable vis attributes...
+  const G4VisAttributes* pApplicableVisAttribs =
+    fpViewer->GetApplicableVisAttributes (visAtts);
+
+  // First find the color attributes...
+  const G4Colour& g4Col =  pApplicableVisAttribs->GetColour ();
+  const double red = g4Col.GetRed ();
+  const double green = g4Col.GetGreen ();
+  const double blue = g4Col.GetBlue ();
+  double transparency = 1 - g4Col.GetAlpha();
+
+  // Drawing style...
+  G4ViewParameters::DrawingStyle drawing_style =
+    GetDrawingStyle(pApplicableVisAttribs);
+  switch (drawing_style) {
+  case (G4ViewParameters::wireframe):    
+    fModelingSolid = false;
+    break;
+  case (G4ViewParameters::hlr):
+  case (G4ViewParameters::hsr):
+  case (G4ViewParameters::hlhsr):
+    fModelingSolid = true;
+    break;
+  }
+
+  // Edge visibility...
+  G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pApplicableVisAttribs);
+  fReducedWireFrame = !isAuxEdgeVisible;
 
   SoMaterial* material = 
@@ -883,4 +828,3 @@
   fCurrentSeparator->addChild(matrixTransform);
 }
-
 #endif
Index: trunk/geant4/visualization/OpenInventor/src/G4OpenInventorTransform3D.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/G4OpenInventorTransform3D.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/G4OpenInventorTransform3D.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorTransform3D.cc,v 1.8 2006/06/29 21:22:16 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenInventor/src/G4OpenInventorViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/G4OpenInventorViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/G4OpenInventorViewer.cc	(revision 593)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4OpenInventorViewer.cc,v 1.57 2006/11/01 11:06:07 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4OpenInventorViewer.cc,v 1.59 2007/04/03 13:35:48 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #ifdef G4VIS_BUILD_OI_DRIVER
@@ -69,6 +69,8 @@
   fNeedKernelVisit = true;  //?? Temporary, until KernelVisitDecision fixed.
 
+  fVP.SetAutoRefresh(true);
   fDefaultVP.SetAutoRefresh(true);
-  fVP.SetAutoRefresh(true);
+  fVP.SetPicking(true);
+  fDefaultVP.SetPicking(true);
 
   //FIXME : G.Barrand : not convinced that we have to rm culling.
@@ -175,8 +177,13 @@
       (vp.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
       (vp.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
-      (vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
-      ) {
-      return true;;
-  }
+      (vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
+      (vp.IsPicking ()          != fVP.IsPicking ())          ||
+      // Scaling for Open Inventor is done by the scene handler so it
+      // needs a kernel visit.  (In this respect, it differs from the
+      // OpenGL drivers, where it's done in SetView.)
+      (vp.GetScaleFactor ()     != fVP.GetScaleFactor ())
+      )
+    return true;
+
   if (vp.IsDensityCulling () &&
       (vp.GetVisibleDensity () != fVP.GetVisibleDensity ()))
Index: trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWin.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWin.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWin.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorWin.cc,v 1.6 2006/06/29 21:22:20 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // OpenInventor graphics system factory.
Index: trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWinViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWinViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/G4OpenInventorWinViewer.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorWinViewer.cc,v 1.25 2006/06/29 21:22:22 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*
Index: trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXt.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXt.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXt.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorXt.cc,v 1.4 2006/06/29 21:22:24 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXtViewer.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXtViewer.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/G4OpenInventorXtViewer.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4OpenInventorXtViewer.cc,v 1.24 2006/06/29 21:22:26 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*
Index: trunk/geant4/visualization/OpenInventor/src/SoBox.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/SoBox.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/SoBox.cc	(revision 593)
@@ -27,5 +27,5 @@
 //
 // $Id: SoBox.cc,v 1.8 2006/06/29 21:22:36 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*----------------------------HEPVis----------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/src/SoCons.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/SoCons.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/SoCons.cc	(revision 593)
@@ -27,5 +27,5 @@
 //
 // $Id: SoCons.cc,v 1.8 2006/06/29 21:22:38 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------HEPVis---------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/src/SoDetectorTreeKit.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/SoDetectorTreeKit.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/SoDetectorTreeKit.cc	(revision 593)
@@ -27,5 +27,5 @@
 //
 // $Id: SoDetectorTreeKit.cc,v 1.13 2006/06/29 21:22:51 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------HEPVis----------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/src/SoTrap.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/SoTrap.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/SoTrap.cc	(revision 593)
@@ -27,5 +27,5 @@
 //
 // $Id: SoTrap.cc,v 1.8 2006/06/29 21:23:03 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------HEPVis----------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/src/SoTrd.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/SoTrd.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/SoTrd.cc	(revision 593)
@@ -27,5 +27,5 @@
 //
 // $Id: SoTrd.cc,v 1.8 2006/06/29 21:23:05 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------HEPVis---------------------------------------*/
Index: trunk/geant4/visualization/OpenInventor/src/SoTubs.cc
===================================================================
--- trunk/geant4/visualization/OpenInventor/src/SoTubs.cc	(revision 592)
+++ trunk/geant4/visualization/OpenInventor/src/SoTubs.cc	(revision 593)
@@ -27,5 +27,5 @@
 //
 // $Id: SoTubs.cc,v 1.8 2006/06/29 21:23:07 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 /*-----------------------------HEPVis---------------------------------------*/
Index: trunk/geant4/visualization/management/History
===================================================================
--- trunk/geant4/visualization/management/History	(revision 592)
+++ trunk/geant4/visualization/management/History	(revision 593)
@@ -1,3 +1,3 @@
-$Id: History,v 1.90 2006/12/12 11:51:13 gcosmo Exp $
+$Id: History,v 1.101 2007/07/10 17:52:25 allison Exp $
 
 -------------------------------------------------------------------
@@ -26,4 +26,56 @@
 History file for visualization management sub-category
 ------------------------------------------------------
+
+10th July 2007  John Allison  (visman-V09-00-00)
+- Remove redundant method declarations in G4VisManager.hh.
+- Reinstate refesh after "/vis/viewer/set/autoRefresh true".
+
+-25th May 2007  John Allison  (visman-V08-03-01)
+ Improved error trapping in viewer initialisation.
+- Bug fix in /vis/scene/notifyHandlers for case of no current viewer.
+
+16th May 2007  John Allison  (visman-V08-03-00)
+- G4VSceneHandler.cc: Added #include "G4AttDef.hh" to help buggy
+  Windows compiler(!).
+
+4th April 2007  John Allison  (visman-V08-02-04)
+- G4VSceneHandler.cc: Bug fix for zero vis atts in LoadAtts.
+
+3rd April 2007  John Allison  (visman-V08-02-03)
+- Added /vis/viewer/set/picking.  Picking is false by default, except
+  for OpenInventor.
+
+25th March 2007  John Allison  (visman-V08-02-02)
+- G4VisExecutive.icc: Removed G4GAGTree.
+- G4VisCommandsCompound.cc: Removed /vis/scene/add/eventID, once
+  again, from /vis/drawVolume.
+- G4VisCommands.cc: Improved messages for /vis/abortReviewKeptEvents.
+- G4VisManager.cc, G4VSceneHandler.cc: Cosmetic.
+
+11th January 2007  John Allison  (visman-V08-02-01)
+- Added /vis/abortReviewKeptEvents.
+- /vis/reviewKeptEvents: Improved guidance.
+- Bug fix: /vis/open in /vis/reviewKeptEvents loop.
+  o Moved fpRequestedEvent from G4VSceneHandler to G4VisManager.
+- Reduced WARNING noise.
+
+5th January 2007  John Allison  (visman-V08-02-00)
+- G4VSceneHandler:
+  o Introduced LoadAtts (from G4OpenInventorSceneHandler, but now
+    available to all scene handlers).  Loads G4AttValues and G4AttDefs
+    onto any object that inherits G4AttHolder.
+  o Change signature of GetLineWidth from G4Visible& to
+    G4VisAttributes* for consistency with similar utility functions.
+    (Only used by OpenGL at present; requires opengl-V08-02-00.)
+  o GetLineSegmentsPerCircle: protected against null vis atts pointer.
+- G4VisCommandsGeometrySet and G4VisManager.cc:
+  o Introduced /vis/geometry/set/forceLineSegmentsPerCircle
+    (inadvertently omitted in previous release).
+  o Improved guidance.
+- G4VisCommandsGeometry.cc: Invoke /vis/viewer/rebuild only if viewer current.
+- G4VViewer.cc: Improved comment.
+- G4VisCommandsCompound.cc:
+  o Re-introduced /vis/scene/add/eventID into /vis/drawVolume.
+- G4VisCommandsViewer.cc: Improve guidance for /vis/viewer/addCutawayPlane.
 
 12th December 2006  Gabriele Cosmo  (visman-V08-01-16)
Index: trunk/geant4/visualization/management/include/G4GraphicsSystemList.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4GraphicsSystemList.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4GraphicsSystemList.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4GraphicsSystemList.hh,v 1.9 2006/06/29 21:27:54 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4Scene.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4Scene.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4Scene.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4Scene.hh,v 1.18 2006/11/14 14:59:54 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4Scene.icc
===================================================================
--- trunk/geant4/visualization/management/include/G4Scene.icc	(revision 592)
+++ trunk/geant4/visualization/management/include/G4Scene.icc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4Scene.icc,v 1.14 2006/11/14 14:59:54 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4SceneHandlerList.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4SceneHandlerList.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4SceneHandlerList.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4SceneHandlerList.hh,v 1.8 2006/06/29 21:28:00 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4SceneList.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4SceneList.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4SceneList.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4SceneList.hh,v 1.10 2006/06/29 21:28:02 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VGraphicsSystem.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VGraphicsSystem.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VGraphicsSystem.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VGraphicsSystem.hh,v 1.11 2006/06/29 21:28:04 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VGraphicsSystem.icc
===================================================================
--- trunk/geant4/visualization/management/include/G4VGraphicsSystem.icc	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VGraphicsSystem.icc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VGraphicsSystem.icc,v 1.7 2006/06/29 21:28:06 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VSceneHandler.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VSceneHandler.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VSceneHandler.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VSceneHandler.hh,v 1.37 2006/11/15 19:25:31 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VSceneHandler.hh,v 1.39 2007/01/11 16:38:14 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -59,4 +59,5 @@
 class G4Material;
 class G4Event;
+class G4AttHolder;
 
 class G4VSceneHandler: public G4VGraphicsScene {
@@ -217,8 +218,4 @@
   void          SetTransientsDrawnThisRun        (G4bool);
   // Maintained by vis manager.
-  void          SetEvent         (const G4Event*);
-  // If non-zero, this event is used in ProcessScene.  Otherwise, the
-  // current event, or last event(s) are used.  The user must
-  // SetEvent(0) when finished.
 
   //////////////////////////////////////////////////////////////
@@ -233,7 +230,6 @@
   // Returns colour of G4Text object, or default text colour.
 
-  G4double GetLineWidth(const G4Visible& visible);
-  // Returns line width of G4Visible object, or default line width.
-  // Multiplies by GlobalLineWidthScale.
+  G4double GetLineWidth(const G4VisAttributes*);
+  // Returns line width of G4VisAttributes multiplied by GlobalLineWidthScale.
 
   G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes*);
@@ -247,5 +243,5 @@
   // over-riding the current view parameter.
 
-  G4int GetNoOfSides(const G4VisAttributes* pVisAttribs);
+  G4int GetNoOfSides(const G4VisAttributes*);
   // Returns no. of sides (lines segments per circle) from current
   // view parameters, unless the user has forced through the vis
@@ -314,4 +310,13 @@
   // implemented in this class.  Subclasses that implement their own
   // clipping should provide an override that returns zero.
+  void LoadAtts(const G4Visible&, G4AttHolder*);
+  // Load G4AttValues and G4AttDefs associated with the G4Visible
+  // object onto the G4AttHolder object.  It checks fpModel, and also
+  // loads the G4AttValues and G4AttDefs from G4PhysicalVolumeModel,
+  // G4VTrajectory, G4VTrajectoryPoint, or G4VHits, as appropriate.
+  // The G4AttHolder object is an object of a class that publicly
+  // inherits G4AttHolder - see, e.g., SoG4Polyhedron in the Open
+  // Inventor driver.  G4AttHolder deletes G4AttValues in its
+  // destructor to ensure proper clean-up of G4AttValues.
 
   //////////////////////////////////////////////////////////////
@@ -338,5 +343,4 @@
   G4int              fNestingDepth; // For Begin/EndPrimitives.
   const G4VisAttributes* fpVisAttribs;  // Working vis attributes.
-  const G4Event* fRequestedEvent;   // If non-zero, use this event.
   const G4Transform3D fIdentityTransformation;
 
Index: trunk/geant4/visualization/management/include/G4VSceneHandler.icc
===================================================================
--- trunk/geant4/visualization/management/include/G4VSceneHandler.icc	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VSceneHandler.icc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VSceneHandler.icc,v 1.18 2006/11/15 19:25:31 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VSceneHandler.icc,v 1.20 2007/01/11 16:38:14 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -124,7 +124,4 @@
 }
 
-inline void G4VSceneHandler::SetEvent (const G4Event* event) {
-  fRequestedEvent = event;
-}
 inline const G4Colour& G4VSceneHandler::GetColor (const G4Visible& visible) {
   return GetColour (visible);
Index: trunk/geant4/visualization/management/include/G4VUserVisAction.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VUserVisAction.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VUserVisAction.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VUserVisAction.hh,v 1.8 2006/06/29 21:28:12 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VViewer.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VViewer.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VViewer.hh,v 1.18 2006/06/29 21:28:14 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VViewer.icc
===================================================================
--- trunk/geant4/visualization/management/include/G4VViewer.icc	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VViewer.icc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VViewer.icc,v 1.11 2006/06/29 21:28:16 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VVisCommand.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VVisCommand.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VVisCommand.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VVisCommand.hh,v 1.18 2006/06/29 21:28:18 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // Base class for visualization commands - John Allison  9th August 1998
Index: trunk/geant4/visualization/management/include/G4VVisCommand.icc
===================================================================
--- trunk/geant4/visualization/management/include/G4VVisCommand.icc	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VVisCommand.icc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VVisCommand.icc,v 1.5 2006/06/29 21:28:20 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // Base class for visualization commands - John Allison  9th August 1998
Index: trunk/geant4/visualization/management/include/G4ViewParameters.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4ViewParameters.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4ViewParameters.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4ViewParameters.hh,v 1.25 2006/09/19 16:02:31 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4ViewParameters.hh,v 1.26 2007/04/03 13:33:16 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -161,4 +161,5 @@
         G4bool           IsAutoRefresh           () const;
   const G4Colour&        GetBackgroundColour     () const;
+        G4bool           IsPicking               () const;
 
   // Here Follow functions to evaluate the above algorithms as a
@@ -221,4 +222,5 @@
   void SetAutoRefresh          (G4bool);
   void SetBackgroundColour     (const G4Colour&);
+  void SetPicking              (G4bool);
 
   void PrintDifferences (const G4ViewParameters& v) const;
@@ -268,4 +270,5 @@
   G4bool       fAutoRefresh;     // ...after change of view parameters.
   G4Colour     fBackgroundColour;
+  G4bool       fPicking;         // Request picking.
 };
 
Index: trunk/geant4/visualization/management/include/G4ViewParameters.icc
===================================================================
--- trunk/geant4/visualization/management/include/G4ViewParameters.icc	(revision 592)
+++ trunk/geant4/visualization/management/include/G4ViewParameters.icc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4ViewParameters.icc,v 1.15 2006/09/19 16:02:31 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4ViewParameters.icc,v 1.16 2007/04/03 13:33:16 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -182,4 +182,8 @@
 }
 
+inline G4bool G4ViewParameters::IsPicking () const {
+  return fPicking;
+}
+
 inline void
 G4ViewParameters::SetDrawingStyle (G4ViewParameters::DrawingStyle style) {
@@ -335,2 +339,6 @@
   fBackgroundColour = colour;
 }
+
+inline void G4ViewParameters::SetPicking (G4bool picking) {
+  fPicking = picking;
+}
Index: trunk/geant4/visualization/management/include/G4ViewerList.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4ViewerList.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4ViewerList.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4ViewerList.hh,v 1.8 2006/06/29 21:28:26 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VisCommandModelCreate.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandModelCreate.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandModelCreate.hh	(revision 593)
@@ -25,5 +25,5 @@
 //
 // $Id: G4VisCommandModelCreate.hh,v 1.3 2006/06/29 21:28:28 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // Jane Tinslay, John Allison, Joseph Perl October 2005
Index: trunk/geant4/visualization/management/include/G4VisCommands.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommands.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommands.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommands.hh,v 1.6 2006/11/14 14:59:54 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisCommands.hh,v 1.7 2007/01/11 16:39:33 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/ top level commands - John Allison  5th February 2001
@@ -38,4 +38,16 @@
 class G4UIcmdWithAString;
 class G4UIcmdWithoutParameter;
+
+class G4VisCommandAbortReviewKeptEvents: public G4VVisCommand {
+public:
+  G4VisCommandAbortReviewKeptEvents ();
+  virtual ~G4VisCommandAbortReviewKeptEvents ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandAbortReviewKeptEvents (const G4VisCommandAbortReviewKeptEvents&);
+  G4VisCommandAbortReviewKeptEvents& operator = (const G4VisCommandAbortReviewKeptEvents&);
+  G4UIcmdWithABool* fpCommand;
+};
 
 class G4VisCommandEnable: public G4VVisCommand {
Index: trunk/geant4/visualization/management/include/G4VisCommandsCompound.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandsCompound.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandsCompound.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisCommandsCompound.hh,v 1.9 2006/06/29 21:28:32 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // Compound /vis/ commands - John Allison  15th May 2000
Index: trunk/geant4/visualization/management/include/G4VisCommandsGeometry.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandsGeometry.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandsGeometry.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisCommandsGeometry.hh,v 1.3 2006/06/29 21:28:34 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/geometry commands - John Allison  31st January 2006
Index: trunk/geant4/visualization/management/include/G4VisCommandsGeometrySet.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandsGeometrySet.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandsGeometrySet.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommandsGeometrySet.hh,v 1.2 2006/06/29 21:28:36 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4VisCommandsGeometrySet.hh,v 1.3 2007/01/05 16:24:19 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/geometry commands - John Allison  31st January 2006
@@ -80,4 +80,17 @@
 private:
   G4bool fForceAuxEdgeVisible;
+};
+
+class G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction:
+  public G4VVisCommandGeometrySetFunction {
+public:
+  G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction
+  (G4int lineSegmentsPerCircle):
+    fLineSegmentsPerCircle(lineSegmentsPerCircle) {}
+  void operator()
+    (G4VisAttributes* visAtts) const
+  {visAtts->SetForceLineSegmentsPerCircle(fLineSegmentsPerCircle);}
+private:
+  G4int fLineSegmentsPerCircle;
 };
 
@@ -212,4 +225,19 @@
 };
 
+class G4VisCommandGeometrySetForceLineSegmentsPerCircle:
+  public G4VVisCommandGeometrySet {
+public:
+  G4VisCommandGeometrySetForceLineSegmentsPerCircle ();
+  virtual ~G4VisCommandGeometrySetForceLineSegmentsPerCircle ();
+  G4String GetCurrentValue (G4UIcommand* command);
+  void SetNewValue (G4UIcommand* command, G4String newValue);
+private:
+  G4VisCommandGeometrySetForceLineSegmentsPerCircle
+  (const G4VisCommandGeometrySetForceLineSegmentsPerCircle&);
+  G4VisCommandGeometrySetForceLineSegmentsPerCircle& operator=
+  (const G4VisCommandGeometrySetForceLineSegmentsPerCircle&);
+  G4UIcommand* fpCommand;
+};
+
 class G4VisCommandGeometrySetForceWireframe:
   public G4VVisCommandGeometrySet {
Index: trunk/geant4/visualization/management/include/G4VisCommandsListManager.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandsListManager.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandsListManager.hh	(revision 593)
@@ -25,5 +25,5 @@
 //
 // $Id: G4VisCommandsListManager.hh,v 1.3 2006/06/29 21:28:38 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // Jane Tinslay, John Allison, Joseph Perl October 2005
Index: trunk/geant4/visualization/management/include/G4VisCommandsScene.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandsScene.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandsScene.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisCommandsScene.hh,v 1.19 2006/11/14 14:59:54 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/scene commands - John Allison  9th August 1998
Index: trunk/geant4/visualization/management/include/G4VisCommandsSceneAdd.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandsSceneAdd.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandsSceneAdd.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisCommandsSceneAdd.hh,v 1.17 2006/11/01 10:50:28 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/scene commands - John Allison  9th August 1998
Index: trunk/geant4/visualization/management/include/G4VisCommandsSceneHandler.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandsSceneHandler.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandsSceneHandler.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisCommandsSceneHandler.hh,v 1.8 2006/06/29 21:28:44 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/sceneHandler commands - John Allison  10th October 1998
Index: trunk/geant4/visualization/management/include/G4VisCommandsViewer.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandsViewer.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandsViewer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisCommandsViewer.hh,v 1.23 2006/09/13 13:17:29 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/viewer commands - John Allison  25th October 1998
Index: trunk/geant4/visualization/management/include/G4VisCommandsViewerSet.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisCommandsViewerSet.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisCommandsViewerSet.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommandsViewerSet.hh,v 1.21 2006/09/19 16:03:14 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisCommandsViewerSet.hh,v 1.22 2007/04/03 13:33:16 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/viewer/set commands - John Allison  16th May 2000
@@ -69,4 +69,5 @@
   G4UIcommand*          fpCommandLightsVector;
   G4ThreeVector         fLightsVector;
+  G4UIcmdWithABool*     fpCommandPicking;
   G4UIcommand*          fpCommandProjection;
   G4UIcommand*          fpCommandSectionPlane;
Index: trunk/geant4/visualization/management/include/G4VisExecutive.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisExecutive.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisExecutive.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisExecutive.hh,v 1.6 2006/06/29 21:28:50 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VisExecutive.icc
===================================================================
--- trunk/geant4/visualization/management/include/G4VisExecutive.icc	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisExecutive.icc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisExecutive.icc,v 1.14 2006/09/12 18:55:45 tinslay Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisExecutive.icc,v 1.16 2007/10/03 14:20:23 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VisFeaturesOfDAWNFILE.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisFeaturesOfDAWNFILE.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisFeaturesOfDAWNFILE.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisFeaturesOfDAWNFILE.hh,v 1.5 2006/06/29 21:28:54 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 #ifndef G4VISFEATURESOFDAWNFILE_HH
Index: trunk/geant4/visualization/management/include/G4VisFeaturesOfFukuiRenderer.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisFeaturesOfFukuiRenderer.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisFeaturesOfFukuiRenderer.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisFeaturesOfFukuiRenderer.hh,v 1.5 2006/06/29 21:28:56 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenGL.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenGL.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenGL.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisFeaturesOfOpenGL.hh,v 1.5 2006/06/29 21:28:58 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4VisFeaturesOfOpenGL.hh,v 1.6 2007/10/03 14:20:23 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenInventor.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenInventor.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisFeaturesOfOpenInventor.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisFeaturesOfOpenInventor.hh,v 1.5 2006/06/29 21:29:00 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/include/G4VisFilterManager.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisFilterManager.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisFilterManager.hh	(revision 593)
@@ -25,5 +25,5 @@
 //
 // $Id: G4VisFilterManager.hh,v 1.4 2006/06/29 21:29:02 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // Filter manager. Manages filter models, factories, messengers, 
Index: trunk/geant4/visualization/management/include/G4VisListManager.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisListManager.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisListManager.hh	(revision 593)
@@ -25,5 +25,5 @@
 //
 // $Id: G4VisListManager.hh,v 1.8 2006/06/29 21:29:04 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // Jane Tinslay, John Allison, Joseph Perl October 2005
Index: trunk/geant4/visualization/management/include/G4VisManager.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisManager.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisManager.hh	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisManager.hh,v 1.65 2006/11/21 14:23:20 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisManager.hh,v 1.67 2007/07/10 17:49:27 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -344,9 +344,8 @@
   // GetXGeometryString and GetWindowSizeHint is guaranteed to be
   // identical.)
-  const G4String&              GetBeginOfLastRunRandomStatus   () const;
-  const G4String&              GetBeginOfLastEventRandomStatus () const;
-  G4int                        GetLastRunID                    () const;
   G4bool                       GetTransientsDrawnThisRun       () const;
   G4bool                       GetTransientsDrawnThisEvent     () const;
+  const G4Event*               GetRequestedEvent               () const;
+  G4bool                       GetAbortReviewKeptEvents        () const;
 
   void SetUserAction (G4VUserVisAction* pVisAction,
@@ -366,4 +365,7 @@
   void              SetEventRefreshing          (G4bool);
   void              ResetTransientsDrawnFlags   ();
+  // If non-zero, requested event is used in G4VSceneHandler::ProcessScene.
+  void              SetRequestedEvent           (const G4Event*);
+  void              SetAbortReviewKeptEvents    (G4bool);
 
   /////////////////////////////////////////////////////////////////////
@@ -436,11 +438,13 @@
   G4VisStateDependent*  fpStateDependent;   // Friend state dependent class.
   G4int fWindowSizeHintX, fWindowSizeHintY; // For viewer...
-  G4String fXGeometryString;                // ...construction.
-  G4TrajectoriesModel dummyTrajectoriesModel;  // For passing drawing mode.
-  G4bool fEventRefreshing;
-  G4bool fTransientsDrawnThisRun;
-  G4bool fTransientsDrawnThisEvent;
-  G4bool fEventKeepingSuspended;
-  G4bool fKeptLastEvent;
+  G4String              fXGeometryString;   // ...construction.
+  G4TrajectoriesModel   dummyTrajectoriesModel;  // For passing drawing mode.
+  G4bool                fEventRefreshing;
+  G4bool                fTransientsDrawnThisRun;
+  G4bool                fTransientsDrawnThisEvent;
+  G4bool                fEventKeepingSuspended;
+  G4bool                fKeptLastEvent;
+  const G4Event*        fpRequestedEvent; // If non-zero, scene handler uses.
+  G4bool                fAbortReviewKeptEvents;
 
   // Trajectory draw model manager
Index: trunk/geant4/visualization/management/include/G4VisManager.icc
===================================================================
--- trunk/geant4/visualization/management/include/G4VisManager.icc	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisManager.icc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisManager.icc,v 1.19 2006/11/14 14:59:55 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisManager.icc,v 1.20 2007/01/11 16:40:58 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -90,4 +90,12 @@
 }
 
+inline const G4Event* G4VisManager::GetRequestedEvent() const {
+  return fpRequestedEvent;
+}
+
+inline G4bool G4VisManager::GetAbortReviewKeptEvents() const {
+  return fAbortReviewKeptEvents;
+}
+
 inline void G4VisManager::SetUserActionExtent (const G4VisExtent& extent) {
   fUserVisActionExtent = extent;
@@ -122,2 +130,10 @@
   fMessengerList.push_back(msgr);
 }
+
+inline void G4VisManager::SetRequestedEvent (const G4Event* event) {
+  fpRequestedEvent = event;
+}
+
+inline void G4VisManager::SetAbortReviewKeptEvents (G4bool abort) {
+  fAbortReviewKeptEvents = abort;
+}
Index: trunk/geant4/visualization/management/include/G4VisModelManager.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisModelManager.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisModelManager.hh	(revision 593)
@@ -25,5 +25,5 @@
 //
 // $Id: G4VisModelManager.hh,v 1.4 2006/06/29 21:29:10 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // Generic model manager. Manages models, associated
Index: trunk/geant4/visualization/management/include/G4VisStateDependent.hh
===================================================================
--- trunk/geant4/visualization/management/include/G4VisStateDependent.hh	(revision 592)
+++ trunk/geant4/visualization/management/include/G4VisStateDependent.hh	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisStateDependent.hh,v 1.5 2006/06/29 21:29:12 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // A "state dependent" service class for G4VisManager.
Index: trunk/geant4/visualization/management/src/G4GraphicsSystemList.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4GraphicsSystemList.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4GraphicsSystemList.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4GraphicsSystemList.cc,v 1.4 2006/06/29 21:29:14 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #include "G4GraphicsSystemList.hh"
Index: trunk/geant4/visualization/management/src/G4Scene.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4Scene.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4Scene.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4Scene.cc,v 1.23 2006/11/26 15:51:12 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/src/G4SceneHandlerList.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4SceneHandlerList.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4SceneHandlerList.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4SceneHandlerList.cc,v 1.4 2006/06/29 21:29:18 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #include "G4SceneHandlerList.hh"
Index: trunk/geant4/visualization/management/src/G4SceneList.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4SceneList.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4SceneList.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4SceneList.cc,v 1.6 2006/06/29 21:29:20 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #include "G4SceneList.hh"
Index: trunk/geant4/visualization/management/src/G4VGraphicsSystem.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VGraphicsSystem.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VGraphicsSystem.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VGraphicsSystem.cc,v 1.11 2006/06/29 21:29:22 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/src/G4VSceneHandler.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VSceneHandler.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VSceneHandler.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VSceneHandler.cc,v 1.77 2006/11/21 14:23:53 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VSceneHandler.cc,v 1.82 2007/05/16 15:47:44 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -71,4 +71,6 @@
 #include "G4ModelingParameters.hh"
 #include "G4VTrajectory.hh"
+#include "G4VTrajectoryPoint.hh"
+#include "G4HitsModel.hh"
 #include "G4VHit.hh"
 #include "Randomize.hh"
@@ -77,4 +79,6 @@
 #include "G4Run.hh"
 #include "G4Transform3D.hh"
+#include "G4AttHolder.hh"
+#include "G4AttDef.hh"
 
 G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
@@ -95,6 +99,5 @@
   fpObjectTransformation (0),
   fNestingDepth          (0),
-  fpVisAttribs           (0),
-  fRequestedEvent        (0)
+  fpVisAttribs           (0)
 {
   G4VisManager* pVMan = G4VisManager::GetInstance ();
@@ -421,12 +424,9 @@
   G4NURBS* pNURBS = 0;
   G4Polyhedron* pPolyhedron = 0;
-  const G4VisAttributes* pVisAttribs =
-    fpViewer -> GetApplicableVisAttributes (fpVisAttribs);
   switch (fpViewer -> GetViewParameters () . GetRepStyle ()) {
   case G4ViewParameters::nurbs:
     pNURBS = solid.CreateNURBS ();
     if (pNURBS) {
-      pNURBS -> SetVisAttributes
-	(fpViewer -> GetApplicableVisAttributes (pVisAttribs));
+      pNURBS -> SetVisAttributes (fpVisAttribs);
       AddPrimitive (*pNURBS);
       delete pNURBS;
@@ -447,9 +447,9 @@
   case G4ViewParameters::polyhedron:
   default:
-    G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (pVisAttribs));
+    G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (fpVisAttribs));
     pPolyhedron = solid.GetPolyhedron ();
     G4Polyhedron::ResetNumberOfRotationSteps ();
     if (pPolyhedron) {
-      pPolyhedron -> SetVisAttributes (pVisAttribs);
+      pPolyhedron -> SetVisAttributes (fpVisAttribs);
       AddPrimitive (*pPolyhedron);
     }
@@ -471,5 +471,5 @@
 
 void G4VSceneHandler::ProcessScene (G4VViewer&) {
-  printf("G4VSceneHandler::ProcessScene\n");
+
   if (!fpScene) return;
 
@@ -545,68 +545,61 @@
   G4StateManager* stateManager = G4StateManager::GetStateManager();
   G4ApplicationState state = stateManager->GetCurrentState();
-
-  printf("G4VSceneHandler::ProcessScene 1\n");
   if (state == G4State_Idle) {
-  printf("G4VSceneHandler::ProcessScene 2 : idle\n");
 
     visManager->SetEventRefreshing(true);
 
-    if (fRequestedEvent) {
-      DrawEvent(fRequestedEvent);
-      printf("G4VSceneHandler::ProcessScene 3 : fRequestedEvent\n");
+    if (visManager->GetRequestedEvent()) {
+      DrawEvent(visManager->GetRequestedEvent());
 
     } else {
-      printf("G4VSceneHandler::ProcessScene 3 : not fRequestedEvent\n");
 
       G4RunManager* runManager = G4RunManager::GetRunManager();
-      const G4Run* run = runManager->GetCurrentRun();
-      const std::vector<const G4Event*>* events =
-	run? run->GetEventVector(): 0;
-      size_t nKeptEvents = 0;
-      if (events) nKeptEvents = events->size();
       if (runManager) {
-          printf("G4VSceneHandler::ProcessScene 4 : run manager OK\n");
-	if (fpScene->GetRefreshAtEndOfEvent()) {
-          printf("G4VSceneHandler::ProcessScene 5 : fpScene->GetRefreshAtEndOfEvent()\n");
-
-	  if (verbosity >= G4VisManager::confirmations) {
-	    G4cout << "Refreshing event..." << G4endl;
-	  }
-	  const G4Event* event = 0;
-	  if (events && events->size()) event = events->back();
-	  if (event) DrawEvent(event);
-
-	} else {  // Accumulating events.
-  printf("G4VSceneHandler::ProcessScene 7\n");
-
-	  if (verbosity >= G4VisManager::confirmations) {
-	    G4cout << "Refreshing events in run..." << G4endl;
-	  }
-	  for (size_t i = 0; i < nKeptEvents; ++i) {
-	    const G4Event* event = (*events)[i];
+	const G4Run* run = runManager->GetCurrentRun();
+	const std::vector<const G4Event*>* events =
+	  run? run->GetEventVector(): 0;
+	size_t nKeptEvents = 0;
+	if (events) nKeptEvents = events->size();
+	if (nKeptEvents) {
+
+	  if (fpScene->GetRefreshAtEndOfEvent()) {
+
+	    if (verbosity >= G4VisManager::confirmations) {
+	      G4cout << "Refreshing event..." << G4endl;
+	    }
+	    const G4Event* event = 0;
+	    if (events && events->size()) event = events->back();
 	    if (event) DrawEvent(event);
-	  }
-
-	  if (!fpScene->GetRefreshAtEndOfRun()) {
-	    if (verbosity >= G4VisManager::warnings) {
-	      G4cout <<
-		"WARNING: Cannot refresh events accumulated over more"
-		"\n  than one runs.  Refreshed just the last run..."
-		     << G4endl;
+
+	  } else {  // Accumulating events.
+
+	    if (verbosity >= G4VisManager::confirmations) {
+	      G4cout << "Refreshing events in run..." << G4endl;
+	    }
+	    for (size_t i = 0; i < nKeptEvents; ++i) {
+	      const G4Event* event = (*events)[i];
+	      if (event) DrawEvent(event);
+	    }
+
+	    if (!fpScene->GetRefreshAtEndOfRun()) {
+	      if (verbosity >= G4VisManager::warnings) {
+		G4cout <<
+		  "WARNING: Cannot refresh events accumulated over more"
+		  "\n  than one runs.  Refreshed just the last run."
+		       << G4endl;
+	      }
 	    }
 	  }
 	}
       }
-   }
-   visManager->SetEventRefreshing(false);
- }
+    }
+    visManager->SetEventRefreshing(false);
+  }
 
   fMarkForClearingTransientStore = tmpMarkForClearingTransientStore;
-  printf("G4VSceneHandler::ProcessScene terminé \n");
 }
 
 void G4VSceneHandler::DrawEvent(const G4Event* event)
 {
-  printf("G4VSceneHandler::DrawEvent \n");
   const std::vector<G4VModel*>& EOEModelList =
     fpScene -> GetEndOfEventModelList ();
@@ -718,4 +711,55 @@
 }
 
+void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
+{
+  // Load G4Atts from G4VisAttributes, if any...
+  const G4VisAttributes* va = visible.GetVisAttributes();
+  if (va) {
+    const std::map<G4String,G4AttDef>* vaDefs =
+      va->GetAttDefs();
+    if (vaDefs) {
+      holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
+    }
+  }
+
+  G4PhysicalVolumeModel* pPVModel =
+    dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
+  if (pPVModel) {
+    // Load G4Atts from G4PhysicalVolumeModel...
+    const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
+    if (defs) {
+      holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
+    }
+  }
+
+  G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
+  if (trajModel) {
+    // Load G4Atts from trajectory...
+    const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
+    const std::map<G4String,G4AttDef>* defs = traj->GetAttDefs();
+    if (defs) {
+      holder->AddAtts(traj->CreateAttValues(), defs);
+    }
+    G4int nPoints = traj->GetPointEntries();
+    for (G4int i = 0; i < nPoints; ++i) {
+      G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
+      const std::map<G4String,G4AttDef>* defs = trajPoint->GetAttDefs();
+      if (defs) {
+	holder->AddAtts(trajPoint->CreateAttValues(), defs);
+      }
+    }
+  }
+
+  G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
+  if (hitsModel) {
+    // Load G4Atts from hit...
+    const G4VHit* hit = hitsModel->GetCurrentHit();
+    const std::map<G4String,G4AttDef>* defs = hit->GetAttDefs();
+    if (defs) {
+      holder->AddAtts(hit->CreateAttValues(), defs);
+    }
+  }
+}
+
 const G4Colour& G4VSceneHandler::GetColour (const G4Visible& visible) {
   // Colour is determined by the applicable vis attributes.
@@ -734,8 +778,7 @@
 }
 
-G4double G4VSceneHandler::GetLineWidth(const G4Visible& visible)
-{
-  G4double lineWidth = fpViewer->
-    GetApplicableVisAttributes(visible.GetVisAttributes())->GetLineWidth();
+G4double G4VSceneHandler::GetLineWidth(const G4VisAttributes* pVisAttribs)
+{
+  G4double lineWidth = pVisAttribs->GetLineWidth();
   if (lineWidth < 1.) lineWidth = 1.;
   lineWidth *= fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
@@ -749,5 +792,5 @@
   // it can be overriddden by the ForceDrawingStyle flag in the vis
   // attributes.
-  G4ViewParameters::DrawingStyle style =
+  G4ViewParameters::DrawingStyle style = 
     fpViewer->GetViewParameters().GetDrawingStyle();
   if (pVisAttribs -> IsForceDrawingStyle ()) {
@@ -821,13 +864,15 @@
   // ForceLineSegmentsPerCircle in the vis attributes.
   G4int lineSegmentsPerCircle = fpViewer->GetViewParameters().GetNoOfSides();
-  if (pVisAttribs->GetForcedLineSegmentsPerCircle() > 0)
-    lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
-  const G4int nSegmentsMin = 12;
-  if (lineSegmentsPerCircle < nSegmentsMin) {
-    lineSegmentsPerCircle = nSegmentsMin;
-    G4cout <<
-      "G4VSceneHandler::GetNoOfSides: attempt to set the"
-      "\nnumber of line segements per circle < " << nSegmentsMin
-         << "; forced to " << lineSegmentsPerCircle << G4endl;
+  if (pVisAttribs) {
+    if (pVisAttribs->IsForceLineSegmentsPerCircle())
+      lineSegmentsPerCircle = pVisAttribs->GetForcedLineSegmentsPerCircle();
+    const G4int nSegmentsMin = 12;
+    if (lineSegmentsPerCircle < nSegmentsMin) {
+      lineSegmentsPerCircle = nSegmentsMin;
+      G4cout <<
+	"G4VSceneHandler::GetNoOfSides: attempt to set the"
+	"\nnumber of line segements per circle < " << nSegmentsMin
+	     << "; forced to " << lineSegmentsPerCircle << G4endl;
+    }
   }
   return lineSegmentsPerCircle;
Index: trunk/geant4/visualization/management/src/G4VViewer.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VViewer.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VViewer.cc,v 1.23 2006/06/29 21:29:26 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4VViewer.cc,v 1.24 2007/01/05 16:25:15 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -82,5 +82,5 @@
 const G4VisAttributes* G4VViewer::GetApplicableVisAttributes
 (const G4VisAttributes* pVisAttribs) const {
-  // If the pointer is null, pick up the default vis attributes from
+  // If pVisAttribs is zero, pick up the default vis attributes from
   // the view parameters.
   if (!pVisAttribs)
Index: trunk/geant4/visualization/management/src/G4VVisCommand.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VVisCommand.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VVisCommand.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VVisCommand.cc,v 1.18 2006/06/29 21:29:28 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // Base class for visualization commands - John Allison  9th August 1998
Index: trunk/geant4/visualization/management/src/G4ViewParameters.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4ViewParameters.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4ViewParameters.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4ViewParameters.cc,v 1.28 2006/09/19 16:02:31 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4ViewParameters.cc,v 1.29 2007/04/03 13:33:16 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -72,5 +72,6 @@
   fWindowSizeHintY (600),
   fAutoRefresh (false),
-  fBackgroundColour (G4Colour(0.,0.,0.))          // Black
+  fBackgroundColour (G4Colour(0.,0.,0.)),         // Black
+  fPicking (false)
 {
   fDefaultMarker.SetScreenSize (5.);
@@ -273,5 +274,7 @@
       (fXGeometryString      != v.fXGeometryString)      ||
       (fAutoRefresh          != v.fAutoRefresh)          ||
-      (fBackgroundColour     != v.fBackgroundColour))
+      (fBackgroundColour     != v.fBackgroundColour)     || 
+      (fPicking              != v.fPicking)
+      )
     G4cout << "Difference in 1st batch." << G4endl;
 
@@ -439,4 +442,8 @@
 
   os << "\n  Background colour: " << v.fBackgroundColour;
+
+  os << "\n  Picking requested: ";
+  if (v.fPicking) os << "true";
+  else os << "false";
 
   return os;
@@ -480,5 +487,7 @@
       (fXGeometryString      != v.fXGeometryString)      ||
       (fAutoRefresh          != v.fAutoRefresh)          ||
-      (fBackgroundColour     != v.fBackgroundColour))
+      (fBackgroundColour     != v.fBackgroundColour)     ||
+      (fPicking              != v.fPicking)
+      )
     return true;
 
Index: trunk/geant4/visualization/management/src/G4ViewerList.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4ViewerList.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4ViewerList.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4ViewerList.cc,v 1.4 2006/06/29 21:29:32 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #include "G4ViewerList.hh"
Index: trunk/geant4/visualization/management/src/G4VisCommands.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisCommands.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisCommands.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommands.cc,v 1.20 2006/11/26 15:49:10 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisCommands.cc,v 1.22 2007/03/27 15:47:32 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/ top level commands - John Allison  5th February 2001
@@ -40,4 +40,29 @@
 #include "G4Run.hh"
 #include "G4UIsession.hh"
+
+////////////// /vis/abortReviewKeptEvents /////////////////////////////
+
+G4VisCommandAbortReviewKeptEvents::G4VisCommandAbortReviewKeptEvents () {
+  G4bool omitable;
+
+  fpCommand = new G4UIcmdWithABool("/vis/abortReviewKeptEvents", this);
+  fpCommand -> SetGuidance("Abort review of kept events.");
+  fpCommand -> SetParameterName("abort", omitable=true);
+  fpCommand -> SetDefaultValue(true);
+}
+
+G4VisCommandAbortReviewKeptEvents::~G4VisCommandAbortReviewKeptEvents () {
+  delete fpCommand;
+}
+
+G4String G4VisCommandAbortReviewKeptEvents::GetCurrentValue (G4UIcommand*) {
+  return G4String();
+}
+
+void G4VisCommandAbortReviewKeptEvents::SetNewValue (G4UIcommand*,
+						     G4String newValue) {
+  fpVisManager->SetAbortReviewKeptEvents(G4UIcommand::ConvertToBool(newValue));
+  G4cout << "Type \"continue\" to complete the abort." << G4endl;
+}
 
 ////////////// /vis/enable ///////////////////////////////////////
@@ -128,9 +153,14 @@
   fpCommand -> SetGuidance
     ("If a macro file is specified, it is executed for each event.");
-  fpCommand -> SetGuidance
-    ("If a macro file is not specified, each event is drawn to the current"
-     "\nviewer.  After each event, the session is paused.  The user may issue"
-     "\nany allowed command.  Then enter \"continue\" to continue to the next"
-     "\nevent.");
+  fpCommand -> SetGuidance(
+  "If a macro file is not specified, each event is drawn to the current"
+  "\nviewer.  After each event, the session is paused.  The user may issue"
+  "\nany allowed command.  Then enter \"cont[inue]\" to continue to the next"
+  "\nevent."
+  "\nUseful commands might be:"
+  "\n  \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
+  "\n  \"/vis/oglx/printEPS\" to get hard copy."
+  "\n  \"/vis/open\" to get alternative viewer."
+  "\n  \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort.");
   fpCommand -> SetParameterName("macro-file-name", omitable=true);
   fpCommand -> SetDefaultValue("");
@@ -185,6 +215,4 @@
   }
 
-  G4VSceneHandler* sceneHandler = fpVisManager->GetCurrentSceneHandler();
-
   G4UImanager* UImanager = G4UImanager::GetUIpointer();
   G4int keepVerbose = UImanager->GetVerboseLevel();
@@ -200,12 +228,24 @@
 
     // Draw to viewer and pause session...
+    G4UIsession* session = UImanager->GetSession();
     for (size_t i = 0; i < nKeptEvents; ++i) {
       const G4Event* event = (*events)[i];
       if (verbosity >= G4VisManager::warnings) {
 	G4cout << "Drawing event : " << event->GetEventID() <<
-	  ".  At EndOfEvent, enter any command, then \"continue\"..."
+	  ".  At EndOfEvent, enter any command, then \"cont[inue]\"..."
 	       << G4endl;
+	static G4bool first = true;
+	if (first) {
+	  first = false;
+	  G4cout <<
+  "  Useful commands might be:"
+  "\n    \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
+  "\n    \"/vis/oglx/printEPS\" to get hard copy."
+  "\n    \"/vis/open\" to get alternative viewer."
+  "\n    \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort."
+		 << G4endl;
+	}
       }
-      sceneHandler->SetEvent(event);
+      fpVisManager->SetRequestedEvent(event);
       UImanager->ApplyCommand("/vis/viewer/rebuild");
       /* The above command forces a rebuild of the scene, including
@@ -224,10 +264,10 @@
          features or a complete re-think.
       */
-      if (!viewer->GetViewParameters().IsAutoRefresh())
-	UImanager->ApplyCommand("/vis/viewer/flush");
-      G4UIsession* session = UImanager->GetSession();
+      UImanager->ApplyCommand("/vis/viewer/flush");
       session->PauseSessionStart("EndOfEvent");
-      sceneHandler->SetEvent(0);
-    }
+      fpVisManager->SetRequestedEvent(0);
+      if (fpVisManager->GetAbortReviewKeptEvents()) break;
+    }
+    fpVisManager->SetAbortReviewKeptEvents(false);
 
   } else {
@@ -240,7 +280,7 @@
 	       << " with macro file \"" << macroFileName << G4endl;
       }
-      sceneHandler->SetEvent(event);
+      fpVisManager->SetRequestedEvent(event);
       UImanager->ApplyCommand("/control/execute " + macroFileName);
-      sceneHandler->SetEvent(0);
+      fpVisManager->SetRequestedEvent(0);
     }
   }
Index: trunk/geant4/visualization/management/src/G4VisCommandsCompound.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisCommandsCompound.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisCommandsCompound.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommandsCompound.cc,v 1.35 2006/12/12 11:48:13 gcosmo Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisCommandsCompound.cc,v 1.38 2007/03/27 15:41:34 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // Compound /vis/ commands - John Allison  15th May 2000
@@ -202,12 +202,11 @@
   UImanager->SetVerboseLevel(newVerbose);
   UImanager->ApplyCommand("/vis/scene/create");
-//  UImanager->ApplyCommand("/vis/scene/add/eventID");
   UImanager->ApplyCommand(G4String("/vis/scene/add/volume " + newValue));
   UImanager->ApplyCommand("/vis/sceneHandler/attach");
   UImanager->SetVerboseLevel(keepVerbose);
   static G4bool warned = false;
-  if (verbosity >= G4VisManager::warnings && !warned) {
+  if (verbosity >= G4VisManager::confirmations && !warned) {
     G4cout <<
-      "WARNING: For systems which are not \"auto-refresh\" you will need to"
+      "NOTE: For systems which are not \"auto-refresh\" you will need to"
       "\n  issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
 	   << G4endl;
@@ -322,7 +321,7 @@
   UImanager->SetVerboseLevel(keepVerbose);
   static G4bool warned = false;
-  if (verbosity >= G4VisManager::warnings && !warned) {
+  if (verbosity >= G4VisManager::confirmations && !warned) {
     G4cout <<
-      "WARNING: For systems which are not \"auto-refresh\" you will need to"
+      "NOTE: For systems which are not \"auto-refresh\" you will need to"
       "\n  issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
 	   << G4endl;
Index: trunk/geant4/visualization/management/src/G4VisCommandsGeometry.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisCommandsGeometry.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisCommandsGeometry.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommandsGeometry.cc,v 1.3 2006/06/29 21:29:38 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4VisCommandsGeometry.cc,v 1.4 2007/01/05 16:29:38 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/geometry commands - John Allison  31st January 2006
@@ -147,4 +147,6 @@
     return;
   }
-  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
+  if (fpVisManager->GetCurrentViewer()) {
+    G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
+  }
 }
Index: trunk/geant4/visualization/management/src/G4VisCommandsGeometrySet.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisCommandsGeometrySet.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisCommandsGeometrySet.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommandsGeometrySet.cc,v 1.6 2006/09/19 16:05:13 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisCommandsGeometrySet.cc,v 1.7 2007/01/05 16:24:19 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/geometry commands - John Allison  31st January 2006
@@ -171,5 +171,5 @@
   G4bool omitable;
   fpCommand = new G4UIcommand("/vis/geometry/set/daughtersInvisible", this);
-  fpCommand->SetGuidance("Sets daughters of logical volume(s) invisible.");
+  fpCommand->SetGuidance("Makes daughters of logical volume(s) invisible.");
   fpCommand->SetGuidance("\"all\" sets all logical volumes.");
   fpCommand->SetGuidance
@@ -243,5 +243,6 @@
   fpCommand = new G4UIcommand("/vis/geometry/set/forceAuxEdgeVisible", this);
   fpCommand->SetGuidance
-    ("Sets auxiliary (soft) edges of logical volume(s) drawing visible.");
+    ("Forces auxiliary (soft) edges of logical volume(s) to be visible,"
+    "\nregardless of the view parameters.");
   fpCommand->SetGuidance("\"all\" sets all logical volumes.");
   fpCommand->SetGuidance
@@ -288,4 +289,57 @@
 }
 
+////////////// /vis/geometry/set/forceLineSegmentsPerCircle /////////////////////////
+
+G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceLineSegmentsPerCircle()
+{
+  G4bool omitable;
+  fpCommand = new G4UIcommand("/vis/geometry/set/forceLineSegmentsPerCircle", this);
+  fpCommand->SetGuidance
+    ("Forces number of line segments per circle, the precision with which a"
+     "\ncurved line or surface is represented by a polygon or polyhedron,"
+     "\nregardless of the view parameters.");
+  fpCommand->SetGuidance("\"all\" sets all logical volumes.");
+  fpCommand->SetGuidance
+    ("Optionally propagates down hierarchy to given depth.");
+  G4UIparameter* parameter;
+  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
+  parameter->SetDefaultValue("all");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("depth", 'd', omitable = true);
+  parameter->SetDefaultValue(0);
+  parameter->SetGuidance
+    ("Depth of propagation (-1 means unlimited depth).");
+  fpCommand->SetParameter(parameter);
+  parameter = new G4UIparameter("lineSegmentsPerCircle", 'd', omitable = true);
+  parameter->SetGuidance
+    ("< 0 means not forced, i.e., under control of viewer.");
+  parameter->SetDefaultValue(-1);
+  fpCommand->SetParameter(parameter);
+}
+
+G4VisCommandGeometrySetForceLineSegmentsPerCircle::~G4VisCommandGeometrySetForceLineSegmentsPerCircle()
+{
+  delete fpCommand;
+}
+
+G4String
+G4VisCommandGeometrySetForceLineSegmentsPerCircle::GetCurrentValue(G4UIcommand*)
+{
+  return "";
+}
+
+void G4VisCommandGeometrySetForceLineSegmentsPerCircle::SetNewValue
+(G4UIcommand*, G4String newValue)
+{
+  G4String name;
+  G4int requestedDepth;
+  G4int lineSegmentsPerCircle;
+  std::istringstream iss(newValue);
+  iss >> name >> requestedDepth >> lineSegmentsPerCircle;
+
+  G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction setForceLineSegmentsPerCircle(lineSegmentsPerCircle);
+  Set(name, setForceLineSegmentsPerCircle, requestedDepth);
+}
+
 ////////////// /vis/geometry/set/forceSolid /////////////////////////
 
@@ -295,5 +349,6 @@
   fpCommand = new G4UIcommand("/vis/geometry/set/forceSolid", this);
   fpCommand->SetGuidance
-   ("Sets logical volume(s) drawing always to be as solid (surface drawing).");
+   ("Forces logical volume(s) always to be drawn solid (surface drawing),"
+    "\nregardless of the view parameters.");
   fpCommand->SetGuidance("\"all\" sets all logical volumes.");
   fpCommand->SetGuidance
@@ -345,5 +400,6 @@
   fpCommand = new G4UIcommand("/vis/geometry/set/forceWireframe", this);
   fpCommand->SetGuidance
-   ("Sets logical volume(s) drawing always to be as wireframe.");
+   ("Forces logical volume(s) always to be drawn as wireframe,"
+    "\nregardless of the view parameters.");
   fpCommand->SetGuidance("\"all\" sets all logical volumes.");
   fpCommand->SetGuidance
Index: trunk/geant4/visualization/management/src/G4VisCommandsScene.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisCommandsScene.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisCommandsScene.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommandsScene.cc,v 1.65 2006/11/26 19:37:54 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisCommandsScene.cc,v 1.66 2007/05/25 10:49:55 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/scene commands - John Allison  9th August 1998
@@ -480,6 +480,27 @@
   G4VSceneHandler* pCurrentSceneHandler =
     fpVisManager -> GetCurrentSceneHandler();
+  if (!pCurrentSceneHandler) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: No current scene handler."
+	     << G4endl;
+    }
+    return;
+  }
   G4VViewer* pCurrentViewer = fpVisManager -> GetCurrentViewer();
+  if (!pCurrentViewer) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: No current viewer."
+	     << G4endl;
+    }
+    return;
+  }
   G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene();
+  if (!pCurrentScene) {
+    if (verbosity >= G4VisManager::warnings) {
+      G4cout << "WARNING: No current scene."
+	     << G4endl;
+    }
+    return;
+  }
   G4VisManager::Verbosity currentVerbosity = fpVisManager -> GetVerbosity();
 
Index: trunk/geant4/visualization/management/src/G4VisCommandsSceneAdd.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisCommandsSceneAdd.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisCommandsSceneAdd.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisCommandsSceneAdd.cc,v 1.72 2006/11/25 15:37:31 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 // /vis/scene commands - John Allison  9th August 1998
 
Index: trunk/geant4/visualization/management/src/G4VisCommandsSceneHandler.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisCommandsSceneHandler.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisCommandsSceneHandler.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisCommandsSceneHandler.cc,v 1.32 2006/06/29 21:29:46 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/sceneHandler commands - John Allison  10th October 1998
Index: trunk/geant4/visualization/management/src/G4VisCommandsViewer.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisCommandsViewer.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisCommandsViewer.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommandsViewer.cc,v 1.66 2006/11/25 15:38:03 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisCommandsViewer.cc,v 1.68 2007/01/11 16:41:30 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/viewer commands - John Allison  25th October 1998
@@ -73,5 +73,5 @@
   fpCommand = new G4UIcommand ("/vis/viewer/addCutawayPlane", this);
   fpCommand -> SetGuidance
-    ("Add cutaway plane A*x + B*y + C*z + D = 0 to current viewer.");
+    ("Add cutaway plane to current viewer.");
   G4UIparameter* parameter;
   parameter  =  new G4UIparameter("x",'d',omitable = true);
@@ -1139,6 +1139,6 @@
   G4Scene* scene = sceneHandler->GetScene();
   if (!scene) {
-    if (verbosity >= G4VisManager::warnings) {
-      G4cout << "WARNING: SceneHandler \"" << sceneHandler->GetName()
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
 	     << "\", to which viewer \"" << refreshName << "\"" <<
 	"\n  is attached, has no scene - \"/vis/scene/create\" and"
@@ -1413,6 +1413,6 @@
   G4Scene* scene = sceneHandler->GetScene();
   if (!scene) {
-    if (verbosity >= G4VisManager::warnings) {
-      G4cout << "WARNING: SceneHandler \"" << sceneHandler->GetName()
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
 	     << "\", to which viewer \"" << updateName << "\"" <<
 	"\n  is attached, has no scene - \"/vis/scene/create\" and"
Index: trunk/geant4/visualization/management/src/G4VisCommandsViewerSet.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisCommandsViewerSet.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisCommandsViewerSet.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisCommandsViewerSet.cc,v 1.47 2006/11/14 14:59:55 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisCommandsViewerSet.cc,v 1.49 2007/07/10 17:51:54 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 // /vis/viewer/set commands - John Allison  16th May 2000
@@ -67,5 +67,5 @@
      "\nview parameters.");
   fpCommandAutoRefresh->SetParameterName("auto-refresh",omitable = true);
-  fpCommandAutoRefresh->SetDefaultValue(false);
+  fpCommandAutoRefresh->SetDefaultValue(true);
 
   fpCommandAuxEdge = new G4UIcmdWithABool
@@ -76,5 +76,5 @@
      "\nsometimes called soft edges, become visible/invisible.");
   fpCommandAuxEdge->SetParameterName("edge",omitable = true);
-  fpCommandAuxEdge->SetDefaultValue(false);
+  fpCommandAuxEdge->SetDefaultValue(true);
 
   fpCommandBackground = new G4UIcommand
@@ -247,4 +247,13 @@
   fpCommandLineSegments->SetParameterName("line-segments",omitable = true);
   fpCommandLineSegments->SetDefaultValue(24);
+
+  fpCommandPicking = new G4UIcmdWithABool
+    ("/vis/viewer/set/picking",this);
+  fpCommandPicking->SetGuidance("Sets picking, if available.");
+  fpCommandPicking->SetGuidance
+    ("If true, view is set up for picking, if available."
+     "\nFor required actions, watch for instructions for viewer.");
+  fpCommandPicking->SetParameterName("picking",omitable = true);
+  fpCommandPicking->SetDefaultValue(true);
 
   fpCommandProjection = new G4UIcommand("/vis/viewer/set/projection",this);
@@ -388,4 +397,5 @@
   delete fpCommandLightsThetaPhi;
   delete fpCommandLightsVector;
+  delete fpCommandPicking;
   delete fpCommandProjection;
   delete fpCommandSectionPlane;
@@ -460,6 +470,8 @@
 	     << G4endl;
     }
-    currentViewer->SetViewParameters(vp);
-    return;  // I.e., avoid a refresh for this command.
+    if (!vp.IsAutoRefresh()) {
+      currentViewer->SetViewParameters(vp);
+      return;  // Avoid a refresh id auto-refresh has been set to off...
+    }  // ...otherwise take normal action.
   }
 
@@ -754,4 +766,14 @@
   }
 
+  else if (command == fpCommandPicking) {
+    vp.SetPicking(G4UIcommand::ConvertToBool(newValue));
+    if (verbosity >= G4VisManager::confirmations) {
+      G4cout << "Picking ";
+      if (vp.IsPicking()) G4cout << "requested.";
+      else G4cout << "inhibited.";
+      G4cout << G4endl;
+    }
+  }
+
   else if (command == fpCommandProjection) {
     G4double fieldHalfAngle;
Index: trunk/geant4/visualization/management/src/G4VisFeaturesOfDAWNFILE.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisFeaturesOfDAWNFILE.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisFeaturesOfDAWNFILE.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.6 2006/06/29 21:29:52 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 #include "G4VisFeaturesOfDAWNFILE.hh"
Index: trunk/geant4/visualization/management/src/G4VisFeaturesOfFukuiRenderer.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisFeaturesOfFukuiRenderer.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisFeaturesOfFukuiRenderer.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.5 2006/06/29 21:29:54 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenGL.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenGL.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenGL.cc	(revision 593)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4VisFeaturesOfOpenGL.cc,v 1.5 2006/06/29 21:29:56 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// $Id: G4VisFeaturesOfOpenGL.cc,v 1.6 2007/10/03 14:21:55 lgarnier Exp $
+// GEANT4 tag $Name:  $
 //
 // 
Index: trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenInventor.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenInventor.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisFeaturesOfOpenInventor.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisFeaturesOfOpenInventor.cc,v 1.5 2006/06/29 21:29:58 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
Index: trunk/geant4/visualization/management/src/G4VisManager.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisManager.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisManager.cc	(revision 593)
@@ -24,6 +24,6 @@
 // ********************************************************************
 //
-// $Id: G4VisManager.cc,v 1.109 2006/11/26 15:43:51 allison Exp $
-// GEANT4 tag $Name: geant4-08-02-patch-01 $
+// $Id: G4VisManager.cc,v 1.113 2007/05/25 10:50:26 allison Exp $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 //
 // 
@@ -72,4 +72,5 @@
 #include "Randomize.hh"
 #include "G4RunManager.hh"
+#include "G4EventManager.hh"
 #include "G4Run.hh"
 #include "G4Event.hh"
@@ -86,5 +87,5 @@
   fpSceneHandler   (0),
   fpViewer         (0),
-  fVerbosity       (confirmations),//(warnings),
+  fVerbosity       (warnings),
   fpStateDependent (0),
   fEventRefreshing          (false),
@@ -92,5 +93,7 @@
   fTransientsDrawnThisEvent (false),
   fEventKeepingSuspended    (false),
-  fKeptLastEvent            (false)
+  fKeptLastEvent            (false),
+  fpRequestedEvent (0),
+  fAbortReviewKeptEvents    (false)
   // All other objects use default constructors.
 {
@@ -118,5 +121,5 @@
   if (fpInstance) {
     G4Exception
-      ("G4VisManager: attempt to Construct more than one VisManager. ");
+      ("G4VisManager: attempt to Construct more than one VisManager.");
   }
   else {
@@ -584,57 +587,62 @@
   if (fpSceneHandler) {
     G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
-    if (p) {
-      fpViewer = p;                             // Make current.
-      fpViewer -> Initialise ();
-      fpSceneHandler -> AddViewerToList (fpViewer);
-      fpSceneHandler -> SetCurrentViewer (fpViewer);
-
-      const G4ViewParameters& vp = fpViewer->GetViewParameters();
-      G4bool warn = false;
-      if (vp.IsCulling () && vp.IsCullingInvisible ()) {
-	warn = true;
+    if (!p) {
+      if (fVerbosity >= errors) {
+	G4cout << "ERROR in G4VisManager::CreateViewer during "
+	       << fpGraphicsSystem -> GetName ()
+	       << " viewer creation.\n  No action taken."
+	       << G4endl;
+      }
+    } else {
+      p -> Initialise ();
+      if (p -> GetViewId() < 0) {
+	if (fVerbosity >= errors) {
+	G4cout << "ERROR in G4VisManager::CreateViewer during "
+	       << fpGraphicsSystem -> GetName ()
+	       << " viewer initialisation.\n  No action taken."
+	       << G4endl;
+	}
+      } else {
+	fpViewer = p;                             // Make current.
+	fpSceneHandler -> AddViewerToList (fpViewer);
+	fpSceneHandler -> SetCurrentViewer (fpViewer);
+
 	if (fVerbosity >= confirmations) {
-	  G4cout << "G4VisManager::CreateViewer: new viewer created:"
+	  G4cout << "G4VisManager::CreateViewer: new viewer created."
 		 << G4endl;
 	}
+
+	const G4ViewParameters& vp = fpViewer->GetViewParameters();
 	if (fVerbosity >= parameters) {
 	  G4cout << " view parameters are:\n  " << vp << G4endl;
 	}
-	if (fVerbosity >= warnings) {
-	  G4cout <<
-	    "WARNING: objects with visibility flag set to \"false\""
-	    " will not be drawn!"
-	    "\n  \"/vis/viewer/set/culling global false\" to Draw such objects."
-		 << G4endl;
-	}
-      }
-      if (vp.IsCullingCovered ()) {
-	if (!warn) {
+
+	if (vp.IsCulling () && vp.IsCullingInvisible ()) {
+	  static G4bool warned = false;
 	  if (fVerbosity >= confirmations) {
-	    G4cout << "G4VisManager::CreateViewer: new viewer created:"
-		   << G4endl;
+	    if (!warned) {
+	      G4cout <<
+  "NOTE: objects with visibility flag set to \"false\""
+  " will not be drawn!"
+  "\n  \"/vis/viewer/set/culling global false\" to Draw such objects."
+  "\n  Also see other \"/vis/viewer/set\" commands."
+		     << G4endl;
+	      warned = true;
+	    }
 	  }
 	}
-	warn = true;
-	if (fVerbosity >= warnings) {
-	  G4cout <<
-	    "WARNING: covered objects in solid mode will not be rendered!"
-	    "\n  \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
-		 << G4endl;
+	if (vp.IsCullingCovered ()) {
+	  static G4bool warned = false;
+	  if (fVerbosity >= warnings) {
+	    if (!warned) {
+	      G4cout <<
+  "WARNING: covered objects in solid mode will not be rendered!"
+  "\n  \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
+  "\n  Also see other \"/vis/viewer/set\" commands."
+		     << G4endl;
+	      warned = true;
+	    }
+	  }
 	}
-      }
-      if (warn) {
-	if (fVerbosity >= warnings) {
-	  G4cout << "  Also see other \"/vis/viewer/set\" commands."
-		 << G4endl;
-	}
-      }
-    }
-    else {
-      if (fVerbosity >= errors) {
-	G4cout << "ERROR in G4VisManager::CreateViewer during "
-	       << fpGraphicsSystem -> GetName ()
-	       <<	" viewer creation.\n  No action taken."
-	       << G4endl;
       }
     }
@@ -893,4 +901,5 @@
 
   // Top level basic commands...
+  RegisterMessenger(new G4VisCommandAbortReviewKeptEvents);
   RegisterMessenger(new G4VisCommandEnable);
   RegisterMessenger(new G4VisCommandList);
@@ -921,4 +930,5 @@
   RegisterMessenger(new G4VisCommandGeometrySetLineWidth);
   RegisterMessenger(new G4VisCommandGeometrySetForceAuxEdgeVisible);
+  RegisterMessenger(new G4VisCommandGeometrySetForceLineSegmentsPerCircle);
   RegisterMessenger(new G4VisCommandGeometrySetForceSolid);
   RegisterMessenger(new G4VisCommandGeometrySetForceWireframe);
@@ -1104,5 +1114,5 @@
 void G4VisManager::BeginOfRun ()
 {
-  G4cout << "G4VisManager::BeginOfRun" << G4endl;
+  //G4cout << "G4VisManager::BeginOfRun" << G4endl;
   fKeptLastEvent = false;
   fEventKeepingSuspended = false;
@@ -1113,5 +1123,5 @@
 void G4VisManager::BeginOfEvent ()
 {
-  G4cout << "G4VisManager::BeginOfEvent" << G4endl;
+  //G4cout << "G4VisManager::BeginOfEvent" << G4endl;
   fTransientsDrawnThisEvent = false;
   if (fpSceneHandler) fpSceneHandler->SetTransientsDrawnThisEvent(false);
@@ -1120,5 +1130,5 @@
 void G4VisManager::EndOfEvent ()
 {
-  G4cout << "G4VisManager::EndOfEvent" << G4endl;
+  //G4cout << "G4VisManager::EndOfEvent" << G4endl;
 
   // Don't call IsValidView unless there is a scene handler.  This
@@ -1131,12 +1141,10 @@
   const G4Run* currentRun = runManager->GetCurrentRun();
 
-  const G4Event* currentEvent =
-    G4EventManager::GetEventManager()->GetConstCurrentEvent();
+  G4EventManager* eventManager = G4EventManager::GetEventManager();
+  const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
   if (!currentEvent) return;
 
   ClearTransientStoreIfMarked();
-  printf("G4VisManager::DrawEvent \n");
   fpSceneHandler->DrawEvent(currentEvent);
-  printf("G4VisManager::DrawEvent END\n");
 
   G4int nEventsToBeProcessed = 0;
@@ -1160,5 +1168,5 @@
       // Keep, but only if user has not kept any...
       if (!nKeptEvents) {
-	G4EventManager::GetEventManager()->KeepTheCurrentEvent();
+	eventManager->KeepTheCurrentEvent();
 	fKeptLastEvent = true;
       }
@@ -1182,5 +1190,5 @@
       }
     } else if (maxNumberOfKeptEvents != 0) {
-      G4EventManager::GetEventManager()->KeepTheCurrentEvent();
+      eventManager->KeepTheCurrentEvent();
     }
   }
@@ -1189,5 +1197,5 @@
 void G4VisManager::EndOfRun ()
 {
-  G4cout << "G4VisManager::EndOfRun" << G4endl;
+  //G4cout << "G4VisManager::EndOfRun" << G4endl;
 
   // Don't call IsValidView unless there is a scene handler.  This
Index: trunk/geant4/visualization/management/src/G4VisStateDependent.cc
===================================================================
--- trunk/geant4/visualization/management/src/G4VisStateDependent.cc	(revision 592)
+++ trunk/geant4/visualization/management/src/G4VisStateDependent.cc	(revision 593)
@@ -26,5 +26,5 @@
 //
 // $Id: G4VisStateDependent.cc,v 1.6 2006/06/29 21:30:02 gunter Exp $
-// GEANT4 tag $Name: geant4-08-01-patch-01 $
+// GEANT4 tag $Name: geant4-09-00-ref-01 $
 
 #include "G4VisStateDependent.hh"
@@ -46,5 +46,4 @@
   }
   else if (previousState == G4State_EventProc &&  requestedState == G4State_GeomClosed) {
-    printf("G4VisStateDependent::EndOfEvent \n");
     fpVisManager -> EndOfEvent ();
   }
