slic/src
diff -u -r1.54 -r1.55
--- SlicApplication.cc 16 Jun 2011 20:57:53 -0000 1.54
+++ SlicApplication.cc 23 Sep 2011 22:41:14 -0000 1.55
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/SlicApplication.cc,v 1.54 2011/06/16 20:57:53 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/SlicApplication.cc,v 1.55 2011/09/23 22:41:14 jeremy Exp $
#include "SlicApplication.hh"
@@ -34,20 +34,21 @@
#include "G4VisExecutive.hh"
#endif
-#ifndef G4UI_NONE
-#include "G4UImanager.hh"
-#include "G4UIterminal.hh"
-#include "G4UItcsh.hh"
-#include "G4UIcsh.hh"
+//#ifndef G4UI_NONE
+//#include "G4UImanager.hh"
+//#include "G4UIterminal.hh"
+//#include "G4UItcsh.hh"
+//#include "G4UIcsh.hh"
+#include "G4UIExecutive.hh"
-#ifdef G4UI_USE_XM
-#include "G4UIXm.hh"
-#endif
+//#ifdef G4UI_USE_XM
+//#include "G4UIXm.hh"
+//#endif
-#ifdef G4UI_USE_GAG
-#include "G4UIGAG.hh"
-#endif
-#endif // G4UI_NONE
+//#ifdef G4UI_USE_GAG
+//#include "G4UIGAG.hh"
+//#endif
+//#endif // G4UI_NONE
#ifdef HAVE_G4VERSION
#include "G4Version.hh"
@@ -61,9 +62,6 @@
SlicApplication::SlicApplication()
: Module("SlicApplication", false),
m_session(0),
-//#ifdef G4VIS_USE
-// m_visManager(0),
-//#endif
m_appMessenger(0),
m_runManager(0),
m_mode(SlicApplication::eBatch),
@@ -118,6 +116,10 @@
// Process arguments using the CommandLineProcessor.
CommandLineProcessor* cmd = CommandLineProcessor::instance();
cmd->process(argc, argv);
+
+#ifdef G4UI_USE
+ m_ui = new G4UIExecutive(argc, argv);
+#endif
}
void SlicApplication::initialize()
@@ -148,16 +150,16 @@
// Setup the LCDD subsystem.
initializeLCDD();
- // Initialize visualization.
-#ifdef G4VIS_USE
- initializeVis();
-#endif
-
// Initialize the UI.
#ifndef G4UI_NONE
initializeUI();
#endif
+ // Initialize visualization.
+#ifdef G4VIS_USE
+ initializeVis();
+#endif
+
HepPDTManager::instance();
// Set state variable.
@@ -172,39 +174,7 @@
#ifndef G4UI_NONE
void SlicApplication::initializeUI()
{
- // A tcsh terminal.
-#ifdef G4UI_USE_TCSH
- m_session = new G4UIterminal(new G4UItcsh);
-
- // A csh terminal.
-#elif G4UI_USE_CSH
- m_session = new G4UIterminal(new G4UIcsh);
-
- // GAG.
-#elif G4UI_USE_GAG
- session = new G4UIGAG;
-
- // Motif GUI.
-#elif G4UI_USE_XM
- m_session = new G4UIXm( 0, NULL );
- // Add file and exit buttons to Motif UI
- if ( m_session )
- {
- G4UImanager* ui = G4UImanager::GetUIpointer();
- ui->ApplyCommand("/gui/addMenu file File");
- ui->ApplyCommand("/gui/addButton file Exit \"exit\"");
- }
- // Plain terminal is the fallback.
-#else
- m_session = new G4UIterminal();
-#endif
-
- if ( !m_session )
- {
- log().fatal( "Failed to initialize UI session." );
- G4Exception( "Failed to initialize UI session." );
- }
}
#endif
@@ -214,7 +184,7 @@
G4VisExecutive* vis = new G4VisExecutive();
vis->Initialize();
- // VRML test
+ // VRML writer within SLIC.
new VRML2WriterMessenger();
}
#endif
@@ -266,7 +236,8 @@
void SlicApplication::setAborting(bool a)
{
- if (a) {
+ if (a)
+ {
// FIXME: Does this actually do anything to current G4Event?
G4RunManager::GetRunManager()->AbortRun(a);
}
@@ -308,7 +279,8 @@
if ( getMode() == eInteractive )
{
log().verbose("Starting interactive session ...");
- m_session->SessionStart();
+ m_ui->SessionStart();
+ delete m_ui;
}
#endif
}