Import Geant4 9.3.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.6 2008/04/30 10:00:14 lgarnier Exp $
|
||||
# $Id: GNUmakefile,v 1.7 2009/10/19 07:37:48 lgarnier Exp $
|
||||
# -------------------------------------------------------------
|
||||
# GNUmakefile for interfaces/basic library. John Allison, 6/7/98.
|
||||
|
||||
@@ -11,6 +11,9 @@ endif
|
||||
# Definition of macro for moc files (for Qt use only)
|
||||
MOC_MACRO = -DG4UI_BUILD_QT_SESSION
|
||||
|
||||
# For debug mode
|
||||
# CPPFLAGS += -DG4DEBUG_INTERFACES_BASIC
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
include $(G4INSTALL)/config/G4UI_BUILD.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4UIExecutive.hh,v 1.4 2009/11/20 22:10:31 kmura Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4UIExecutive.hh
|
||||
//
|
||||
// This class helps automatic instantiation of user session
|
||||
// according to your environment variable like G4UI_USE_XXX.
|
||||
//
|
||||
// Usage in main():
|
||||
//
|
||||
// ...
|
||||
// #include "G4UIExecutive.hh"
|
||||
//
|
||||
// int main(int argc, char** argv)
|
||||
// {
|
||||
// ...
|
||||
// G4UIExecutive* myapp = new G4UIExecutive(argc, argv);
|
||||
// if (session->IsGUI())
|
||||
// // Do any extra for a GUI session
|
||||
//
|
||||
// myapp-> SessionStart();
|
||||
// ...
|
||||
// delete myapp;
|
||||
// ...
|
||||
//
|
||||
// ====================================================================
|
||||
#ifndef G4UI_EXECUTIVE_H
|
||||
#define G4UI_EXECUTIVE_H 1
|
||||
|
||||
#include "G4VUIshell.hh"
|
||||
|
||||
class G4UIsession;
|
||||
|
||||
class G4UIExecutive {
|
||||
private:
|
||||
G4UIsession* session;
|
||||
G4VUIshell* shell;
|
||||
G4bool isGUI;
|
||||
|
||||
public:
|
||||
G4UIExecutive(G4int argc, char** argv);
|
||||
~G4UIExecutive();
|
||||
|
||||
G4bool IsGUI() const;
|
||||
G4UIsession* GetSession() const;
|
||||
|
||||
void SetPrompt(const G4String& prompt);
|
||||
void SetLsColor(TermColorIndex dirColor, TermColorIndex cmdColor);
|
||||
|
||||
void SessionStart();
|
||||
|
||||
};
|
||||
|
||||
#include "G4UIExecutive.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4UIExecutive.icc,v 1.6 2009/11/20 22:10:31 kmura Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4UIExecutive.icc
|
||||
//
|
||||
// ====================================================================
|
||||
#include "G4UIsession.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#if defined(G4UI_USE_TCSH)
|
||||
#include "G4UIterminal.hh"
|
||||
#include "G4UItcsh.hh"
|
||||
|
||||
#elif defined(G4UI_USE_XM)
|
||||
#include "G4UIXm.hh"
|
||||
|
||||
#elif defined(G4UI_USE_WIN32)
|
||||
#include "G4UIWin32.hh"
|
||||
|
||||
#elif defined(G4UI_USE_QT)
|
||||
#include "G4UIQt.hh"
|
||||
#include "G4Qt.hh"
|
||||
|
||||
#else
|
||||
#include "G4UIterminal.hh"
|
||||
#include "G4UIcsh.hh"
|
||||
|
||||
#endif
|
||||
|
||||
#define DISCARD_PARAMETER(p) (void)p
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
G4UIExecutive::G4UIExecutive(G4int argc, char** argv)
|
||||
: session(0), shell(0),isGUI(false)
|
||||
/////////////////////////////////////////////////////
|
||||
{
|
||||
#if defined(G4UI_USE_TCSH)
|
||||
DISCARD_PARAMETER(argc);
|
||||
DISCARD_PARAMETER(argv);
|
||||
|
||||
shell = new G4UItcsh;
|
||||
session = new G4UIterminal(shell);
|
||||
|
||||
#elif defined(G4UI_USE_XM)
|
||||
session = new G4UIXm(argc, argv);
|
||||
isGUI = true;
|
||||
|
||||
#elif defined(G4UI_USE_WIN32)
|
||||
DISCARD_PARAMETER(argc);
|
||||
DISCARD_PARAMETER(argv);
|
||||
|
||||
session = new G4UIWin32();
|
||||
|
||||
#elif defined(G4UI_USE_QT)
|
||||
session = new G4UIQt(argc, argv);
|
||||
isGUI = true;
|
||||
|
||||
#else
|
||||
DISCARD_PARAMETER(argc);
|
||||
DISCARD_PARAMETER(argv);
|
||||
|
||||
shell = new G4UIcsh;
|
||||
session = new G4UIterminal(shell);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
G4UIExecutive::~G4UIExecutive()
|
||||
///////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
inline G4bool G4UIExecutive::IsGUI() const
|
||||
//////////////////////////////////////////
|
||||
{
|
||||
return isGUI;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
inline G4UIsession* G4UIExecutive::GetSession() const
|
||||
/////////////////////////////////////////////////////
|
||||
{
|
||||
return session;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
inline void G4UIExecutive::SetPrompt(const G4String& prompt)
|
||||
////////////////////////////////////////////////////////////
|
||||
{
|
||||
if(shell) shell-> SetPrompt(prompt);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
inline void G4UIExecutive::SetLsColor(TermColorIndex dirColor,
|
||||
TermColorIndex cmdColor)
|
||||
//////////////////////////////////////////////////////////////
|
||||
{
|
||||
if(shell) shell-> SetLsColor(dirColor, cmdColor);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
inline void G4UIExecutive::SessionStart()
|
||||
/////////////////////////////////////////
|
||||
{
|
||||
session-> SessionStart();
|
||||
delete session;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIQt.hh,v 1.15 2008/11/06 10:06:33 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4UIQt.hh,v 1.16 2009/02/16 11:40:26 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
#ifndef G4UIQt_h
|
||||
#define G4UIQt_h
|
||||
@@ -102,6 +102,7 @@ public:
|
||||
G4int ReceiveG4cout(G4String);
|
||||
G4int ReceiveG4cerr(G4String);
|
||||
// G4String GetCommand(Widget);
|
||||
QMainWindow * getMainWindow();
|
||||
|
||||
private:
|
||||
void SecondaryLoop(G4String); // a VIRER
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VUIshell.hh,v 1.7 2007/06/14 05:44:58 kmura Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4VUIshell.hh,v 1.8 2009/05/13 09:01:36 kmura Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
|
||||
#ifndef G4VUIshell_h
|
||||
@@ -86,6 +86,7 @@ public:
|
||||
void SetNColumn(G4int ncol);
|
||||
void SetPrompt(const G4String& prompt);
|
||||
void SetCurrentDirectory(const G4String& ccd);
|
||||
virtual void SetLsColor(TermColorIndex, TermColorIndex);
|
||||
|
||||
// shell commands
|
||||
virtual void ShowCurrentDirectory() const;
|
||||
@@ -117,6 +118,10 @@ inline void G4VUIshell::SetCurrentDirectory(const G4String& dir)
|
||||
currentCommandDir= dir;
|
||||
}
|
||||
|
||||
inline void G4VUIshell::SetLsColor(TermColorIndex, TermColorIndex)
|
||||
{
|
||||
}
|
||||
|
||||
inline void G4VUIshell::ShowCurrentDirectory() const
|
||||
{
|
||||
G4cout << currentCommandDir << G4endl;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIQt.cc,v 1.24 2008/11/24 13:50:34 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4UIQt.cc,v 1.29 2009/11/18 10:30:21 lgarnier Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
// L. Garnier
|
||||
|
||||
@@ -141,7 +141,7 @@ G4UIQt::G4UIQt (
|
||||
}
|
||||
fMainWindow = new QMainWindow();
|
||||
|
||||
#ifdef G4DEBUG
|
||||
#ifdef G4DEBUG_INTERFACES_BASIC
|
||||
printf("G4UIQt::Initialise after main window creation\n");
|
||||
#endif
|
||||
#if QT_VERSION < 0x040000
|
||||
@@ -154,7 +154,12 @@ G4UIQt::G4UIQt (
|
||||
fMainWindow->move(QPoint(50,100));
|
||||
#endif
|
||||
|
||||
QWidget *mainWidget = new QWidget(fMainWindow);
|
||||
#if QT_VERSION < 0x040000
|
||||
QSplitter *splitter = new QSplitter(Qt::Vertical,fMainWindow);
|
||||
#else
|
||||
QSplitter *splitter = new QSplitter(Qt::Vertical,mainWidget);
|
||||
#endif
|
||||
|
||||
// Set layouts
|
||||
|
||||
@@ -207,7 +212,7 @@ G4UIQt::G4UIQt (
|
||||
layoutTop->addWidget(clearButton);
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
topWidget->setLayout(layoutTop);
|
||||
// topWidget->setLayout(layoutTop);
|
||||
#endif
|
||||
|
||||
layoutBottom->addWidget(fCommandHistoryArea);
|
||||
@@ -215,13 +220,21 @@ G4UIQt::G4UIQt (
|
||||
layoutBottom->addWidget(fCommandArea);
|
||||
#if QT_VERSION >= 0x040000
|
||||
|
||||
bottomWidget->setLayout(layoutBottom);
|
||||
// bottomWidget->setLayout(layoutBottom);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget);
|
||||
|
||||
splitter->addWidget(topWidget);
|
||||
splitter->addWidget(bottomWidget);
|
||||
|
||||
mainLayout->addWidget(splitter);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
fMainWindow->setCentralWidget(mainWidget);
|
||||
#else
|
||||
fMainWindow->setCentralWidget(splitter);
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
|
||||
@@ -247,17 +260,20 @@ G4UIQt::G4UIQt (
|
||||
helpMenu->addAction("Show Help", this, SLOT(ShowHelpCallback()));
|
||||
#endif
|
||||
|
||||
AddInteractor ("file",(G4Interactor)fileMenu);
|
||||
AddInteractor ("help",(G4Interactor)helpMenu);
|
||||
|
||||
// Set the splitter size. The fTextArea sould be 2/3 on the fMainWindow
|
||||
#if QT_VERSION < 0x040000
|
||||
QValueList<int> vals = splitter->sizes();
|
||||
#else
|
||||
QList<int> vals = splitter->sizes();
|
||||
#endif
|
||||
if(vals.size()==2) {
|
||||
vals[0] = (splitter->orientation()==Qt::Vertical ? splitter->height() : splitter->width())*3/4;
|
||||
vals[1] = (splitter->orientation()==Qt::Vertical ? splitter->height() : splitter->width())*1/4;
|
||||
splitter->setSizes(vals);
|
||||
}
|
||||
// if(vals.size()==2) {
|
||||
// vals[0] = (splitter->orientation()==Qt::Vertical ? splitter->height() : splitter->width())*3/4;
|
||||
// vals[1] = (splitter->orientation()==Qt::Vertical ? splitter->height() : splitter->width())*1/4;
|
||||
// splitter->setSizes(vals);
|
||||
// }
|
||||
|
||||
if(UI!=NULL) UI->SetCoutDestination(this); // TO KEEP
|
||||
}
|
||||
@@ -333,6 +349,12 @@ void G4UIQt::Prompt (
|
||||
}
|
||||
|
||||
|
||||
QMainWindow * G4UIQt::getMainWindow (
|
||||
)
|
||||
{
|
||||
return fMainWindow;
|
||||
}
|
||||
|
||||
void G4UIQt::SessionTerminate (
|
||||
)
|
||||
{
|
||||
@@ -984,10 +1006,10 @@ QString G4UIQt::GetCommandList (
|
||||
/** Implement G4VBasicShell vurtual function
|
||||
*/
|
||||
G4bool G4UIQt::GetHelpChoice(
|
||||
G4int& aInt
|
||||
G4int&
|
||||
)
|
||||
{
|
||||
#ifdef G4DEBUG
|
||||
#ifdef G4DEBUG_INTERFACES_BASIC
|
||||
printf("G4UIQt::GetHelpChoice SHOULD NEVER GO HERE");
|
||||
#endif
|
||||
return true;
|
||||
@@ -999,7 +1021,7 @@ G4bool G4UIQt::GetHelpChoice(
|
||||
void G4UIQt::ExitHelp(
|
||||
)
|
||||
{
|
||||
#ifdef G4DEBUG
|
||||
#ifdef G4DEBUG_INTERFACES_BASIC
|
||||
printf("G4UIQt::ExitHelp SHOULD NEVER GO HERE");
|
||||
#endif
|
||||
}
|
||||
@@ -1103,6 +1125,16 @@ bool G4UIQt::eventFilter( // Should stay with a minuscule eventFilter because of
|
||||
|
||||
// do not pass by parent, it will disable widget tab focus !
|
||||
return true;
|
||||
#if QT_VERSION >= 0x040000
|
||||
// L.Garnier : MetaModifier is CTRL for MAC, but I don't want to put a MAC
|
||||
// specific #ifdef
|
||||
} else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_A)) {
|
||||
fCommandArea->home(false);
|
||||
return true;
|
||||
} else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_E)) {
|
||||
fCommandArea->end(false);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user