Index: trunk/source/interfaces/common/#GNUmakefile#
===================================================================
--- trunk/source/interfaces/common/#GNUmakefile#	(revision 1350)
+++ trunk/source/interfaces/common/#GNUmakefile#	(revision 1350)
@@ -0,0 +1,27 @@
+# $Id: GNUmakefile,v 1.5 2010/01/06 14:08:20 lgarnier Exp $
+# -------------------------------------------------------------
+# GNUmakefile for interfaces/common library.  John Allison, 6/7/98.
+
+name := G4UIcommon
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+# For debug mode
+# CPPFLAGS += -DG4DEBUG_INTERFACES_COMMON
+
+include $(G4INSTALL)/config/architecture.gmk
+#include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/G4UI_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+# NO need OGL, then reset OGLGLAGS
+OGLFLAGS = ""
+OGLLIBS  = ""
+
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/interfaces/basic/include
+
+include $(G4INSTALL)/config/common.gmk
Index: trunk/source/interfaces/common/CMakeLists.txt
===================================================================
--- trunk/source/interfaces/common/CMakeLists.txt	(revision 1350)
+++ trunk/source/interfaces/common/CMakeLists.txt	(revision 1350)
@@ -0,0 +1,18 @@
+#------------------------------------------------------------------------------
+# CMakeLists.txt
+# Module : G4UIcommon
+# Package: Geant4.src.G4interfaces.G4UIcommon
+#
+# CMakeLists.txt for building a single granular library.
+#
+# Generated on : 24/9/2010
+#
+# $Id: CMakeLists.txt,v 1.1 2010/09/29 18:46:11 bmorgan Exp $
+#
+#------------------------------------------------------------------------------
+
+if(GEANT4_BUILD_GRANULAR_LIBS)
+    include(Geant4MacroLibraryTargets)
+    GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
+endif()
+
Index: trunk/source/interfaces/common/GNUmakefile~
===================================================================
--- trunk/source/interfaces/common/GNUmakefile~	(revision 1350)
+++ trunk/source/interfaces/common/GNUmakefile~	(revision 1350)
@@ -0,0 +1,27 @@
+# $Id: GNUmakefile,v 1.5 2010/01/06 14:08:20 lgarnier Exp $
+# -------------------------------------------------------------
+# GNUmakefile for interfaces/common library.  John Allison, 6/7/98.
+
+name := G4UIcommon
+
+ifndef G4INSTALL
+  G4INSTALL = ../../..
+endif
+
+# For debug mode
+# CPPFLAGS += -DG4DEBUG_INTERFACES_COMMON
+
+include $(G4INSTALL)/config/architecture.gmk
+#include $(G4INSTALL)/config/G4VIS_BUILD.gmk
+include $(G4INSTALL)/config/G4UI_BUILD.gmk
+include $(G4INSTALL)/config/interactivity.gmk
+
+# NO need OGL, then reset OGLGLAGS
+OGLFLAGS = ""
+OGLLIBS  = ""
+
+CPPFLAGS += -I$(G4BASE)/global/management/include
+CPPFLAGS += -I$(G4BASE)/intercoms/include
+CPPFLAGS += -I$(G4BASE)/interfaces/basic/include
+
+include $(G4INSTALL)/config/common.gmk
Index: trunk/source/interfaces/common/sources.cmake
===================================================================
--- trunk/source/interfaces/common/sources.cmake	(revision 1350)
+++ trunk/source/interfaces/common/sources.cmake	(revision 1350)
@@ -0,0 +1,108 @@
+#------------------------------------------------------------------------------
+# sources.cmake
+# Module : G4UIcommon
+# Package: Geant4.src.G4interfaces.G4UIcommon
+#
+# Sources description for a library.
+# Lists the sources and headers of the code explicitely.
+# Lists include paths needed.
+# Lists the internal granular and global dependencies of the library.
+# Source specific properties should be added at the end.
+#
+# Generated on : 24/9/2010
+#
+# $Id: sources.cmake,v 1.4 2010/11/30 12:00:56 bmorgan Exp $
+# GEANT4 Tag $Name:  $
+#
+#------------------------------------------------------------------------------
+
+# List external includes needed.
+include_directories(${CLHEP_INCLUDE_DIRS})
+
+# List internal includes needed.
+include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
+include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
+#include_directories(${CMAKE_SOURCE_DIR}/source/interfaces/basic/include)
+
+#
+# Module has optional sources
+#
+# List those always built
+set(G4INTERFACES_COMMON_MODULE_HEADERS 
+    G4InteractorMessenger.hh
+    G4VBasicShell.hh
+    G4VInteractiveSession.hh
+    G4VInteractorManager.hh)
+
+set(G4INTERFACES_COMMON_MODULE_SOURCES
+    G4InteractorMessenger.cc
+    G4VBasicShell.cc
+    G4VInteractiveSession.cc
+    G4VInteractorManager.cc)
+
+set(G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES )
+
+#
+# Add Qt if required
+#
+if(GEANT4_USE_QT)
+    # Add the sources
+    list(APPEND G4INTERFACES_COMMON_MODULE_HEADERS G4Qt.hh)
+    list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Qt.cc)
+    
+    # Stuff for Moc etc, plus LINK_LIBRARIES here
+    include(${QT_USE_FILE})
+    
+    # Must enable Qt source with a def...
+    GEANT4_ADD_COMPILE_DEFINITIONS(SOURCES G4Qt.cc
+        COMPILE_DEFINITIONS G4INTY_BUILD_QT)
+
+    # It uses Qt core and gui(?) libs
+    list(APPEND G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES
+        "${QT_QTGUI_LIBRARY};${QT_QTCORE_LIBRARY}") 
+endif()
+
+#
+# Win32 option
+#
+if(MSVC AND GEANT4_USE_WIN32TERMINAL)
+    # Add the sources
+    list(APPEND G4INTERFACES_COMMON_MODULE_HEADERS G4Win32.hh)
+    list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Win32.cc)
+
+    # Any extra things here
+endif()
+
+#
+# X11/Xt options
+#
+if(UNIX AND GEANT4_USE_X11TERMINAL)
+    # Add the sources
+    list(APPEND G4INTERFACES_COMMON_MODULE_HEADERS G4Xt.hh)
+    list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Xt.cc)
+
+    # Any extra things here
+endif()
+
+
+#
+# Define the Geant4 Module.
+#
+include(Geant4MacroDefineModule)
+GEANT4_DEFINE_MODULE(NAME G4UIcommon
+    HEADERS
+        ${G4INTERFACES_COMMON_MODULE_HEADERS}
+    SOURCES
+        ${G4INTERFACES_COMMON_MODULE_SOURCES}
+    GRANULAR_DEPENDENCIES
+        G4globman
+        G4intercoms
+    GLOBAL_DEPENDENCIES
+        G4global
+        G4intercoms
+    LINK_LIBRARIES
+        ${G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES}
+)
+
+# List any source specific properties here
+
Index: trunk/source/interfaces/common/src/G4Qt.cc~
===================================================================
--- trunk/source/interfaces/common/src/G4Qt.cc~	(revision 1350)
+++ trunk/source/interfaces/common/src/G4Qt.cc~	(revision 1350)
@@ -0,0 +1,209 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4Qt.cc,v 1.17 2010/05/20 07:01:03 lgarnier Exp $
+// GEANT4 tag $Name: geant4-09-04-beta-01 $
+//
+// L. Garnier
+
+#if defined(G4INTY_BUILD_QT) || defined(G4INTY_USE_QT)
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "G4ios.hh"
+
+#include "G4Qt.hh"
+#include <qwidget.h>
+
+#include <qapplication.h>
+
+
+G4Qt* G4Qt::instance    = NULL;
+
+static G4bool QtInited  = FALSE;
+
+/***************************************************************************/
+G4Qt* G4Qt::getInstance (
+) 
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+  return G4Qt::getInstance (0,NULL,(char*)"Geant4");
+}
+/***************************************************************************/
+G4Qt* G4Qt::getInstance (
+ int    a_argn
+,char** a_args
+,char*  a_class
+) 
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+  if (instance==NULL) {
+    instance = new G4Qt(a_argn,a_args,a_class);
+  }
+  return instance;
+}
+/***************************************************************************/
+G4Qt::G4Qt (
+ int    a_argn
+,char** a_args
+ ,char*  /*a_class */
+ )
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+  argn = 0;
+  args = NULL;
+
+#ifdef G4DEBUG_INTERFACES_COMMON
+  printf("G4Qt::G4Qt try to inited Qt\n");
+#endif
+  // Check if Qt already init in another external app
+  if(qApp) {
+    QtInited  = TRUE;
+    //#if QT_VERSION < 0x040000
+    //      SetMainInteractor (&qApp);
+    //#else
+    SetMainInteractor (qApp);
+    //#endif
+    SetArguments      (a_argn,a_args);
+    
+#ifdef G4DEBUG_INTERFACES_COMMON
+    printf("G4Qt::G4Qt alredy inited in external \n");
+#endif
+  } else {
+    
+    if(QtInited==FALSE) {  //Qt should be Inited once !
+      // Then two cases :
+      // - It is the first time we create G4UI  (argc!=0)
+      //   -> Inited and register
+      // - It is the first time we create G4VIS  (argc == 0)
+      //   -> Inited and NOT register
+      
+      if (a_argn != 0) {
+        argn = a_argn;
+        args = a_args;
+
+      } else { //argc = 0
+
+        // FIXME : That's not the good arguments, but I don't know how to get args from other Interactor.
+        // Ex: How to get them from G4Xt ?
+        argn = 1;
+        args = (char **)malloc( 1 * sizeof(char *) );
+        args[0] = (char *)malloc(10 * sizeof(char));
+        strncpy(args[0], "my_app \0", 9);
+      }
+
+      int *p_argn = (int*)malloc(sizeof(int));
+      *p_argn = argn;
+#if QT_VERSION < 0x040000
+      qApp = new QApplication (*p_argn, args);
+#else
+#ifdef G4DEBUG_INTERFACES_COMMON
+    printf("G4Qt::G4Qt QAppl \n");
+#endif
+      new QApplication (*p_argn, args);
+#endif
+      if(!qApp) {
+        
+        G4cout        << "G4Qt : Unable to init Qt." << G4endl;
+      } else {
+        QtInited  = TRUE;
+        if (a_argn != 0) {
+#ifdef G4DEBUG_INTERFACES_COMMON
+        printf("G4Qt::G4Qt SetMainInteractor\n");
+#endif
+          SetMainInteractor (qApp);
+        }
+        SetArguments      (a_argn,a_args);
+#ifdef G4DEBUG_INTERFACES_COMMON
+        printf("G4Qt::G4Qt inited Qt END\n");
+#endif
+      }
+    }
+  }
+#ifdef G4DEBUG_INTERFACES_COMMON
+  if (qApp) {
+    printf("G4Qt::qApp already exist\n");
+  }  else {
+    printf("G4Qt::qApp not exist\n");
+  }
+#endif
+  //  AddDispatcher     ((G4DispatchFunction)XtDispatchEvent);
+}
+/***************************************************************************/
+G4Qt::~G4Qt (
+) 
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+  if(this==instance) {
+    instance = NULL;
+  }
+}
+/***************************************************************************/
+G4bool G4Qt::Inited (
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+  return QtInited;
+}
+/***************************************************************************/
+/**
+  Si j'ai bien compris, cette fonction ne sert à rien
+ */
+void* G4Qt::GetEvent (
+) 
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+//FIXME
+//   G4cout        << "G4Qt : Rien compris a cette fonction G4Qt::GetEvent." << G4endl;
+//  static XEvent  event;
+//  if(appContext==NULL) return NULL;
+//  if(mainApp==NULL) return NULL;
+//  QtAppNextEvent (appContext, &event);
+//  return         &event;
+  printf("*");
+  return 0;
+}
+/***************************************************************************/
+void G4Qt::FlushAndWaitExecution (
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+  //  printf("G4Qt::FlushAndWaitExecution ::  Flush ....\n");
+  if(!qApp) return;
+  qApp->processEvents();
+}
+
+#endif
+
+
