Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -49,6 +49,8 @@ private:
G4UIcommand* defaultIcons;
G4UIcommand* sys;
G4UIcommand* outputStyle;
G4UIcommand* nativeMenu;
G4UIcommand* clearMenu;
};
#endif
@@ -52,6 +52,8 @@ class G4VInteractiveSession
virtual void AddIcon (const char*,const char*,const char*,const char*);
virtual void DefaultIcons (bool);
virtual void OutputStyle (const char*,const char*,const char*);
virtual void NativeMenu (bool);
virtual void ClearMenu ();
void AddInteractor(G4String,G4Interactor);
G4Interactor GetInteractor(G4String);
+23 -22
View File
@@ -23,13 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4Win32
//
// Class description :
//
// To unify Windows message treatment between
// G4/interfaces Windows sessions and G4/visualizations Windows drivers.
// G.Barrand
// A singleton to handle GUI sessions and visualization
// drivers built over Windows. It allows to have one Windows main
// loop for the whole application.
// Unifies Windows message treatment between G4/interfaces Windows
// sessions and G4/visualizations Windows drivers.
// Original author: G.Barrand, 1998
// --------------------------------------------------------------------
#ifndef G4WIN32_HH
#define G4WIN32_HH
@@ -40,25 +45,21 @@
#include "G4VInteractorManager.hh"
// Class description :
//
// G4Win32 : a singleton to handle GUI sessions and visualization
// drivers built over Windows. It permits to have one Windows main
// loop for the whole application.
//
// Class description - end :
class G4Win32 : public G4VInteractorManager
{
public:
class G4Win32 : public G4VInteractorManager {
public:
static G4Win32* getInstance ();
G4bool Inited ();
void* GetEvent ();
void FlushAndWaitExecution ();
static G4bool DispatchWin32Event (void*);
virtual ~G4Win32 ();
private:
G4Win32();
static G4Win32* instance; // Pointer to single instance.
static G4Win32* getInstance ();
G4bool Inited ();
void* GetEvent ();
void FlushAndWaitExecution ();
static G4bool DispatchWin32Event (void*);
virtual ~G4Win32 ();
private:
G4Win32();
static G4Win32* instance; // Pointer to single instance.
};
#endif
-68
View File
@@ -1,68 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
// To unify Wt event treatment between
// G4/interfaces Wt sessions and G4/visualizations Wt drivers.
// L. Garnier
#ifndef G4WT_HH
#define G4WT_HH
#if defined(G4INTY_BUILD_WT) || defined(G4INTY_USE_WT)
#include "G4VInteractorManager.hh"
// Class description :
//
// G4Wt : a singleton to handle GUI sessions and visualization
// drivers built over Wt. It permits to have one Wt main loop for
// the whole application. The Wt toolkit is inited in the
// constructor. It is done once for the whole application.
//
// Class description - end :
#include <Wt/WServer>
class G4Wt : public G4VInteractorManager {
public:
static G4Wt* getInstance();
static G4Wt* getInstance(int,char**,char*);
Wt::WServer getServer();
G4bool Inited();
void* GetEvent();
void FlushAndWaitExecution();
virtual ~G4Wt();
private:
G4Wt (int,char**,char*);
static G4Wt* instance; // Pointer to single instance.
Wt::WServer *wServer;
int argn;
char** args;
};
#endif //HAS_WT
#endif
+17 -44
View File
@@ -1,11 +1,6 @@
#------------------------------------------------------------------------------
# Module : G4UIcommon
# Package: Geant4.src.G4interfaces.G4UIcommon
#------------------------------------------------------------------------------
# - G4UIcommon module build definition
#
# Module has optional sources
#
# List those always built
set(G4INTERFACES_COMMON_MODULE_HEADERS
@@ -21,40 +16,21 @@ set(G4INTERFACES_COMMON_MODULE_SOURCES
G4VInteractorManager.cc)
set(G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES )
set(G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS )
# 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)
# Must enable Qt source with a def...
add_definitions(-DG4INTY_BUILD_QT)
list(APPEND G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS G4INTY_BUILD_QT)
# It uses Qt core and gui(?) libs
list(APPEND G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES
Qt5::Gui Qt5::Core)
endif()
#
# Wt (deprecated)
#
#if(GEANT4_USE_WT)
# # Add the sources
# list(APPEND G4INTERFACES_COMMON_MODULE_HEADERS G4Wt.hh)
# list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Wt.cc)
#
# # Source needs to have a compile definition
# GEANT4_ADD_COMPILE_DEFINITIONS(
# SOURCES G4Wt.cc
# COMPILE_DEFINITIONS G4INTY_BUILD_WT
# )
#
# # It uses Wt libs
# list(APPEND G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES
# Wt::Wt Wt::HTTP)
#endif()
# Win32 option - always built when we're using MSVC
if(MSVC)
# Add the sources
@@ -62,7 +38,7 @@ if(MSVC)
list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Win32.cc)
# Add the needed compile definitions to these sources
add_definitions(-DG4INTY_BUILD_WIN32)
list(APPEND G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS G4INTY_BUILD_WIN32)
endif()
# X11 options - we only need this for Xm (and Inventor, which activates XM)
@@ -72,7 +48,7 @@ if(UNIX AND GEANT4_USE_XM)
list(APPEND G4INTERFACES_COMMON_MODULE_SOURCES G4Xt.cc)
# Source needs to have a compile definition
add_definitions(-DG4INTY_BUILD_XT)
list(APPEND G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS G4INTY_BUILD_XT)
# It uses the X11 libs?
list(APPEND G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES
@@ -80,22 +56,19 @@ if(UNIX AND GEANT4_USE_XM)
)
endif()
#
# Define the Geant4 Module.
#
geant4_define_module(NAME G4UIcommon
HEADERS
geant4_add_module(G4UIcommon
PUBLIC_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}
)
${G4INTERFACES_COMMON_MODULE_SOURCES})
# List any source specific properties here
geant4_module_compile_definitions(G4UIcommon
PRIVATE ${G4INTERFACES_COMMON_MODULE_COMPILE_DEFINITIONS})
geant4_module_link_libraries(G4UIcommon
PUBLIC
G4intercoms
G4globman
# These are PUBLIC until use in client code better understood
${G4INTERFACES_COMMON_MODULE_LINK_LIBRARIES})
@@ -146,10 +146,24 @@ G4InteractorMessenger::G4InteractorMessenger (
parameter->SetParameterCandidates("highlight no-highlight");
parameter->SetDefaultValue("highlight");
outputStyle->SetParameter (parameter);
// /gui/nativeMenuBar :
nativeMenu = new G4UIcommand("/gui/nativeMenuBar",this);
nativeMenu->SetGuidance("Allow native menu bar in Geant4 Qt driver.");
nativeMenu->SetGuidance("By default, enable.");
parameter = new G4UIparameter("bool",'b',true);
parameter->SetDefaultValue("true");
nativeMenu->SetParameter (parameter);
// /gui/clearMenu
clearMenu = new G4UIcommand("/gui/clearMenu",this);
clearMenu->SetGuidance("Clear menu bar, remove all user defined menu entries.");
}
G4InteractorMessenger::~G4InteractorMessenger()
{
delete clearMenu;
delete nativeMenu;
delete outputStyle;
delete sys;
delete defaultIcons;
@@ -180,6 +194,10 @@ void G4InteractorMessenger::SetNewValue (
if ( rc < 0 ){ }
} else if(command==outputStyle) {
session->OutputStyle((const char*)params[0],(const char*)params[1],(const char*)params[2]);
} else if(command==nativeMenu) {
session->NativeMenu(command->ConvertToBool(newValue));
} else if(command==clearMenu) {
session->ClearMenu();
}
}
delete [] params;
@@ -66,6 +66,16 @@ void G4VInteractiveSession::OutputStyle(const char*,const char*,const char*)
{
}
/***************************************************************************/
void G4VInteractiveSession::NativeMenu (bool)
{
}
/***************************************************************************/
void G4VInteractiveSession::ClearMenu ()
{
}
/***************************************************************************/
void G4VInteractiveSession::AddInteractor (G4String a_name,
G4Interactor a_interactor)
+16 -9
View File
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4Win32 implementation
//
//
// G.Barrand
// Original author: G.Barrand, 1998
// --------------------------------------------------------------------
#if defined(G4INTY_BUILD_WIN32) || defined(G4INTY_USE_WIN32)
@@ -72,15 +73,21 @@ G4Win32::G4Win32 (
wc.lpszClassName = className;
::RegisterClass (&wc);
topWindow = ::CreateWindow(className,className,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
NULL, NULL,
::GetModuleHandle(NULL),
NULL);
topWindow = ::CreateWindowEx(WS_EX_CLIENTEDGE,
className,
"Test",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
::GetModuleHandle(NULL),
NULL);
if(topWindow==NULL) {
G4cout << "G4Win32 : Unable to create Win32 window." << G4endl;
G4cout << "G4Win32: Unable to create Win32 window." << G4endl;
}
Win32Inited = TRUE;
-205
View File
@@ -1,205 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
// L. Garnier
#if defined(G4INTY_BUILD_WT) || defined(G4INTY_USE_WT)
#include <stdlib.h>
#include <string.h>
#include "G4ios.hh"
#include "G4Wt.hh"
#include <Wt/WApplication>
#include <Wt/WEnvironment>
G4Wt* G4Wt::instance = NULL;
static G4bool WtInited = FALSE;
/***************************************************************************/
G4Wt* G4Wt::getInstance (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
return G4Wt::getInstance (0,NULL,(char*)"Geant4");
}
/***************************************************************************/
G4Wt* G4Wt::getInstance (
int a_argn
,char** a_args
,char* a_class
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
if (instance==NULL) {
instance = new G4Wt(a_argn,a_args,a_class);
}
return instance;
}
/***************************************************************************/
G4Wt::G4Wt (
int a_argn
,char** a_args
,char* /*a_class */
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
argn = 0;
args = NULL;
#ifdef G4DEBUG_INTERFACES_COMMON
printf("G4Wt::G4Wt try to inited Wt\n");
#endif
// Check if Wt already init in another external app
if(wApp) {
WtInited = TRUE;
SetMainInteractor (wServer);
//#endif
SetArguments (a_argn,a_args);
#ifdef G4DEBUG_INTERFACES_COMMON
printf("G4Wt::G4Wt alredy inited in external \n");
#endif
} else {
if(WtInited==FALSE) { //Wt 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;
#ifdef G4DEBUG_INTERFACES_COMMON
printf("G4Wt::G4Wt WAppl \n");
#endif
Wt::WApplication:: instance();
////
//WApplication (*p_argn, args);
if(!wApp) {
G4cout << "G4Wt : Unable to init Wt." << G4endl;
} else {
WtInited = TRUE;
if (a_argn != 0) {
#ifdef G4DEBUG_INTERFACES_COMMON
printf("G4Wt::G4Wt SetMainInteractor\n");
#endif
// SetMainInteractor ();
}
SetArguments (a_argn,a_args);
#ifdef G4DEBUG_INTERFACES_COMMON
printf("G4Wt::G4Wt inited Wt END\n");
#endif
}
}
}
#ifdef G4DEBUG_INTERFACES_COMMON
if (wApp) {
printf("G4Wt::wApp already exist\n");
} else {
printf("G4Wt::wApp not exist\n");
}
#endif
// AddDispatcher ((G4DispatchFunction)XtDispatchEvent);
DisableSecondaryLoop ();
}
/***************************************************************************/
G4Wt::~G4Wt (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
if(this==instance) {
instance = NULL;
}
}
/***************************************************************************/
G4bool G4Wt::Inited (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
return WtInited;
}
/***************************************************************************/
void* G4Wt::GetEvent (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
//FIXME
// G4cout << "G4Wt : Rien compris a cette fonction G4Wt::GetEvent." << G4endl;
// static XEvent event;
// if(appContext==NULL) return NULL;
// if(mainApp==NULL) return NULL;
// WtAppNextEvent (appContext, &event);
// return &event;
printf("*");
return 0;
}
/***************************************************************************/
void G4Wt::FlushAndWaitExecution (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
// printf("G4Wt::FlushAndWaitExecution :: Flush ....\n");
if(!wApp) return;
// wApp->processEvents();
}
#endif