Index: trunk/geant4/interfaces/basic/src/G4UIQt.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIQt.cc	(revision 481)
+++ trunk/geant4/interfaces/basic/src/G4UIQt.cc	(revision 484)
@@ -1,2 +1,4 @@
+// TODO !
+
 //
 // ********************************************************************
@@ -25,8 +27,8 @@
 //
 //
-// $Id: G4UIQt.cc,v 1.14 2006/06/29 19:09:49 gunter Exp $
+// $Id: G4UIQt.cc,v 1.14 2007/05/29 11:09:49 $
 // GEANT4 tag $Name: geant4-08-01 $
 //
-// G.Barrand
+// L. Garnier
 
 //#define DEBUG
@@ -72,4 +74,5 @@
       | |> promt area       | |
       | +-------------------+ |
+      +-----------------------+
 */
 
@@ -78,18 +81,16 @@
  char** argv
 )
-:shell(NULL)
-/***************************************************************************/
-/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
-{
-  G4UImanager* UI = G4UImanager::GetUIpointer(); # TO KEEP
-  if(UI!=NULL) UI->SetSession(this); # TO KEEP
-
-  new QApplication (argc, argv);
-
-  mainWindow = new QMainWindow(0,qApp->applicationDirPath () );
-
-//  G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(char*)"Qt");  # TO KEEP ?
-
-//   Widget top = (Widget)interactorManager->GetMainInteractor();
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+  G4UImanager* UI = G4UImanager::GetUIpointer(); // TO KEEP
+  if(UI!=NULL) UI->SetSession(this); // TO KEEP
+
+  G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(char*)"Qt");  // TO KEEP ?
+
+  mainWindow = new QMainWindow();
+
+
+//  QMainWindow top = (QMainWindow)interactorManager->GetMainInteractor();
 
 //   if(getenv("XENVIRONMENT")==NULL) {
@@ -148,5 +149,5 @@
 //   XtSetArg(args[7],XmNrows            ,12);
 //   XtSetArg(args[8],XmNcolumns         ,80);
-//   text = XmCreateScrolledText (form,(char*)"text",args,9);
+//   text = XmCreateSGcrolledText (form,(char*)"text",args,9);
 //   XtManageChild (text);
 
@@ -162,5 +163,5 @@
 //   XtMapWidget(shell);
 
-  if(UI!=NULL) UI->SetCoutDestination(this);  # TO KEEP
+  if(UI!=NULL) UI->SetCoutDestination(this);  // TO KEEP
 }
 /***************************************************************************/
@@ -170,10 +171,13 @@
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
 { 
-  G4UImanager* UI = G4UImanager::GetUIpointer();  # TO KEEP
-  if(UI!=NULL) {  # TO KEEP
-    UI->SetSession(NULL);  # TO KEEP
-    UI->SetCoutDestination(NULL);  # TO KEEP
+  G4UImanager* UI = G4UImanager::GetUIpointer();  // TO KEEP
+  if(UI!=NULL) {  // TO KEEP
+    UI->SetSession(NULL);  // TO KEEP
+    UI->SetCoutDestination(NULL);  // TO KEEP
   }
-  XtDestroyWidget(shell);
+
+  
+  if (mainWindow!=NULL)
+    delete mainWindow;
 }
 /***************************************************************************/
@@ -186,18 +190,18 @@
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
 {
-  frame->show();
+
+  mainWindow->show();
   qApp->exec();
 
-//   G4Qt* interactorManager = G4Qt::getInstance (); # TO KEEP ?
-//   Prompt("session"); # TO KEEP
-//   exitSession = false; # TO KEEP
-//   interactorManager->DisableSecondaryLoop (); # TO KEEP
-//   void* event; # TO KEEP
-//   while((event = interactorManager->GetEvent())!=NULL) {  # TO KEEP
-//     interactorManager->DispatchEvent(event); # TO KEEP
-//     if(exitSession==true) break; # TO KEEP
-//   } # TO KEEP
-//   interactorManager->EnableSecondaryLoop (); # TO KEEP
-  return this; # TO KEEP
+//   Prompt("session"); // TO KEEP
+//   exitSession = false; // TO KEEP
+//   interactorManager->DisableSecondaryLoop (); // TO KEEP
+//   void* event; // TO KEEP
+//   while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
+//     interactorManager->DispatchEvent(event); // TO KEEP
+//     if(exitSession==true) break; // TO KEEP
+//   } // TO KEEP
+//   interactorManager->EnableSecondaryLoop (); // TO KEEP
+  return this; // TO KEEP
 }
 /***************************************************************************/
@@ -211,11 +215,12 @@
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
 {
-  Arg args[1];
-  char* str = (char*)XtNewString(aPrompt.data());
-  XmString cps = XmStringLtoRCreate(str,XmSTRING_DEFAULT_CHARSET);
-  XtFree(str);
-  XtSetArg(args[0],XmNpromptString,cps);
-  XtSetValues(command,args,1);
-  XmStringFree(cps);
+// TODO !
+//  Arg args[1];
+//  char* str = (char*)XtNewString(aPrompt.data());
+//  XmString cps = XmStringLtoRCreate(str,XmSTRING_DEFAULT_CHARSET);
+//  XtFree(str);
+//  XtSetArg(args[0],XmNpromptString,cps);
+//  XtSetValues(command,args,1);
+//  XmStringFree(cps);
 }
 /***************************************************************************/
@@ -233,15 +238,15 @@
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
 {
-  if(a_state=="G4_pause> ") {  # TO KEEP
-    SecondaryLoop ("Pause, type continue to exit this state"); # TO KEEP
-  } # TO KEEP
-
-  if(a_state=="EndOfEvent") { # TO KEEP
+  if(a_state=="G4_pause> ") {  // TO KEEP
+    SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP
+  } // TO KEEP
+
+  if(a_state=="EndOfEvent") { // TO KEEP
     // Picking with feed back in event data Done here !!!
-    SecondaryLoop ("End of event, type continue to exit this state"); # TO KEEP
-  } # TO KEEP
-}
-/***************************************************************************/
-void G4UIXm::SecondaryLoop (
+    SecondaryLoop ("End of event, type continue to exit this state"); // TO KEEP
+  } // TO KEEP
+}
+/***************************************************************************/
+void G4UIQt::SecondaryLoop (
  G4String a_prompt
 )
@@ -249,13 +254,13 @@
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
 {
-  G4Qt* interactorManager = G4Qt::getInstance (); # TO KEEP ?
-  Prompt(a_prompt); # TO KEEP
-  exitPause = false; # TO KEEP
-  void* event; # TO KEEP
-  while((event = interactorManager->GetEvent())!=NULL) {  # TO KEEP
-    interactorManager->DispatchEvent(event); # TO KEEP
-    if(exitPause==true) break; # TO KEEP
-  } # TO KEEP
-  Prompt("session"); # TO KEEP
+  G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
+  Prompt(a_prompt); // TO KEEP
+  exitPause = false; // TO KEEP
+  void* event; // TO KEEP
+  while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
+    interactorManager->DispatchEvent(event); // TO KEEP
+    if(exitPause==true) break; // TO KEEP
+  } // TO KEEP
+  Prompt("session"); // TO KEEP
 }
 /***************************************************************************/
@@ -263,5 +268,5 @@
   Receive a cout from Geant4. We have to display it in the cout zone
  */
-G4int G4UIXm::ReceiveG4cout (
+G4int G4UIQt::ReceiveG4cout (
  G4String a_string
 )
@@ -269,6 +274,7 @@
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
 {
-  XmTextAppendString(text,(char*)a_string.data());
-  return 0;
+// TODO !
+//  XmTextAppendString(text,(char*)a_string.data());
+//  return 0;
 }
 /***************************************************************************/
@@ -276,5 +282,5 @@
   Receive a cerr from Geant4. We have to display it in the cout zone
  */
-G4int G4UIXm::ReceiveG4cerr (
+G4int G4UIQt::ReceiveG4cerr (
  G4String a_string
 )
@@ -282,9 +288,10 @@
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
 {
-  XmTextAppendString(text,(char*)a_string.data());
-  return 0;
-}
-/***************************************************************************/
-G4bool G4UIXm::GetHelpChoice(
+// TODO !
+//  XmTextAppendString(text,(char*)a_string.data());
+//  return 0;
+}
+/***************************************************************************/
+G4bool G4UIQt::GetHelpChoice(
  G4int& aInt
 )
@@ -292,30 +299,30 @@
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
 {
-//   fHelp = true; # TO KEEP
-//   // SecondaryLoop : # TO KEEP
-//   G4Qt* interactorManager = G4Qt::getInstance (); # TO KEEP ?
-//   Prompt("Help"); # TO KEEP
-//   exitHelp = false; # TO KEEP
-//   void* event; # TO KEEP
-//   while((event = interactorManager->GetEvent())!=NULL) {  # TO KEEP
-//     interactorManager->DispatchEvent(event); # TO KEEP
-//     if(exitHelp==true) break; # TO KEEP
-//   } # TO KEEP
-//   Prompt("session"); # TO KEEP
-//   // # TO KEEP
-//   if(fHelp==false) return false; # TO KEEP
-//   aInt = fHelpChoice; # TO KEEP
-//   fHelp = false; # TO KEEP
-//   return true; # TO KEEP
-}
-/***************************************************************************/
-void G4UIXm::ExitHelp(
-)
-/***************************************************************************/
-/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
-{
-}
-/***************************************************************************/
-void G4UIXm::AddMenu (
+//   fHelp = true; // TO KEEP
+//   // SecondaryLoop : // TO KEEP
+//   G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
+//   Prompt("Help"); // TO KEEP
+//   exitHelp = false; // TO KEEP
+//   void* event; // TO KEEP
+//   while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
+//     interactorManager->DispatchEvent(event); // TO KEEP
+//     if(exitHelp==true) break; // TO KEEP
+//   } // TO KEEP
+//   Prompt("session"); // TO KEEP
+//   // // TO KEEP
+//   if(fHelp==false) return false; // TO KEEP
+//   aInt = fHelpChoice; // TO KEEP
+//   fHelp = false; // TO KEEP
+//   return true; // TO KEEP
+}
+/***************************************************************************/
+void G4UIQt::ExitHelp(
+)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+{
+}
+/***************************************************************************/
+void G4UIQt::AddMenu (
  const char* a_name
 ,const char* a_label
@@ -343,5 +350,5 @@
 }
 /***************************************************************************/
-void G4UIXm::AddButton (
+void G4UIQt::AddButton (
  const char* a_menu
 ,const char* a_label
@@ -351,7 +358,7 @@
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
 {
-//   if(a_menu==NULL) return; # TO KEEP
-//   if(a_label==NULL) return; # TO KEEP
-//   if(a_command==NULL) return; # TO KEEP
+//   if(a_menu==NULL) return; // TO KEEP
+//   if(a_label==NULL) return; // TO KEEP
+//   if(a_command==NULL) return; // TO KEEP
 //   Widget parent = (Widget)GetInteractor(a_menu);
 //   if(parent==NULL) return;
@@ -377,13 +384,14 @@
   Send the command to geant4
  */
-void G4UIXm::commandEnteredCallback (
- Widget    a_widget
-,XtPointer a_tag
-,XtPointer a_data
-)
-/***************************************************************************/
-/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
-{
-  G4UIQt*  This = (G4UIQt*)a_tag;
+// TODO !
+//void G4UIQt::commandEnteredCallback (
+// Widget    a_widget
+//,XtPointer a_tag
+//,XtPointer a_data
+//)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+//{
+//  G4UIQt*  This = (G4UIQt*)a_tag;
 
 //   XmString cps  = ((XmCommandCallbackStruct*)a_data)->value;
@@ -401,5 +409,5 @@
 //   a_widget = NULL;
 //   a_tag    = NULL;
-}
+//}
 // /***************************************************************************/
 // void G4UIXm::keyHandler (
@@ -430,16 +438,17 @@
 /***************************************************************************/
 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
-{
+//{
 //   XmTextSetString((Widget)a_tag,(char*)"");
-}
-/***************************************************************************/
-void G4UIXm::ButtonCallback (
- Widget a_widget
-,XtPointer a_tag
-,XtPointer
-)
-/***************************************************************************/
-/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
-{
+//}
+/***************************************************************************/
+// TODO !
+//void G4UIQt::ButtonCallback (
+// Widget a_widget
+//,XtPointer a_tag
+//,XtPointer
+//)
+/***************************************************************************/
+/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
+//{
 //   G4UIXm* This = (G4UIXm*)a_tag;
 //   if(This->fHelp==true) return; // Disabled when in help.
@@ -447,5 +456,5 @@
 //   //printf ("debug : execute:\n%s\n",ss.data());
 //   This->ApplyShellCommand(ss,exitSession,exitPause);
-}
+//}
 /***************************************************************************/
 /***************************************************************************/
@@ -508,11 +517,11 @@
 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 {
-  aInt = 0; # TO KEEP
-  if(aString==NULL) return false; # TO KEEP
-  char* s; # TO KEEP
-  long value = strtol(aString,&s,10); # TO KEEP
-  if(s==aString) return false; # TO KEEP
-  aInt = value; # TO KEEP
-  return true; # TO KEEP
+  aInt = 0; // TO KEEP
+  if(aString==NULL) return false; // TO KEEP
+  char* s; // TO KEEP
+  long value = strtol(aString,&s,10); // TO KEEP
+  if(s==aString) return false; // TO KEEP
+  aInt = value; // TO KEEP
+  return true; // TO KEEP
 }
 #include <X11/IntrinsicP.h>
