Import Geant4 0.1.0 source tree
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VInteractorManager.cc,v 2.3 1998/08/07 12:39:53 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// $Id: G4VInteractorManager.cc,v 1.5 1999/05/31 20:47:42 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
// G.Barrand
|
||||
|
||||
@@ -24,14 +24,6 @@ G4VInteractorManager::G4VInteractorManager (
|
||||
:argc(0)
|
||||
,argv(NULL)
|
||||
,mainInteractor(NULL)
|
||||
,dispatchern(0)
|
||||
,dispatchers(NULL)
|
||||
,preActionn(0)
|
||||
,preActions(NULL)
|
||||
,postActionn(0)
|
||||
,postActions(NULL)
|
||||
,shelln(0)
|
||||
,shells(NULL)
|
||||
,secondaryLoopEnabled(TRUE)
|
||||
,alreadyInSecondaryLoop(FALSE)
|
||||
,exitSecondaryLoop(0)
|
||||
@@ -54,24 +46,15 @@ G4VInteractorManager::~G4VInteractorManager (
|
||||
}
|
||||
free (argv);
|
||||
}
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
if(dispatchers!=NULL) free(dispatchers);
|
||||
dispatchers = NULL;
|
||||
dispatchern = 0;
|
||||
if(preActions!=NULL) free(preActions);
|
||||
preActions = NULL;
|
||||
preActionn = 0;
|
||||
if(postActions!=NULL) free(postActions);
|
||||
postActions = NULL;
|
||||
postActionn = 0;
|
||||
if(shells!=NULL) free(shells);
|
||||
shells = NULL;
|
||||
shelln = 0;
|
||||
|
||||
secondaryLoopEnabled = TRUE;
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
dispatchers.clear();
|
||||
preActions.clear();
|
||||
postActions.clear();
|
||||
shells.clear();
|
||||
secondaryLoopEnabled = TRUE;
|
||||
alreadyInSecondaryLoop = FALSE;
|
||||
exitSecondaryLoop = 0;
|
||||
exitSecondaryLoop = 0;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::SetArguments (
|
||||
@@ -152,15 +135,8 @@ void G4VInteractorManager::AddDispatcher (
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(a_dispatcher==NULL) return;
|
||||
for(int count=0;count<dispatchern;count++) {
|
||||
if(dispatchers[count]==a_dispatcher) return; // Done.
|
||||
}
|
||||
if(dispatchern==0) dispatchers = (G4DispatchFunction*)malloc( sizeof(G4DispatchFunction));
|
||||
else dispatchers = (G4DispatchFunction*)realloc(dispatchers,
|
||||
(dispatchern+1) * sizeof(G4DispatchFunction));
|
||||
if(dispatchers==NULL) return;
|
||||
dispatchers[dispatchern] = a_dispatcher;
|
||||
dispatchern++;
|
||||
if(dispatchers.contains(a_dispatcher)==TRUE) return;
|
||||
dispatchers.insert(a_dispatcher);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::RemoveDispatcher (
|
||||
@@ -169,12 +145,7 @@ void G4VInteractorManager::RemoveDispatcher (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
for(int count=0;count<dispatchern;count++) {
|
||||
if(dispatchers[count]==a_dispatcher) {
|
||||
dispatchers[count] = NULL;
|
||||
return; // A dispatcher appears once in the List.
|
||||
}
|
||||
}
|
||||
dispatchers.removeAll(a_dispatcher);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::DispatchEvent (
|
||||
@@ -183,12 +154,14 @@ void G4VInteractorManager::DispatchEvent (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
int dispatchern = dispatchers.entries();
|
||||
G4DispatchFunction func;
|
||||
G4bool status;
|
||||
for(int count=0;count<dispatchern;count++) {
|
||||
if(
|
||||
(dispatchers[count]!=NULL) &&
|
||||
(dispatchers[count](a_event)==TRUE)
|
||||
)
|
||||
break;
|
||||
func = dispatchers[count];
|
||||
if(func!=NULL) {
|
||||
if(func(a_event)==true) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/***************************************************************************/
|
||||
@@ -199,17 +172,8 @@ void G4VInteractorManager::AddSecondaryLoopPreAction (
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(a_preAction==NULL) return;
|
||||
for(int count=0;count<preActionn;count++) {
|
||||
if(preActions[count]==a_preAction) return; // Done.
|
||||
}
|
||||
if(preActionn==0)
|
||||
preActions = (G4SecondaryLoopAction*)malloc( sizeof(G4SecondaryLoopAction));
|
||||
else
|
||||
preActions = (G4SecondaryLoopAction*)realloc(preActions,
|
||||
(preActionn+1) * sizeof(G4SecondaryLoopAction));
|
||||
if(preActions==NULL) return;
|
||||
preActions[preActionn] = a_preAction;
|
||||
preActionn++;
|
||||
if(preActions.contains(a_preAction)==TRUE) return;
|
||||
preActions.insert(a_preAction);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::SecondaryLoopPreActions (
|
||||
@@ -217,6 +181,7 @@ void G4VInteractorManager::SecondaryLoopPreActions (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
int preActionn = preActions.entries();
|
||||
for(int count=0;count<preActionn;count++) {
|
||||
if(preActions[count]!=NULL) preActions[count]();
|
||||
}
|
||||
@@ -229,17 +194,8 @@ void G4VInteractorManager::AddSecondaryLoopPostAction (
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(a_postAction==NULL) return;
|
||||
for(int count=0;count<postActionn;count++) {
|
||||
if(postActions[count]==a_postAction) return; // Done.
|
||||
}
|
||||
if(postActionn==0)
|
||||
postActions = (G4SecondaryLoopAction*)malloc( sizeof(G4SecondaryLoopAction));
|
||||
else
|
||||
postActions = (G4SecondaryLoopAction*)realloc(postActions,
|
||||
(postActionn+1) * sizeof(G4SecondaryLoopAction));
|
||||
if(postActions==NULL) return;
|
||||
postActions[postActionn] = a_postAction;
|
||||
postActionn++;
|
||||
if(postActions.contains(a_postAction)==TRUE) return;
|
||||
postActions.insert(a_postAction);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::SecondaryLoopPostActions (
|
||||
@@ -247,6 +203,7 @@ void G4VInteractorManager::SecondaryLoopPostActions (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
int postActionn = postActions.entries();
|
||||
for(int count=0;count<postActionn;count++) {
|
||||
if(postActions[count]!=NULL) postActions[count]();
|
||||
}
|
||||
@@ -262,10 +219,13 @@ void G4VInteractorManager::SecondaryLoop (
|
||||
if(secondaryLoopEnabled==FALSE) return;
|
||||
|
||||
if (alreadyInSecondaryLoop==FALSE) {
|
||||
G4cout << "------------------------------------------" << endl;
|
||||
G4cout << "You have entered a viewer secondary X event loop." << endl;
|
||||
G4cout << "Quit it with an 'Escape' viewer button" << endl;
|
||||
alreadyInSecondaryLoop = TRUE;
|
||||
exitSecondaryLoop = 0;
|
||||
SecondaryLoopPreActions ();
|
||||
// for(int count=0;count<shelln;count++) XWidgetUniconify(shells[count]);
|
||||
//for(int count=0;count<shelln;count++) XWidgetUniconify(shells[count]);
|
||||
void* event;
|
||||
while(1) {
|
||||
event = GetEvent();
|
||||
@@ -306,14 +266,8 @@ void G4VInteractorManager::AddShell (
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(a_shell==NULL) return;
|
||||
for(int count=0;count<shelln;count++) {
|
||||
if(shells[count]==a_shell) return; // Done.
|
||||
}
|
||||
if(shelln==0) shells = (G4Interactor*)malloc( sizeof(G4Interactor));
|
||||
else shells = (G4Interactor*)realloc(shells, (shelln+1) * sizeof(G4Interactor));
|
||||
if(shells==NULL) return;
|
||||
shells[shelln] = a_shell;
|
||||
shelln++;
|
||||
if(shells.contains(a_shell)==TRUE) return;
|
||||
shells.insert(a_shell);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::RemoveShell (
|
||||
@@ -322,12 +276,7 @@ void G4VInteractorManager::RemoveShell (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
for(int count=0;count<shelln;count++) {
|
||||
if(shells[count]==a_shell) {
|
||||
shells[count] = NULL;
|
||||
return; // A shell appears once in the List.
|
||||
}
|
||||
}
|
||||
shells.removeAll(a_shell);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::SetParentInteractor (
|
||||
|
||||
Reference in New Issue
Block a user