Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
+5 -16
View File
@@ -77,9 +77,6 @@ if(GEANT4_USE_QT)
list(APPEND G4INTERFACES_BASIC_MODULE_HEADERS G4UIQt.hh)
list(APPEND G4INTERFACES_BASIC_MODULE_SOURCES G4UIQt.cc)
# Now need to add Qt in to build moc wrappers
include(${QT_USE_FILE})
# Add the moc sources - must use an absolute path to the files being
# wrapped
QT4_WRAP_CPP(G4INTERFACES_MOC_SOURCES
@@ -111,18 +108,12 @@ if(GEANT4_USE_WT)
list(APPEND G4INTERFACES_BASIC_MODULE_HEADERS G4UIWt.hh)
list(APPEND G4INTERFACES_BASIC_MODULE_SOURCES G4UIWt.cc)
# Must have Wt includes...
include_directories(${Wt_INCLUDE_DIR})
# Add the definitions
# We have to also add in G4INTY_BUILD_Wt 'cause G4Wt header needs that...
GEANT4_ADD_COMPILE_DEFINITIONS(SOURCES G4UIWt.cc G4UIExecutive.cc
COMPILE_DEFINITIONS G4UI_BUILD_WT_SESSION;G4INTY_BUILD_WT)
# Add the extra libraries - seem to need to quote variables to get
# both linked in.
list(APPEND G4INTERFACES_BASIC_MODULE_LINK_LIBRARIES
"${Wt_LIBRARY}")
# Add the extra libraries
list(APPEND G4INTERFACES_BASIC_MODULE_LINK_LIBRARIES Wt::Wt Wt::HTTP)
endif()
@@ -134,10 +125,6 @@ if(UNIX)
list(APPEND G4INTERFACES_BASIC_MODULE_HEADERS G4UIXm.hh)
list(APPEND G4INTERFACES_BASIC_MODULE_SOURCES G4UIXm.cc)
# Need the X11 and XM headers
include_directories(${X11_INCLUDE_DIR})
include_directories(${MOTIF_INCLUDE_DIR})
# Add the compile definitions - also need INTY versions
GEANT4_ADD_COMPILE_DEFINITIONS(
SOURCES G4UIXm.cc G4UIExecutive.cc
@@ -146,7 +133,8 @@ if(UNIX)
# Need the X11 and Motif libraries
list(APPEND G4INTERFACES_BASIC_MODULE_LINK_LIBRARIES
"${MOTIF_LIBRARIES};${X11_LIBRARIES}"
Motif::Xm
X11::SM X11::ICE X11::X11 X11::Xext X11::Xmu X11::Xt
)
endif()
endif()
@@ -169,6 +157,7 @@ GEANT4_DEFINE_MODULE(NAME G4UIbasic
G4intercoms
LINK_LIBRARIES
${G4INTERFACES_BASIC_MODULE_LINK_LIBRARIES}
${timemory_LIBRARIES}
)
# List any source specific properties here
+11 -7
View File
@@ -49,6 +49,7 @@
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "G4UIcsh.hh"
#include "G4TiMemory.hh"
// --------------------------------------------------------------------------
// build flags as variables
@@ -142,6 +143,7 @@ G4UIExecutive::G4UIExecutive(G4int argc, char** argv, const G4String& type)
DISCARD_PARAMETER(argc);
DISCARD_PARAMETER(argv);
session = new G4UIWin32();
isGUI = true;
#endif
break;
case kWt:
@@ -188,6 +190,8 @@ G4UIExecutive::G4UIExecutive(G4int argc, char** argv, const G4String& type)
shell = new G4UIcsh;
session = new G4UIterminal(shell);
}
TIMEMORY_INIT(argc, argv);
}
// --------------------------------------------------------------------------
@@ -211,18 +215,18 @@ void G4UIExecutive::SelectSessionByArg(const G4String& stype)
// --------------------------------------------------------------------------
void G4UIExecutive::SelectSessionByEnv()
{
if ( qt_build && getenv("G4UI_USE_QT") ) selected = kQt;
else if ( xm_build && getenv("G4UI_USE_XM") ) selected = kXm;
else if ( win32_build && getenv("G4UI_USE_WIN32") ) selected = kWin32;
else if ( wt_build && getenv("G4UI_USE_WT") ) selected = kWt;
else if ( getenv("G4UI_USE_GAG") ) selected = kGag;
else if ( tcsh_build && getenv("G4UI_USE_TCSH") ) selected = kTcsh;
if ( qt_build && std::getenv("G4UI_USE_QT") ) selected = kQt;
else if ( xm_build && std::getenv("G4UI_USE_XM") ) selected = kXm;
else if ( win32_build && std::getenv("G4UI_USE_WIN32") ) selected = kWin32;
else if ( wt_build && std::getenv("G4UI_USE_WT") ) selected = kWt;
else if ( std::getenv("G4UI_USE_GAG") ) selected = kGag;
else if ( tcsh_build && std::getenv("G4UI_USE_TCSH") ) selected = kTcsh;
}
// --------------------------------------------------------------------------
void G4UIExecutive::SelectSessionByFile(const G4String& appname)
{
const char* path = getenv("HOME");
const char* path = std::getenv("HOME");
if( path == NULL ) return;
G4String homedir = path;
+66 -19
View File
@@ -55,7 +55,9 @@
#include <qdialog.h>
#include <qevent.h>
#include <qtextedit.h>
#if QT_VERSION < 0x050600
#include <qsignalmapper.h>
#endif
#include <qtabwidget.h>
#include <qtabbar.h>
#include <qstringlist.h>
@@ -72,7 +74,6 @@
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <qcombobox.h>
#include <qsignalmapper.h>
#include <qpainter.h>
#include <qcolordialog.h>
#include <qtoolbar.h>
@@ -320,11 +321,15 @@ void G4UIQt::SetDefaultIconsToolbar(
AddIcon("Save viewer state", "save", "/vis/viewer/save");
// View parameters
#if QT_VERSION < 0x050600
QSignalMapper *signalMapperViewerProperties = new QSignalMapper(this);
QAction *actionViewerProperties = fToolbarApp->addAction(QIcon(*fParamIcon),"Viewer properties", signalMapperViewerProperties, SLOT(map()));
connect(signalMapperViewerProperties, SIGNAL(mapped(int)),this, SLOT(ViewerPropertiesIconCallback(int)));
int intVP = 0;
signalMapperViewerProperties->setMapping(actionViewerProperties, intVP);
#else
fToolbarApp->addAction(QIcon(*fParamIcon),"Viewer properties", this, [=](){ this->ViewerPropertiesIconCallback(0); });
#endif
// Cursors style icons
AddIcon("Move", "move", "");
@@ -1457,10 +1462,6 @@ G4UIDockWidget* G4UIQt::CreateCoutTBWidget(
fCoutTBTextArea = new QTextEdit();
// set font familly and size
fCoutTBTextArea->setFontFamily("Courier");
fCoutTBTextArea->setFontPointSize(12);
fCoutFilter = new QLineEdit();
fCoutFilter->setToolTip("Filter output by...");
@@ -1917,8 +1918,6 @@ G4UIsession* G4UIQt::SessionStart (
/** Display the prompt in the prompt area
@param aPrompt : string to display as the promt label
//FIXME : probablement inutile puisque le seul a afficher qq chose d'autre
que "session" est SecondaryLoop()
*/
void G4UIQt::Prompt (
G4String aPrompt
@@ -2237,11 +2236,16 @@ void G4UIQt::AddButton (
}
}
#if QT_VERSION < 0x050600
QSignalMapper *signalMapper = new QSignalMapper(this);
QAction *action = parentTmp->addAction(aLabel, signalMapper, SLOT(map()));
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ButtonCallback(const QString&)));
signalMapper->setMapping(action, QString(aCommand));
#else
QString cmd_tmp = QString(aCommand);
parentTmp->addAction(aLabel, this, [=](){ this->ButtonCallback(cmd_tmp); });
#endif
}
@@ -2345,20 +2349,29 @@ void G4UIQt::AddIcon(const char* aLabel, const char* aIconFile, const char* aCom
}
}
#if QT_VERSION < 0x050600
QSignalMapper *signalMapper = new QSignalMapper(this);
QAction *action = currentToolbar->addAction(QIcon(*pix),aLabel, signalMapper, SLOT(map()));
#endif
// special cases :"open"
if (std::string(aIconFile) == "open") {
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(OpenIconCallback(const QString &)));
QString txt = aCommand + fStringSeparator + aLabel;
#if QT_VERSION < 0x050600
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(OpenIconCallback(const QString &)));
signalMapper->setMapping(action, QString(txt));
#else
currentToolbar->addAction(QIcon(*pix), aIconFile, this, [=](){ this->OpenIconCallback(txt); });
#endif
// special cases :"save"
} else if (std::string(aIconFile) == "save") {
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(SaveIconCallback(const QString&)));
QString txt = aCommand + fStringSeparator + aLabel;
#if QT_VERSION < 0x050600
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(SaveIconCallback(const QString&)));
signalMapper->setMapping(action, QString(txt));
#else
currentToolbar->addAction(QIcon(*pix), aIconFile, this, [=](){ this->SaveIconCallback(txt); });
#endif
// special cases : cursor style
} else if ((std::string(aIconFile) == "move") ||
@@ -2366,13 +2379,17 @@ void G4UIQt::AddIcon(const char* aLabel, const char* aIconFile, const char* aCom
(std::string(aIconFile) == "pick") ||
(std::string(aIconFile) == "zoom_out") ||
(std::string(aIconFile) == "zoom_in")) {
#if QT_VERSION < 0x050600
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ChangeCursorAction(const QString&)));
signalMapper->setMapping(action, QString(aIconFile));
#else
QString txt = QString(aIconFile);
QAction* action = currentToolbar->addAction(QIcon(*pix), aIconFile, this, [=](){ this->ChangeCursorAction(txt); });
#endif
action->setCheckable(TRUE);
action->setChecked(TRUE);
action->setData(aIconFile);
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ChangeCursorAction(const QString&)));
signalMapper->setMapping(action, QString(aIconFile));
if (std::string(aIconFile) == "move") {
SetIconMoveSelected();
}
@@ -2394,11 +2411,16 @@ void G4UIQt::AddIcon(const char* aLabel, const char* aIconFile, const char* aCom
(std::string(aIconFile) == "hidden_line_and_surface_removal") ||
(std::string(aIconFile) == "solid") ||
(std::string(aIconFile) == "wireframe")) {
#if QT_VERSION < 0x050600
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ChangeSurfaceStyle(const QString&)));
signalMapper->setMapping(action, QString(aIconFile));
#else
QString txt = QString(aIconFile);
QAction* action = currentToolbar->addAction(QIcon(*pix), aIconFile, this, [=](){ this->ChangeSurfaceStyle(txt); });
#endif
action->setCheckable(TRUE);
action->setChecked(TRUE);
action->setData(aIconFile);
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ChangeSurfaceStyle(const QString&)));
signalMapper->setMapping(action, QString(aIconFile));
if (std::string(aIconFile) == "hidden_line_removal") {
SetIconHLRSelected();
@@ -2416,11 +2438,16 @@ void G4UIQt::AddIcon(const char* aLabel, const char* aIconFile, const char* aCom
// special case : perspective/ortho
} else if ((std::string(aIconFile) == "perspective") ||
(std::string(aIconFile) == "ortho")) {
#if QT_VERSION < 0x050600
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ChangePerspectiveOrtho(const QString&)));
signalMapper->setMapping(action, QString(aIconFile));
#else
QString txt = QString(aIconFile);
QAction* action = currentToolbar->addAction(QIcon(*pix), aIconFile, this, [=](){ this->ChangePerspectiveOrtho(txt); });
#endif
action->setCheckable(TRUE);
action->setChecked(TRUE);
action->setData(aIconFile);
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ChangePerspectiveOrtho(const QString&)));
signalMapper->setMapping(action, QString(aIconFile));
if (std::string(aIconFile) == "perspective") {
SetIconPerspectiveSelected();
@@ -2452,8 +2479,13 @@ void G4UIQt::AddIcon(const char* aLabel, const char* aIconFile, const char* aCom
}
}
#if QT_VERSION < 0x050600
connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ButtonCallback(const QString&)));
signalMapper->setMapping(action, QString(aCommand));
#else
QString txt = QString(aCommand);
currentToolbar->addAction(QIcon(*pix), aCommand, this, [=](){ this->ButtonCallback(txt); });
#endif
}
}
@@ -2957,11 +2989,14 @@ bool G4UIQt::CreateCommandWidget(G4UIcommand* aCommand, QWidget* aParent, bool i
gridLayout->addWidget(input,i_thParameter-nbColorParameter,1);
// Connect pushButton to ColorDialog in callback
#if QT_VERSION < 0x050600
QSignalMapper* signalMapper = new QSignalMapper(this);
signalMapper->setMapping(input,input);
connect(input, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(signalMapper, SIGNAL(mapped(QWidget*)),this, SLOT(ChangeColorCallback(QWidget*)));
#else
connect(dynamic_cast<QPushButton*>(input), &QPushButton::clicked , [=](){ this->ChangeColorCallback(input);});
#endif
isColorDialogAdded = true;
isStillColorParameter = false;
}
@@ -2981,10 +3016,14 @@ bool G4UIQt::CreateCommandWidget(G4UIcommand* aCommand, QWidget* aParent, bool i
gridLayout->addWidget(applyButton,n_parameterEntry-nbColorParameter,1);
#if QT_VERSION < 0x050600
QSignalMapper* signalMapper = new QSignalMapper(this);
signalMapper->setMapping(applyButton, paramWidget);
connect(applyButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(signalMapper, SIGNAL(mapped(QWidget*)),this, SLOT(VisParameterCallback(QWidget*)));
#else
connect(applyButton, &QPushButton::clicked , [=](){ this->VisParameterCallback(paramWidget);});
#endif
} else {
// Apply/Cancel buttons
@@ -2996,10 +3035,14 @@ bool G4UIQt::CreateCommandWidget(G4UIcommand* aCommand, QWidget* aParent, bool i
gridLayout->addWidget(cancelButton,n_parameterEntry-nbColorParameter,1);
gridLayout->addWidget(applyButton,n_parameterEntry-nbColorParameter,0);
#if QT_VERSION < 0x050600
QSignalMapper* signalMapper = new QSignalMapper(this);
signalMapper->setMapping(applyButton, paramWidget);
connect(applyButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
connect(signalMapper, SIGNAL(mapped(QWidget*)),this, SLOT(VisParameterCallback(QWidget*)));
#else
connect(applyButton, &QPushButton::clicked , [=](){ this->VisParameterCallback(paramWidget);});
#endif
QWidget * parentCheck = aParent;
QDialog* parentDialog = NULL;
@@ -3569,7 +3612,11 @@ QStandardItemModel* G4UIQt::CreateCompleterModel(G4String aCmd) {
// parameters
for( G4int a=0; a<n_parameterEntry; a++ ) {
param = command->GetParameter(a);
params += "<" + param->GetParameterName()+"> ";
if (param->IsOmittable()) {
params += "[<" + param->GetParameterName()+">] ";
} else {
params += "<" + param->GetParameterName()+"> ";
}
}
nMatch++;
+2 -8
View File
@@ -23,15 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G.Barrand
//#define DEBUG
// Author: G.Barrand
// --------------------------------------------------------------------
#ifdef G4UI_BUILD_WIN32_SESSION
// this :
#include "G4UIWin32.hh"
#include <string.h>
@@ -40,8 +36,6 @@
#include <windowsx.h>
#include <wingdi.h>
#include <strstream>
#include "G4UImanager.hh"
#include "G4StateManager.hh"
#include "G4UIcommandTree.hh"
+1 -1
View File
@@ -89,7 +89,7 @@ G4UIXm::G4UIXm (
Widget top = (Widget)interactorManager->GetMainInteractor();
if(getenv("XENVIRONMENT")==NULL) {
if(std::getenv("XENVIRONMENT")==NULL) {
XrmDatabase database = XrmGetDatabase(XtDisplay(top));
if(database!=NULL) {
XrmPutLineResource(&database,"*topShadowColor:white");
+2 -2
View File
@@ -73,7 +73,7 @@ G4UItcsh::G4UItcsh(const G4String& prompt, G4int maxhist)
tcgetattr(0, &tios);
// read a shell history file
const char* path = getenv("HOME");
const char* path = std::getenv("HOME");
if( path == NULL ) return;
G4String homedir= path;
@@ -99,7 +99,7 @@ G4UItcsh::~G4UItcsh()
/////////////////////
{
// store a shell history
const char* path = getenv("HOME");
const char* path = std::getenv("HOME");
if( path == NULL ) return;
G4String homedir= path;