Changeset 484 for trunk/geant4/interfaces
- Timestamp:
- Jun 5, 2007, 4:09:01 PM (17 years ago)
- Location:
- trunk/geant4/interfaces
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/interfaces/basic/src/G4UIQt.cc
r481 r484 1 // TODO ! 2 1 3 // 2 4 // ******************************************************************** … … 25 27 // 26 28 // 27 // $Id: G4UIQt.cc,v 1.14 200 6/06/29 19:09:49 gunter Exp$29 // $Id: G4UIQt.cc,v 1.14 2007/05/29 11:09:49 $ 28 30 // GEANT4 tag $Name: geant4-08-01 $ 29 31 // 30 // G.Barrand32 // L. Garnier 31 33 32 34 //#define DEBUG … … 72 74 | |> promt area | | 73 75 | +-------------------+ | 76 +-----------------------+ 74 77 */ 75 78 … … 78 81 char** argv 79 82 ) 80 :shell(NULL) 81 /***************************************************************************/ 82 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 83 { 84 G4UImanager* UI = G4UImanager::GetUIpointer(); # TO KEEP 85 if(UI!=NULL) UI->SetSession(this); # TO KEEP 86 87 new QApplication (argc, argv); 88 89 mainWindow = new QMainWindow(0,qApp->applicationDirPath () ); 90 91 // G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(char*)"Qt"); # TO KEEP ? 92 93 // Widget top = (Widget)interactorManager->GetMainInteractor(); 83 /***************************************************************************/ 84 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 85 { 86 G4UImanager* UI = G4UImanager::GetUIpointer(); // TO KEEP 87 if(UI!=NULL) UI->SetSession(this); // TO KEEP 88 89 G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(char*)"Qt"); // TO KEEP ? 90 91 mainWindow = new QMainWindow(); 92 93 94 // QMainWindow top = (QMainWindow)interactorManager->GetMainInteractor(); 94 95 95 96 // if(getenv("XENVIRONMENT")==NULL) { … … 148 149 // XtSetArg(args[7],XmNrows ,12); 149 150 // XtSetArg(args[8],XmNcolumns ,80); 150 // text = XmCreateS crolledText (form,(char*)"text",args,9);151 // text = XmCreateSGcrolledText (form,(char*)"text",args,9); 151 152 // XtManageChild (text); 152 153 … … 162 163 // XtMapWidget(shell); 163 164 164 if(UI!=NULL) UI->SetCoutDestination(this); #TO KEEP165 if(UI!=NULL) UI->SetCoutDestination(this); // TO KEEP 165 166 } 166 167 /***************************************************************************/ … … 170 171 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 171 172 { 172 G4UImanager* UI = G4UImanager::GetUIpointer(); #TO KEEP173 if(UI!=NULL) { #TO KEEP174 UI->SetSession(NULL); #TO KEEP175 UI->SetCoutDestination(NULL); #TO KEEP173 G4UImanager* UI = G4UImanager::GetUIpointer(); // TO KEEP 174 if(UI!=NULL) { // TO KEEP 175 UI->SetSession(NULL); // TO KEEP 176 UI->SetCoutDestination(NULL); // TO KEEP 176 177 } 177 XtDestroyWidget(shell); 178 179 180 if (mainWindow!=NULL) 181 delete mainWindow; 178 182 } 179 183 /***************************************************************************/ … … 186 190 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 187 191 { 188 frame->show(); 192 193 mainWindow->show(); 189 194 qApp->exec(); 190 195 191 // G4Qt* interactorManager = G4Qt::getInstance (); # TO KEEP ? 192 // Prompt("session"); # TO KEEP 193 // exitSession = false; # TO KEEP 194 // interactorManager->DisableSecondaryLoop (); # TO KEEP 195 // void* event; # TO KEEP 196 // while((event = interactorManager->GetEvent())!=NULL) { # TO KEEP 197 // interactorManager->DispatchEvent(event); # TO KEEP 198 // if(exitSession==true) break; # TO KEEP 199 // } # TO KEEP 200 // interactorManager->EnableSecondaryLoop (); # TO KEEP 201 return this; # TO KEEP 196 // Prompt("session"); // TO KEEP 197 // exitSession = false; // TO KEEP 198 // interactorManager->DisableSecondaryLoop (); // TO KEEP 199 // void* event; // TO KEEP 200 // while((event = interactorManager->GetEvent())!=NULL) { // TO KEEP 201 // interactorManager->DispatchEvent(event); // TO KEEP 202 // if(exitSession==true) break; // TO KEEP 203 // } // TO KEEP 204 // interactorManager->EnableSecondaryLoop (); // TO KEEP 205 return this; // TO KEEP 202 206 } 203 207 /***************************************************************************/ … … 211 215 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 212 216 { 213 Arg args[1]; 214 char* str = (char*)XtNewString(aPrompt.data()); 215 XmString cps = XmStringLtoRCreate(str,XmSTRING_DEFAULT_CHARSET); 216 XtFree(str); 217 XtSetArg(args[0],XmNpromptString,cps); 218 XtSetValues(command,args,1); 219 XmStringFree(cps); 217 // TODO ! 218 // Arg args[1]; 219 // char* str = (char*)XtNewString(aPrompt.data()); 220 // XmString cps = XmStringLtoRCreate(str,XmSTRING_DEFAULT_CHARSET); 221 // XtFree(str); 222 // XtSetArg(args[0],XmNpromptString,cps); 223 // XtSetValues(command,args,1); 224 // XmStringFree(cps); 220 225 } 221 226 /***************************************************************************/ … … 233 238 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 234 239 { 235 if(a_state=="G4_pause> ") { #TO KEEP236 SecondaryLoop ("Pause, type continue to exit this state"); #TO KEEP237 } #TO KEEP238 239 if(a_state=="EndOfEvent") { #TO KEEP240 if(a_state=="G4_pause> ") { // TO KEEP 241 SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP 242 } // TO KEEP 243 244 if(a_state=="EndOfEvent") { // TO KEEP 240 245 // Picking with feed back in event data Done here !!! 241 SecondaryLoop ("End of event, type continue to exit this state"); #TO KEEP242 } #TO KEEP243 } 244 /***************************************************************************/ 245 void G4UI Xm::SecondaryLoop (246 SecondaryLoop ("End of event, type continue to exit this state"); // TO KEEP 247 } // TO KEEP 248 } 249 /***************************************************************************/ 250 void G4UIQt::SecondaryLoop ( 246 251 G4String a_prompt 247 252 ) … … 249 254 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 250 255 { 251 G4Qt* interactorManager = G4Qt::getInstance (); #TO KEEP ?252 Prompt(a_prompt); #TO KEEP253 exitPause = false; #TO KEEP254 void* event; #TO KEEP255 while((event = interactorManager->GetEvent())!=NULL) { #TO KEEP256 interactorManager->DispatchEvent(event); #TO KEEP257 if(exitPause==true) break; #TO KEEP258 } #TO KEEP259 Prompt("session"); #TO KEEP256 G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ? 257 Prompt(a_prompt); // TO KEEP 258 exitPause = false; // TO KEEP 259 void* event; // TO KEEP 260 while((event = interactorManager->GetEvent())!=NULL) { // TO KEEP 261 interactorManager->DispatchEvent(event); // TO KEEP 262 if(exitPause==true) break; // TO KEEP 263 } // TO KEEP 264 Prompt("session"); // TO KEEP 260 265 } 261 266 /***************************************************************************/ … … 263 268 Receive a cout from Geant4. We have to display it in the cout zone 264 269 */ 265 G4int G4UI Xm::ReceiveG4cout (270 G4int G4UIQt::ReceiveG4cout ( 266 271 G4String a_string 267 272 ) … … 269 274 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 270 275 { 271 XmTextAppendString(text,(char*)a_string.data()); 272 return 0; 276 // TODO ! 277 // XmTextAppendString(text,(char*)a_string.data()); 278 // return 0; 273 279 } 274 280 /***************************************************************************/ … … 276 282 Receive a cerr from Geant4. We have to display it in the cout zone 277 283 */ 278 G4int G4UI Xm::ReceiveG4cerr (284 G4int G4UIQt::ReceiveG4cerr ( 279 285 G4String a_string 280 286 ) … … 282 288 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 283 289 { 284 XmTextAppendString(text,(char*)a_string.data()); 285 return 0; 286 } 287 /***************************************************************************/ 288 G4bool G4UIXm::GetHelpChoice( 290 // TODO ! 291 // XmTextAppendString(text,(char*)a_string.data()); 292 // return 0; 293 } 294 /***************************************************************************/ 295 G4bool G4UIQt::GetHelpChoice( 289 296 G4int& aInt 290 297 ) … … 292 299 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 293 300 { 294 // fHelp = true; #TO KEEP295 // // SecondaryLoop : #TO KEEP296 // G4Qt* interactorManager = G4Qt::getInstance (); #TO KEEP ?297 // Prompt("Help"); #TO KEEP298 // exitHelp = false; #TO KEEP299 // void* event; #TO KEEP300 // while((event = interactorManager->GetEvent())!=NULL) { #TO KEEP301 // interactorManager->DispatchEvent(event); #TO KEEP302 // if(exitHelp==true) break; #TO KEEP303 // } #TO KEEP304 // Prompt("session"); #TO KEEP305 // // #TO KEEP306 // if(fHelp==false) return false; #TO KEEP307 // aInt = fHelpChoice; #TO KEEP308 // fHelp = false; #TO KEEP309 // return true; #TO KEEP310 } 311 /***************************************************************************/ 312 void G4UI Xm::ExitHelp(313 ) 314 /***************************************************************************/ 315 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 316 { 317 } 318 /***************************************************************************/ 319 void G4UI Xm::AddMenu (301 // fHelp = true; // TO KEEP 302 // // SecondaryLoop : // TO KEEP 303 // G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ? 304 // Prompt("Help"); // TO KEEP 305 // exitHelp = false; // TO KEEP 306 // void* event; // TO KEEP 307 // while((event = interactorManager->GetEvent())!=NULL) { // TO KEEP 308 // interactorManager->DispatchEvent(event); // TO KEEP 309 // if(exitHelp==true) break; // TO KEEP 310 // } // TO KEEP 311 // Prompt("session"); // TO KEEP 312 // // // TO KEEP 313 // if(fHelp==false) return false; // TO KEEP 314 // aInt = fHelpChoice; // TO KEEP 315 // fHelp = false; // TO KEEP 316 // return true; // TO KEEP 317 } 318 /***************************************************************************/ 319 void G4UIQt::ExitHelp( 320 ) 321 /***************************************************************************/ 322 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 323 { 324 } 325 /***************************************************************************/ 326 void G4UIQt::AddMenu ( 320 327 const char* a_name 321 328 ,const char* a_label … … 343 350 } 344 351 /***************************************************************************/ 345 void G4UI Xm::AddButton (352 void G4UIQt::AddButton ( 346 353 const char* a_menu 347 354 ,const char* a_label … … 351 358 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 352 359 { 353 // if(a_menu==NULL) return; #TO KEEP354 // if(a_label==NULL) return; #TO KEEP355 // if(a_command==NULL) return; #TO KEEP360 // if(a_menu==NULL) return; // TO KEEP 361 // if(a_label==NULL) return; // TO KEEP 362 // if(a_command==NULL) return; // TO KEEP 356 363 // Widget parent = (Widget)GetInteractor(a_menu); 357 364 // if(parent==NULL) return; … … 377 384 Send the command to geant4 378 385 */ 379 void G4UIXm::commandEnteredCallback ( 380 Widget a_widget 381 ,XtPointer a_tag 382 ,XtPointer a_data 383 ) 384 /***************************************************************************/ 385 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 386 { 387 G4UIQt* This = (G4UIQt*)a_tag; 386 // TODO ! 387 //void G4UIQt::commandEnteredCallback ( 388 // Widget a_widget 389 //,XtPointer a_tag 390 //,XtPointer a_data 391 //) 392 /***************************************************************************/ 393 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 394 //{ 395 // G4UIQt* This = (G4UIQt*)a_tag; 388 396 389 397 // XmString cps = ((XmCommandCallbackStruct*)a_data)->value; … … 401 409 // a_widget = NULL; 402 410 // a_tag = NULL; 403 }411 //} 404 412 // /***************************************************************************/ 405 413 // void G4UIXm::keyHandler ( … … 430 438 /***************************************************************************/ 431 439 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 432 {440 //{ 433 441 // XmTextSetString((Widget)a_tag,(char*)""); 434 } 435 /***************************************************************************/ 436 void G4UIXm::ButtonCallback ( 437 Widget a_widget 438 ,XtPointer a_tag 439 ,XtPointer 440 ) 441 /***************************************************************************/ 442 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 443 { 442 //} 443 /***************************************************************************/ 444 // TODO ! 445 //void G4UIQt::ButtonCallback ( 446 // Widget a_widget 447 //,XtPointer a_tag 448 //,XtPointer 449 //) 450 /***************************************************************************/ 451 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 452 //{ 444 453 // G4UIXm* This = (G4UIXm*)a_tag; 445 454 // if(This->fHelp==true) return; // Disabled when in help. … … 447 456 // //printf ("debug : execute:\n%s\n",ss.data()); 448 457 // This->ApplyShellCommand(ss,exitSession,exitPause); 449 }458 //} 450 459 /***************************************************************************/ 451 460 /***************************************************************************/ … … 508 517 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 509 518 { 510 aInt = 0; #TO KEEP511 if(aString==NULL) return false; #TO KEEP512 char* s; #TO KEEP513 long value = strtol(aString,&s,10); #TO KEEP514 if(s==aString) return false; #TO KEEP515 aInt = value; #TO KEEP516 return true; #TO KEEP519 aInt = 0; // TO KEEP 520 if(aString==NULL) return false; // TO KEEP 521 char* s; // TO KEEP 522 long value = strtol(aString,&s,10); // TO KEEP 523 if(s==aString) return false; // TO KEEP 524 aInt = value; // TO KEEP 525 return true; // TO KEEP 517 526 } 518 527 #include <X11/IntrinsicP.h> -
trunk/geant4/interfaces/common/include/G4Qt.hh
r481 r484 25 25 // 26 26 // 27 // $Id: G4 Xt.hh,v 1.6 2006/06/29 19:10:14 gunter Exp$27 // $Id: G4Qt.hh,v 1.6 2007/05/29 11:10:14 $ 28 28 // GEANT4 tag $Name: geant4-08-01 $ 29 29 // 30 // To unify X11event treatment between31 // G4/interfaces Xt sessions and G4/visualizations Xt drivers.32 // G.Barrand30 // To unify Qt event treatment between 31 // G4/interfaces Qt sessions and G4/visualizations Qt drivers. 32 // L. Garnier 33 33 34 #ifndef G4 XT_HH35 #define G4 XT_HH34 #ifndef G4QT_HH 35 #define G4QT_HH 36 36 37 #if defined(G4INTY_BUILD_XT) || defined(G4INTY_USE_XT) 38 39 #include <X11/Intrinsic.h> 37 #if defined(G4INTY_BUILD_QT) || defined(G4INTY_USE_QT) 40 38 41 39 #include "G4VInteractorManager.hh" 42 40 41 #include <QtGui/qapplication.h> 42 #include <QtGui/qwidget.h> 43 #include <QtGui/qmainwindow.h> 44 43 45 // Class description : 44 46 // 45 // G4 Xt : a singleton to handle GUI sessions and visualization46 // drivers built over Xt. It permits to have one Xt main loop for47 // the whole application. The Xt toolkit is inited in the47 // G4Qt : a singleton to handle GUI sessions and visualization 48 // drivers built over Qt. It permits to have one Qt main loop for 49 // the whole application. The Qt toolkit is inited in the 48 50 // constructor. It is done once for the whole application. 49 51 // 50 52 // Class description - end : 51 53 52 class G4 Xt : public G4VInteractorManager {54 class G4Qt : public G4VInteractorManager { 53 55 public: 54 static G4Xt* getInstance(); 55 static G4Xt* getInstance(int,char**,char*); 56 void PutStringInResourceDatabase(char*); 56 static G4Qt* getInstance(); 57 static G4Qt* getInstance(int,char**,char*); 57 58 G4bool Inited(); 58 59 void* GetEvent(); 59 60 void FlushAndWaitExecution(); 60 virtual ~G4 Xt();61 virtual ~G4Qt(); 61 62 private: 62 G4 Xt (int,char**,char*);63 static G4 Xt* instance; // Pointer to single instance.63 G4Qt (int,char**,char*); 64 static G4Qt* instance; // Pointer to single instance. 64 65 }; 65 66 66 #endif //HAS_ XT67 #endif //HAS_QT 67 68 68 69 #endif -
trunk/geant4/interfaces/common/src/G4Qt.cc
r481 r484 25 25 // 26 26 // 27 // $Id: G4 Xt.cc,v 1.11 2006/06/29 19:10:28 gunter Exp$27 // $Id: G4Qt.cc,v 1.11 2007/05/29 11:10:28 $ 28 28 // GEANT4 tag $Name: geant4-08-01 $ 29 29 // 30 // G.Barrand30 // L. Garnier 31 31 32 #if defined(G4INTY_BUILD_ XT) || defined(G4INTY_USE_XT)32 #if defined(G4INTY_BUILD_QT) || defined(G4INTY_USE_QT) 33 33 34 34 #include <stdlib.h> 35 35 #include <string.h> 36 36 37 #include <X11/Intrinsic.h>38 #include <X11/Shell.h>39 40 37 #include "G4ios.hh" 41 38 42 #include "G4 Xt.hh"39 #include "G4Qt.hh" 43 40 44 41 #define NewString(str) \ … … 49 46 //static void XDisplaySetWindowToNormalState (Display*,Window); 50 47 51 G4 Xt* G4Xt::instance = NULL;48 G4Qt* G4Qt::instance = NULL; 52 49 53 static G4bool XtInited = FALSE; 54 static int argn = 0; 55 static char** args = NULL; 56 static XtAppContext appContext = NULL; 57 static Widget topWidget = NULL; 50 static G4bool QtInited = FALSE; 51 //static int argn = 0; 52 //static char** args = NULL; 53 // static QtAppContext appContext = NULL; 54 static QMainWindow *mainWidget = NULL; 55 58 56 /***************************************************************************/ 59 G4 Xt* G4Xt::getInstance (57 G4Qt* G4Qt::getInstance ( 60 58 ) 61 59 /***************************************************************************/ 62 60 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 63 61 { 64 return G4 Xt::getInstance (0,NULL,(char*)"Geant4");62 return G4Qt::getInstance (0,NULL,(char*)"Geant4"); 65 63 } 66 64 /***************************************************************************/ 67 G4 Xt* G4Xt::getInstance (65 G4Qt* G4Qt::getInstance ( 68 66 int a_argn 69 67 ,char** a_args … … 74 72 { 75 73 if (instance==NULL) { 76 instance = new G4 Xt(a_argn,a_args,a_class);74 instance = new G4Qt(a_argn,a_args,a_class); 77 75 } 78 76 return instance; 79 77 } 80 78 /***************************************************************************/ 81 G4 Xt::G4Xt (79 G4Qt::G4Qt ( 82 80 int a_argn 83 81 ,char** a_args … … 87 85 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 88 86 { 89 if(XtInited==FALSE) { //Xt should be Inited once ! 90 if(a_argn!=0) { //Save args. 91 args = (char**)malloc(a_argn * sizeof(char*)); 92 if(args!=NULL) { 93 argn = a_argn; 94 for(int argi=0;argi<a_argn;argi++) { 95 args[argi] = (char*)NewString (a_args[argi]); 96 } 97 } 87 if(QtInited==FALSE) { //Qt should be Inited once ! 88 89 new QApplication (a_argn, a_args); 90 mainWidget = new QMainWindow(); 91 92 if(mainWidget==NULL) { 93 G4cout << "G4Qt : Unable to init Qt." << G4endl; 98 94 } 99 #if XtSpecificationRelease == 4 100 Cardinal narg; 101 narg = (Cardinal)a_argn; 102 #else 103 int narg; 104 narg = a_argn; 105 #endif 106 Arg xargs[1]; 107 XtSetArg (xargs[0],XtNgeometry,"100x100"); 108 topWidget = XtAppInitialize (&appContext,a_class, 109 NULL,(Cardinal)0, 110 &narg,a_args,NULL, 111 xargs,1); 112 if(topWidget==NULL) { 113 G4cout << "G4Xt : Unable to init Xt." << G4endl; 114 } 115 // Restore a_args. XtAppInitialize corrupts the given ones !!! 116 if( (a_argn!=0) && (args!=NULL)) { 117 for(int argi=0;argi<a_argn;argi++) { 118 if(args[argi]!=NULL) 119 strcpy(a_args[argi],args[argi]); 120 else 121 a_args[argi] = NULL; 122 } 123 } 124 // If topWidget not realized, pbs with Inventor shells. 125 XtSetMappedWhenManaged (topWidget,False); 126 XtRealizeWidget (topWidget); 127 XtInited = TRUE; 95 QtInited = TRUE; 96 mainWidget->show(); 97 qApp->exec(); 128 98 } 129 SetArguments (argn,args); 130 SetMainInteractor (topWidget); 131 AddDispatcher ((G4DispatchFunction)XtDispatchEvent); 99 // AddDispatcher ((G4DispatchFunction)QtDispatchEvent); // FIXME 132 100 } 133 101 /***************************************************************************/ 134 G4 Xt::~G4Xt (102 G4Qt::~G4Qt ( 135 103 ) 136 104 /***************************************************************************/ … … 142 110 } 143 111 /***************************************************************************/ 144 G4bool G4 Xt::Inited (112 G4bool G4Qt::Inited ( 145 113 ) 146 114 /***************************************************************************/ 147 115 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 148 116 { 149 return XtInited;117 return QtInited; 150 118 } 151 119 /***************************************************************************/ 152 void* G4 Xt::GetEvent (120 void* G4Qt::GetEvent ( 153 121 ) 154 122 /***************************************************************************/ 155 123 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 156 124 { 157 static XEvent event; 158 if(appContext==NULL) return NULL; 159 if(topWidget==NULL) return NULL; 160 XtAppNextEvent (appContext, &event); 161 return &event; 125 //FIXME 126 G4cout << "G4Qt : Rien compris a cette fonction G4Qt::GetEvent." << G4endl; 127 // static XEvent event; 128 // if(appContext==NULL) return NULL; 129 // if(mainApp==NULL) return NULL; 130 // QtAppNextEvent (appContext, &event); 131 // return &event; 162 132 } 163 133 /***************************************************************************/ 164 void G4Xt::PutStringInResourceDatabase ( 165 char* a_string 134 void G4Qt::FlushAndWaitExecution ( 166 135 ) 167 136 /***************************************************************************/ 168 137 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 169 138 { 170 if(topWidget==NULL) return; 171 if(a_string==NULL) return; 172 Display* dpy = XtDisplay(topWidget); 173 XrmDatabase dbres = XrmGetStringDatabase (a_string); 174 if(dbres==NULL) return; 175 XrmDatabase database = XrmGetDatabase (dpy); 176 if(database!=NULL) { 177 XrmMergeDatabases (dbres,&database); 178 } else { 179 XrmSetDatabase (dpy,dbres); 180 } 181 } 182 /***************************************************************************/ 183 void G4Xt::FlushAndWaitExecution ( 184 ) 185 /***************************************************************************/ 186 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 187 { 188 if(topWidget==NULL) return; 189 XSync(XtDisplay(topWidget),False); 139 //FIXME 140 G4cout << "G4Qt : Rien compris a cette fonction G4Qt::FlushAndWaitExecution." << G4endl; 141 // if(mainApp==NULL) return; 142 // XSync(QtDisplay(mainApp),False); 190 143 } 191 144
Note: See TracChangeset
for help on using the changeset viewer.