Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010-09-29 18:45:55 bmorgan Exp $
# $Id: CMakeLists.txt 66892 2013-01-17 10:57:59Z gunter $
#
#------------------------------------------------------------------------------
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.8 2010-12-23 14:09:53 lgarnier Exp $
# $Id: GNUmakefile 66892 2013-01-17 10:57:59Z gunter $
# -------------------------------------------------------------
# GNUmakefile for interfaces/basic library. John Allison, 6/7/98.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIArrayString.hh 66892 2013-01-17 10:57:59Z gunter $
//
#ifndef G4UIArrayString_h
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4UIExecutive.hh 66892 2013-01-17 10:57:59Z gunter $
//
// ====================================================================
// G4UIExecutive.hh
+37 -15
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIQt.hh 76743 2013-11-14 15:48:22Z gcosmo $
//
#ifndef G4UIQt_h
#define G4UIQt_h
@@ -78,13 +78,22 @@ class QToolBar;
class G4QTabWidget : public QTabWidget {
public :
G4QTabWidget();
G4QTabWidget(QSplitter*&);
G4QTabWidget(QWidget* aParent, int sizeX, int sizeY);
void paintEvent ( QPaintEvent * event );
inline void setTabSelected(bool a) { tabSelected = a; };
inline void setLastTabCreated(int a) { lastCreated = a; };
inline bool isTabSelected() { return tabSelected; };
bool tabSelected;
int lastCreated;
inline void setTabSelected(bool a) { fTabSelected = a; };
inline void setLastTabCreated(int a) { fLastCreated = a; };
inline bool isTabSelected() { return fTabSelected; };
bool fTabSelected;
int fLastCreated;
int fPreferedSizeX;
int fPreferedSizeY;
inline void setPreferredSize(QSize s) {
fPreferedSizeX = s.width() + 6; // tab label height + margin left+right
fPreferedSizeY = s.height() + 58; // margin left+right
}
inline QSize sizeHint () const {
return QSize(fPreferedSizeX, fPreferedSizeY);
}
};
class G4UIQt : public QObject, public G4VBasicShell, public G4VInteractiveSession {
@@ -109,8 +118,9 @@ public: // With description
void AddIcon(const char* userLabel, const char* iconFile, const char* command, const char* file_name="");
// To add a icon in the toolbar
// First argument is the label of the icon.
// Second argument is the icon file.
// Second argument is the selected icon type (open save move rotate pick zoom_in zoom_out wireframe solid hidden_line_removal hidden_line_and_surface_removal perspective ortho user_icon).
// Third argument is the Geant4 command executed when the button is fired.
// Fourth argument is the path to the icon file if "user_icon" selected
// Ex : AddButton("change background color","../background.xpm"," /vis/viewer/set/background");
bool AddTabWidget(QWidget*,QString,int,int);
@@ -149,6 +159,10 @@ public: // With description
void SetIconPerspectiveSelected();
void SetIconOrthoSelected();
inline QMainWindow * GetMainWindow() {
return fMainWindow;
};
public:
~G4UIQt();
void Prompt(G4String);
@@ -175,10 +189,14 @@ private:
void ActivateCommand(G4String);
QMap<int,QString> LookForHelpStringInChildTree(G4UIcommandTree *,const QString&);
void CreateVisParametersTBWidget();
void CreateHelpTBWidget();
void CreateCoutTBWidget();
void CreateHistoryTBWidget();
QWidget* CreateVisParametersTBWidget();
QWidget* CreateHelpTBWidget();
QWidget* CreateCoutTBWidget();
QWidget* CreateHistoryTBWidget();
QWidget* CreateUITabWidget();
QWidget* CreateSceneTreeComponentsTBWidget();
QWidget* CreateRightSplitterWidget();
QWidget* CreateLeftSplitterWidget();
void OpenHelpTreeOnCommand(const QString &);
QString GetShortCommandPath(QString);
QString GetLongCommandPath(QTreeWidgetItem*);
@@ -209,13 +227,16 @@ private:
QLabel *fEmptyViewerTabLabel;
QSplitter * fMainSplitterWidget;
QSplitter* fRightSplitterWidget;
QWidget* fLeftSplitterWidget;
QSplitter * fHelpVSplitter;
int fLastQTabSizeX;
int fLastQTabSizeY;
QWidget* fViewerTabHandleWidget;
QToolBar *fToolbarApp;
QToolBar *fToolbarUser;
QString fStringSeparator;
G4String fLastErrMessage;
QString fLastOpenPath;
bool fMoveSelected;
bool fRotateSelected;
bool fPickSelected;
@@ -226,6 +247,7 @@ private Q_SLOTS :
void ExitSession();
void ClearButtonCallback();
void CommandEnteredCallback();
void CommandEditedCallback(const QString & text);
void ButtonCallback(const QString&);
void HelpTreeClicCallback();
void HelpTreeDoubleClicCallback();
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIWin32.hh 66892 2013-01-17 10:57:59Z gunter $
//
#ifndef G4UIWin32_h
#define G4UIWin32_h
+263
View File
@@ -0,0 +1,263 @@
//
// ********************************************************************
// * 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: G4UIWt.hh,v 1.23 2010-06-10 15:37:13 lgarnier Exp $
//
#ifndef G4UIWt_h
#define G4UIWt_h
#if defined(G4UI_BUILD_WT_SESSION) || defined(G4UI_USE_WT)
#include <map>
#include "G4VBasicShell.hh"
#include "G4VInteractiveSession.hh"
#include <Wt/WObject>
#include <Wt/WWidget>
#include <Wt/WPushbutton>
#include <Wt/WTree>
#include <Wt/WTreeNode>
#include <Wt/WMenu>
#include <Wt/WTabWidget>
#include <Wt/WStringListModel>
class G4UIsession;
// Class description :
//
// G4UIWt : class to handle a Wt interactive session.
// G4UIWt is the Wt version of G4UIterminal.
//
// A command box is at disposal for entering/recalling Geant4 commands.
// A menubar could be customized through the AddMenu, AddButton, AddIcon methods.
// Note that there are corresponding Geant4 commands to add a
// menus in the menubar and add buttons in a menu.
// Ex :
// /gui/addMenu test Test
// /gui/addButton test Init /run/initialize
// /gui/addButton test "Set gun" "/control/execute gun.g4m"
// /gui/addButton test "Run one event" "/run/beamOn 1"
//
// Command completion, by typing "tab" key, is available on the
// command line.
//
// Class description - end :
class G4WTabWidget : public Wt::WTabWidget {
public :
G4WTabWidget();
G4WTabWidget(Wt::WContainerWidget*&);
inline void setTabSelected(bool a) { tabSelected = a; };
inline void setLastTabCreated(int a) { lastCreated = a; };
inline bool isTabSelected() { return tabSelected; };
bool tabSelected;
int lastCreated;
int incTabPaint;
};
class G4UIWt : public Wt::WObject, public G4VBasicShell, public G4VInteractiveSession {
public: // With description
G4UIWt(int,char**);
// (argv, argc) or (0, NULL) had to be given.
G4UIsession* SessionStart();
// To enter interactive Wt loop ; waiting/executing command,...
void AddMenu(const char*,const char*);
// To add a pulldown menu in the menu bar.
// First argument is the name of the menu.
// Second argument is the label of the cascade button.
// Ex : AddMenu("my_menu","My menu")
void AddButton(const char*,const char*,const char*);
// To add a push button in a pulldown menu.
// First argument is the name of the menu.
// Second argument is the label of the button.
// Third argument is the Geant4 command executed when the button is fired.
// Ex : AddButton("my_menu","Run","/run/beamOn 1");
void AddIcon(const char* userLabel, const char* iconFile, const char* command, const char* file_name="");
// To add a icon in the toolbar
// First argument is the label of the icon.
// Second argument is the selected icon type (open save move rotate pick zoom_in zoom_out wireframe solid hidden_line_removal hidden_line_and_surface_removal perspective ortho user_icon).
// Third argument is the Geant4 command executed when the button is fired.
// Fourth argument is the path to the icon file if "user_icon" selected
// Ex : AddButton("change background color","../background.xpm"," /vis/viewer/set/background");
bool AddTabWidget( Wt::WWidget*, Wt::WString,int,int);
// To add a tab for vis openGL Qt driver
Wt::WTabWidget* GetSceneTreeComponentsTBWidget();
// Get the viewComponent
bool IsSplitterReleased();
inline bool IsIconMoveSelected() {
return fMoveSelected;
};
inline bool IsIconRotateSelected() {
return fRotateSelected;
};
inline bool IsIconPickSelected() {
return fPickSelected;
};
inline bool IsIconZoomInSelected() {
return fZoomInSelected;
};
inline bool IsIconZoomOutSelected() {
return fZoomOutSelected;
};
/* void SetIconMoveSelected();
void SetIconRotateSelected();
void SetIconPickSelected();
void SetIconZoomInSelected();
void SetIconZoomOutSelected();
void SetIconHLHSRSelected();
void SetIconHLRSelected();
void SetIconSolidSelected();
void SetIconWireframeSelected();
void SetIconPerspectiveSelected();
void SetIconOrthoSelected();
*/
inline Wt::WContainerWidget * GetMainWindow() {
return fMainWindow;
};
public:
~G4UIWt();
void Prompt(G4String);
void SessionTerminate();
virtual void PauseSessionStart(const G4String&);
virtual G4int ReceiveG4cout(const G4String&);
virtual G4int ReceiveG4cerr(const G4String&);
// G4String GetCommand(Widget);
private:
void SecondaryLoop(G4String); // a VIRER
void CreateHelpWidget();
void InitHelpTreeAndVisParametersWidget();
void FillHelpTree();
virtual void ExitHelp() const;
void CreateHelpTree( Wt::WTreeNode*,G4UIcommandTree*);
Wt::WTreeNode* FindTreeItem( Wt::WTreeNode *,const std::string&);
Wt::WString GetCommandList(const G4UIcommand*);
virtual G4bool GetHelpChoice(G4int&);// have to be implemeted because we heritate from G4VBasicShell
bool eventFilter(Wt::WObject*,Wt::WEvent*);
void ActivateCommand(G4String);
// QMap<int,Wt::WString> LookForHelpStringInChildTree(G4UIcommandTree *,const Wt::WString&);
Wt::WContainerWidget* CreateVisParametersTBWidget();
Wt::WWidget* CreateHelpTBWidget();
Wt::WWidget* CreateCoutTBWidget();
Wt::WWidget* CreateHistoryTBWidget();
Wt::WWidget* CreateUITabWidget();
Wt::WWidget* CreateSceneTreeComponentsTBWidget();
Wt::WContainerWidget* CreateRightSplitterWidget();
Wt::WContainerWidget* CreateLeftSplitterWidget();
void OpenHelpTreeOnCommand(const Wt::WString &);
Wt::WString GetShortCommandPath(const std::string & );
Wt::WString GetLongCommandPath( Wt::WTreeNode*);
G4bool IsGUICommand(const G4UIcommand*);
bool CreateVisCommandGroupAndToolBox(G4UIcommand*, Wt::WWidget*, int, bool isDialog);
bool CreateCommandWidget(G4UIcommand* command, Wt::WContainerWidget* parent, bool isDialog);
private:
Wt::WContainerWidget * fMainWindow;
Wt::WLabel *fCommandLabel;
Wt::WLineEdit * fCommandArea;
Wt::WTextArea *fCoutTBTextArea;
Wt::WTextArea *fHelpArea;
Wt::WTabWidget* fUITabWidget;
Wt::WStringListModel fG4cout;
Wt::WLineEdit * fCoutFilter;
Wt::WSelectionBox *fHistoryTBTableList;
Wt::WTree *fHelpTreeWidget;
Wt::WPanel* fHelpTBWidget;
Wt::WPanel* fHistoryTBWidget;
Wt::WPanel* fCoutTBWidget;
Wt::WTabWidget* fSceneTreeComponentsTBWidget;
Wt::WLineEdit* fHelpLine;
G4WTabWidget* fViewerTabWidget;
Wt::WString fCoutText;
Wt::WLabel *fEmptyViewerTabLabel;
Wt::WContainerWidget* fMainSplitterWidget;
Wt::WContainerWidget* fRightSplitterWidget;
Wt::WContainerWidget* fLeftSplitterWidget;
Wt::WContainerWidget* fHelpVSplitter;
Wt::WToolBar *fToolbarApp;
Wt::WToolBar *fToolbarUser;
Wt::WString fStringSeparator;
G4String fLastErrMessage;
Wt::WString fLastOpenPath;
bool fMoveSelected;
bool fRotateSelected;
bool fPickSelected;
bool fZoomInSelected;
bool fZoomOutSelected;
G4bool fExitSession;
G4bool fExitPause;
private :
void ExitSession();
void ClearButtonCallback();
void CommandEnteredCallback();
void CommandEditedCallback(const Wt::WString & text);
void ButtonCallback(const char*);
void HelpTreeClicCallback();
void HelpTreeDoubleClicCallback();
void ShowHelpCallback();
void CommandHistoryCallback();
void LookForHelpStringCallback();
void CurrentChangedTabWidgetCallback(int);
void CoutFilterCallback(const Wt::WString&);
void TabCloseCallback(int);
void ToolBoxActivated(int);
void VisParameterCallback(Wt::WContainerWidget*);
void ChangeColorCallback(Wt::WContainerWidget*);
void ChangeCursorStyle(const Wt::WString&);
void ChangeSurfaceStyle(const Wt::WString&);
void OpenIconCallback(const Wt::WString&);
void SaveIconCallback(const Wt::WString&);
void ChangePerspectiveOrthoCallback(const Wt::WString&);
};
#endif
#endif
@@ -1,77 +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. *
// ********************************************************************
//
//
// $Id$
//
#ifndef G4UIXaw_h
#define G4UIXaw_h
#if defined(G4UI_BUILD_XAW_SESSION) || defined(G4UI_USE_XAW)
#include <X11/Intrinsic.h>
#include "G4VBasicShell.hh"
class G4UIsession;
class G4UImanager;
// Class description :
//
// G4UIXaw : class to handle an interactive session.
// G4UIXaw is the "Athena" version of G4UIterminal.
// It has been provided at a time where no free Motif
// where available. Now that some exists (lesstif),
// G4UIXm should be prefered. The look and feel of
// G4UIXaw is hugly...
//
// No command completion is available.
//
// Class description - end :
class G4UIXaw : public G4VBasicShell {
public:
G4UIXaw(int,char**);
~G4UIXaw();
G4UIsession* SessionStart();
void Prompt(const G4String&);
void SessionTerminate();
virtual void PauseSessionStart(const G4String&);
Widget GetDialog();
private:
void SecondaryLoop(G4String);
virtual G4bool GetHelpChoice(G4int&);
virtual void ExitHelp() const;
private:
Widget shell,dialog;
G4bool fHelp;
G4int fHelpChoice;
static void Callback(Widget,XtPointer,XtPointer);
};
#endif
#endif
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIXm.hh 66892 2013-01-17 10:57:59Z gunter $
//
#ifndef G4UIXm_h
#define G4UIXm_h
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcsh.hh 66892 2013-01-17 10:57:59Z gunter $
//
#ifndef G4UIcsh_h
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UItcsh.hh 66892 2013-01-17 10:57:59Z gunter $
//
#ifndef G4UItcsh_h
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4UIterminal.hh 66892 2013-01-17 10:57:59Z gunter $
//
// ====================================================================
// G4UIterminal.cc
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VUIshell.hh 66892 2013-01-17 10:57:59Z gunter $
//
#ifndef G4VUIshell_h
+23 -2
View File
@@ -11,8 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.4 2010-11-29 17:04:04 bmorgan Exp $
# GEANT4 Tag $Name: not supported by cvs2svn $
# $Id: sources.cmake 75000 2013-10-25 10:58:17Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -106,6 +105,28 @@ if(GEANT4_USE_QT)
endif()
#
# Wt only if selected.
#
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}")
endif()
#
# Xm and only on UNIX and if selected
#
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIArrayString.cc 66892 2013-01-17 10:57:59Z gunter $
//
#include <iomanip>
+9 -8
View File
@@ -34,6 +34,11 @@
#include "G4Qt.hh"
#endif
#if defined(G4UI_BUILD_WT_SESSION)
#include "G4UIWt.hh"
#include "G4Wt.hh"
#endif
#if defined(G4UI_BUILD_XM_SESSION)
#include "G4UIXm.hh"
#endif
@@ -42,10 +47,6 @@
#include "G4UIWin32.hh"
#endif
#if defined(G4UI_BUILD_WT_SESSION)
//#include "G4UIWt.hh"
#endif
#include "G4UIGAG.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
@@ -147,8 +148,8 @@ G4UIExecutive::G4UIExecutive(G4int argc, char** argv, const G4String& type)
break;
case kWt:
#if defined(G4UI_BUILD_WT_SESSION)
//session = new G4UIWt(argc, argv);
//isGUI = true;
session = new G4UIWt(argc, argv);
isGUI = true;
#endif
break;
case kGag:
@@ -203,7 +204,7 @@ void G4UIExecutive::SelectSessionByArg(const G4String& stype)
if ( qt_build && stype == "qt" ) selected = kQt;
else if ( xm_build && stype == "xm" ) selected = kXm;
else if ( win32_build && stype == "win32" ) selected = kWin32;
//else if ( wt_build && stype == "wt" ) selected = kWt;
else if ( wt_build && stype == "wt" ) selected = kWt;
else if ( stype == "gag" ) selected = kGag;
else if ( tcsh_build && stype == "tcsh" ) selected = kTcsh;
else if ( stype == "csh" ) selected = kCsh;
@@ -215,7 +216,7 @@ 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 ( 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;
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIWin32.cc 66892 2013-01-17 10:57:59Z gunter $
//
// G.Barrand
File diff suppressed because it is too large Load Diff
-257
View File
@@ -1,257 +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. *
// ********************************************************************
//
//
// $Id$
//
// G.Barrand
//#define DEBUG
#ifdef G4UI_BUILD_XAW_SESSION
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <Xaw/Dialog.h>
#include <Xaw/Command.h>
#include "G4UIXaw.hh"
#include "G4UImanager.hh"
#include "G4StateManager.hh"
#include "G4UIcommandTree.hh"
#include "G4UIcommandStatus.hh"
#include "G4Xt.hh"
static G4bool ConvertStringToInt(const char*,int&);
static G4bool exitSession = true;
static G4bool exitPause = true;
static G4bool exitHelp = true;
/***************************************************************************/
G4UIXaw::G4UIXaw (
int argc
,char** argv
)
:fHelp(false)
,fHelpChoice(0)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
static G4bool warned = false;
if (!warned) {
warned = true;
G4cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
"\n!!!!! Xaw is deprecated and will be removed in the next major release."
"\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
<< G4endl;
}
G4UImanager* UI = G4UImanager::GetUIpointer();
if(UI!=NULL) UI->SetSession(this);
G4Xt* interactorManager = G4Xt::getInstance (argc,argv,(char*)"Xaw");
Widget top = (Widget)interactorManager->GetMainInteractor();
shell = XtAppCreateShell ("G4UIXaw","G4UIXaw",topLevelShellWidgetClass,XtDisplay(top),NULL,0);
Arg args[2];
XtSetArg (args[0],XtNlabel,"G4 command");
XtSetArg (args[1],XtNvalue,""); // Needed to have a text Area.
dialog = XtCreateManagedWidget ("dialog",dialogWidgetClass,shell,args,2);
XawDialogAddButton (dialog,"Ok",Callback,(XtPointer)this);
XtRealizeWidget (shell);
}
/***************************************************************************/
G4UIXaw::~G4UIXaw (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
XtDestroyWidget (shell);
G4UImanager* UI = G4UImanager::GetUIpointer();
if(UI!=NULL) UI->SetSession(NULL);
}
/***************************************************************************/
G4UIsession* G4UIXaw::SessionStart (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4Xt* interactorManager = G4Xt::getInstance ();
Prompt ("session");
exitSession = false;
interactorManager->DisableSecondaryLoop ();
void* event;
while((event = interactorManager->GetEvent())!=NULL) {
interactorManager->DispatchEvent(event);
if(exitSession==true) break;
}
interactorManager->EnableSecondaryLoop ();
return this;
}
/***************************************************************************/
void G4UIXaw::Prompt (
const G4String& aPrompt
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
Arg args[1];
XtSetArg (args[0],XtNlabel,aPrompt.data());
XtSetValues (dialog,args,1);
}
/***************************************************************************/
void G4UIXaw::SessionTerminate (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
}
/***************************************************************************/
void G4UIXaw::PauseSessionStart (
const G4String& a_state
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
if(a_state=="G4_pause> ") {
SecondaryLoop ("Pause, type continue to exit this state");
}
if(a_state=="EndOfEvent") {
// Picking with feed back in event data Done here !!!
SecondaryLoop ("End of event, type continue to exit this state");
}
}
/***************************************************************************/
void G4UIXaw::SecondaryLoop (
G4String a_prompt
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4Xt* interactorManager = G4Xt::getInstance ();
Prompt (a_prompt);
exitPause = false;
void* event;
while((event = interactorManager->GetEvent())!=NULL) {
interactorManager->DispatchEvent(event);
if(exitPause==true) break;
}
Prompt ("session");
}
/***************************************************************************/
Widget G4UIXaw::GetDialog (
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
return dialog;
}
/***************************************************************************/
G4bool G4UIXaw::GetHelpChoice(
G4int& aInt
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
fHelp = true;
//
G4Xt* interactorManager = G4Xt::getInstance ();
Prompt("Help");
exitHelp = false;
void* event;
while((event = interactorManager->GetEvent())!=NULL) {
interactorManager->DispatchEvent(event);
if(exitHelp==true) break;
}
Prompt("session");
//
if(fHelp==false) return false;
aInt = fHelpChoice;
fHelp = false;
return true;
}
/***************************************************************************/
void G4UIXaw::ExitHelp(
) const
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
}
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
void G4UIXaw::Callback (
Widget
,XtPointer a_tag
,XtPointer
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
G4UIXaw* This = (G4UIXaw*)a_tag;
Widget dialog = This->GetDialog();
char* value = XawDialogGetValueString(dialog);
if(value==NULL) return;
G4String command (value);
if(This->fHelp==true) {
exitHelp = true;
This->fHelp = ConvertStringToInt(command.data(),This->fHelpChoice);
} else {
This->ApplyShellCommand (command,exitSession,exitPause);
}
Arg args[1];
XtSetArg (args[0],XtNvalue,"");
XtSetValues (dialog,args,1);
//a_widget = NULL; Not used (1st argument). Comment out to avoid compiler warnings. (JA)
//a_data = NULL; Not used (3rd argument). Comment out to avoid compiler warnings. (JA)
}
//////////////////////////////////////////////////////////////////////////////
G4bool ConvertStringToInt(
const char* aString
,int& aInt
)
//////////////////////////////////////////////////////////////////////////////
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
{
aInt = 0;
if(aString==NULL) return false;
char* s;
long value = strtol(aString,&s,10);
if(s==aString) return false;
aInt = value;
return true;
}
#endif
+1 -2
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIXm.cc 74547 2013-10-14 12:51:17Z gcosmo $
//
// G.Barrand
@@ -423,7 +423,6 @@ void G4UIXm::ButtonCallback (
G4UIXm* This = (G4UIXm*)a_tag;
if(This->fHelp==true) return; // Disabled when in help.
G4String ss = This->GetCommand (a_widget);
//printf ("debug : execute:\n%s\n",ss.data());
This->ApplyShellCommand(ss,exitSession,exitPause);
}
/***************************************************************************/
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIcsh.cc 66892 2013-01-17 10:57:59Z gunter $
//
#include "G4UIcsh.hh"
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UItcsh.cc 66892 2013-01-17 10:57:59Z gunter $
//
#ifndef WIN32
+2 -2
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4UIterminal.cc 66892 2013-01-17 10:57:59Z gunter $
//
// ====================================================================
// G4UIterminal.cc
@@ -47,7 +47,7 @@
// signal handler for soft-abort
// ====================================================================
static G4VUIshell* theshell= 0;
static G4ThreadLocal G4VUIshell* theshell= 0;
#ifndef WIN32
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VUIshell.cc 66892 2013-01-17 10:57:59Z gunter $
//
#include "G4UImanager.hh"