Changeset 484 for trunk/geant4/interfaces/basic
- Timestamp:
- Jun 5, 2007, 4:09:01 PM (17 years ago)
- File:
-
- 1 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>
Note: See TracChangeset
for help on using the changeset viewer.