Changeset 1222 for trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/GettingStarted/graphicalUserInterface.xml
- Timestamp:
- Dec 16, 2009, 12:14:47 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/GettingStarted/graphicalUserInterface.xml
r1213 r1222 2 2 <!-- --> 3 3 <!-- [History] --> 4 <!-- Converted to DocBook: Katsuya Amako, Aug-2006 --> 4 5 <!-- Update G4UIExecutive : Laurent Garnier, Dec-2009 --> 5 <!-- Converted to DocBook: Katsuya Amako, Aug-2006-->6 <!-- Reviced : Koichi Murakami, Dec-2009 --> 6 7 <!-- --> 7 8 <!-- ******************************************************** --> … … 28 29 29 30 <para> 30 The "intercoms" category 31 provides an expandable command interpreter. It is the key mechanism 32 of Geant4 to realize secure user interactions of all categories without 33 being annoyed by the dependencies among categories. The direct use 31 The "intercoms" category provides an expandable command interpreter. 32 It is the key mechanism of Geant4 to realize secure user interactions 33 in all categories without being annoyed by the dependencies among categories. 34 <!-- 35 The direct use 34 36 of Geant4 classes in a C++ program offers a first ground level of 35 37 interactivity, i.e., the batch session. As seen in the 36 38 examples/novice/N01, Geant4 commands and macros are to be 37 hard-coded in the program. 38 </para> 39 39 hard-coded in the program.--> 40 The Geant4 commands can be used both in a interactive terminal session and 41 in a batch mode with a maco file or a direct C++ call. 42 </para> 40 43 41 44 … … 49 52 50 53 <para> 51 To avoid too much programming, the 52 "intercoms" category provides the abstract class <emphasis>G4UIsession</emphasis> 53 that captures interactive commands . The concrete implementation of 54 the user interface and Graphical User Interfaces (GUI) is left to 55 the interfaces category. This interfacing strategy opens an 56 important door towards various user interface tools and allows 57 Geant4 to utilize the state-of-the-art GUI tools such as Motif, Qt, 58 and Java etc..The richness of the collaboration has permitted for 59 developers to offer various user interfaces to the Geant4 60 command system. Currently available are the following; 54 Geant4 can be controllled by a seriese of Geant4 UI commands. 55 The "intercoms" category provides the abstract class 56 <emphasis>G4UIsession</emphasis> that processes interactive commands. 57 The concrete implementation of (graphical) user interfaceis is located 58 in the "interfaces" category. This interfacing strategy opens an 59 important door towards various user interface tools, 60 and allows Geant4 to utilize the state-of-the-art GUI tools 61 such as Motif, Qt, and Java etc. 62 The richness of the collaboration realizes 63 various user interfaces to the Geant4 command system. 64 The following interfaces is currently available; 61 65 62 66 <orderedlist spacing="compact"> 63 67 <listitem><para> 64 Character terminal (dumb terminal and tcsh (bash)-like terminal),65 th e default user interface of Geant4,68 Character terminal (dumb terminal and tcsh-like terminal), 69 that is the default user interface of Geant4 66 70 </para></listitem> 67 71 <listitem><para> 68 Xm, Win32, Qt variations of the upperterminal by using a69 Motif, Qt or Windows widget to retrieve commands, and72 Xm, Xaw, Win32, Qt variations of the above terminal by using a 73 Motif, Athena, Qt or Windows widget 70 74 </para></listitem> 71 75 <listitem><para> 72 GAG, a fully Graphical User Interface and its network extension76 GAG, a fully graphical user interface and its network extension 73 77 GainServer of the client/server type. 74 78 </para></listitem> … … 77 81 78 82 <para> 79 Full implementation of the character 80 terminals (1 and 2) is included in the standard Geant4 distribution 81 in the <literal>source/interfaces/basic</literal> directory. As for GAG, 82 the front-end class is included 83 in the Geant4 distribution in the source/interfaces/GAG directory, 84 while its partner GUI package MOMO.jar is available in the standard Geant4 distribution 85 under the 86 <literal>environments/MOMO</literal> directory. MOMO.jar, Java archive file, contains 83 Implementation of the user sesssions (1 and 2) is included 84 in the <literal>source/interfaces/basic</literal> directory. 85 As for GAG, the front-end class is included 86 in the source/interfaces/GAG directory, 87 while its partner GUI package MOMO.jar is available 88 under the <literal>environments/MOMO</literal> directory. 89 MOMO.jar, Java archive file, contains 87 90 not only GAG, but also GGE and other helper packages. 88 Supplementary information is available 89 from the author's Webpage(see URL below).91 Supplementary information is available 92 from the author's web page (see URL below). 90 93 </para> 91 94 … … 114 117 <para> 115 118 These interfaces open a session on the character terminal. 116 <emphasis>G4UIterminal</emphasis> runs on all platform supported by Geant4, 117 including <emphasis>cygwin</emphasis> on Windows, 118 while <emphasis>G4UItcsh</emphasis> runs on Solaris and Linux. G4UItcsh 119 supports user-friendly key bindings a-la-tcsh (or bash); 119 <emphasis>G4UIterminal</emphasis> runs on all platforms supported by Geant4, 120 including <emphasis>cygwin</emphasis> on Windows. 121 122 The following built-in commands are available in 123 <emphasis>G4UIterminal</emphasis>; 124 125 <variablelist> 126 <varlistentry> 127 <term>cd, pwd</term> 128 <listitem> 129 change, display the current command directory. 130 </listitem> 131 </varlistentry> 132 133 <varlistentry> 134 <term>ls, lc</term> 135 <listitem> 136 list commands and subdirectories in the current directory. 137 </listitem> 138 </varlistentry> 139 140 <varlistentry> 141 <term>history</term> 142 <listitem> 143 show previous commands. 144 </listitem> 145 </varlistentry> 146 147 <varlistentry> 148 <term>!historyID</term> 149 <listitem> 150 reissue previous command. 151 </listitem> 152 </varlistentry> 153 154 <varlistentry> 155 <term>?command</term> 156 <listitem> 157 show current parameter values of the command. 158 </listitem> 159 </varlistentry> 160 161 <varlistentry> 162 <term>help command</term> 163 <listitem> 164 show command help. 165 </listitem> 166 </varlistentry> 167 168 <varlistentry> 169 <term>exit</term> 170 <listitem> 171 terminate the session. 172 </listitem> 173 </varlistentry> 174 </variablelist> 175 176 G4UItcsh supports user-friendly key bindings a-la-tcsh. 177 <emphasis>G4UItcsh</emphasis> runs on Solaris and Linux. 178 The following keybindings are supported; 120 179 121 180 <variablelist> … … 197 256 198 257 <para> 199 In addition, the following string substitutions are supported; 200 258 The example below shows how to set a user's prompt. 259 <informalexample> 260 <programlisting> 261 G4UItcsh* tcsh = new G4UItcsh(); 262 tcsh-> SetPrompt("%s>"); 263 </programlisting> 264 </informalexample> 265 266 The following strings are supported as substitutions in a prompt string. 201 267 <variablelist> 202 268 <varlistentry> … … 219 285 </varlistentry> 220 286 </variablelist> 287 </para> 288 289 <para> 290 Command history in a user's session is saved 291 in a file <literal>$(HOME)/.g4_hist</literal> 292 that is automatically read at the next session, 293 so that command history is available across sessions. 221 294 </para> 222 295 … … 226 299 <sect3 id="sect.HowToSetUpInter.DescInter.G4UIXm"> 227 300 <title> 228 <emphasis>G4UIXm</emphasis>, <emphasis>G4UI Qt</emphasis> and301 <emphasis>G4UIXm</emphasis>, <emphasis>G4UIXaw</emphasis>, <emphasis>G4UIQt</emphasis> and 229 302 <emphasis>G4UIWin32</emphasis> classes 230 303 </title> … … 232 305 <para> 233 306 These interfaces are versions of <emphasis>G4UIterminal</emphasis> 234 implemented over libraries Motif, Qt and WIN32 respectively.307 implemented over libraries Motif, Athena, Qt and WIN32 respectively. 235 308 <emphasis>G4UIXm</emphasis> uses the Motif XmCommand widget, 236 <emphasis>G4UIQt</emphasis> the Qt dialog 237 widget, and <emphasis>G4UIWin32</emphasis> the Windows "edit" component to do the 309 <emphasis>G4UIXaw</emphasis> the Athena dialog 310 widget, <emphasis>G4UIQt</emphasis> the Qt dialog widget, 311 and <emphasis>G4UIWin32</emphasis> the Windows "edit" component to do the 238 312 command capturing. These interfaces are useful if working in 239 313 conjunction with visualization drivers that use the Xt library, Qt library or … … 243 317 <para> 244 318 A command box is at disposal for entering or recalling Geant4 commands. 245 Command completion by typing &ldquo;TAB&rdquo;key is246 available on the command line. The shell commands "exit, cont,247 help, ls, cd..." are also supported. A menu bar c ouldbe customized319 Command completion by typing "TAB" key is 320 available in the command box. The shell commands "exit, cont, 321 help, ls, cd..." are also supported. A menu bar can be customized 248 322 through the <emphasis>AddMenu</emphasis> and 249 323 <emphasis>AddButton</emphasis> method. Ex: … … 278 352 279 353 <para> 280 <emphasis>G4UIXm</emphasis> runs on Unix/Linux with Motif. <emphasis>G4UIQt</emphasis> run 354 <emphasis>G4UIXm</emphasis> runs on Unix/Linux with Motif. <emphasis>G4UIXaw</emphasis>, 355 less user friendly, runs on Unix with Athena widgets. <emphasis>G4UIQt</emphasis> run 281 356 everywhere with Qt. 282 357 <emphasis>G4UIWin32</emphasis> runs on Windows. … … 307 382 <para> 308 383 Client GUIs, GAG and Gain have almost similar look-and-feel. So, 309 GAG's functionalities are briefly explained here. Please refer to310 the above URLfor details.384 GAG's functionalities are briefly explained here. 385 Please refer to the URL previously mentioned for details. 311 386 </para> 312 387 … … 318 393 an executable simulation program via pipes. Geant4's 319 394 front-end class <emphasis>G4UIGAG</emphasis> must be instantiated to 320 communicate with GAG. GAG runs on Linux and Windows. If MOMO.jar is in your 321 CLASSPATH, it can be run by a command; 395 communicate with GAG. GAG runs on Linux and Windows. MOMO.jar can be run by a command; 322 396 </para> 323 397 324 398 <informalexample> 325 399 <programlisting> 326 %java -jar MOMO.jar400 %java -jar $G4INSTALL/environments/MOMO/MOMO.jar 327 401 </programlisting> 328 402 </informalexample> … … 335 409 <term>GAG Menu:</term> 336 410 <listitem> 337 The menus are to choose and run a G EANT4 executable file, to kill or exit338 a G EANT4 process and to exit GAG. Upon the normal exit or an411 The menus are to choose and run a Geant4 executable file, to kill or exit 412 a Geant4 process and to exit GAG. Upon the normal exit or an 339 413 unexpected death of the Geant4 process, GAG window are 340 automatically reset to run another G EANT4 executable.341 </listitem> 342 </varlistentry> 343 <varlistentry> 344 <term>G EANT4 Command tree:</term>345 <listitem> 346 Upon the establishment of the pipe connection with the G EANT4 process, GAG displays414 automatically reset to run another Geant4 executable. 415 </listitem> 416 </varlistentry> 417 <varlistentry> 418 <term>Geant4 Command tree:</term> 419 <listitem> 420 Upon the establishment of the pipe connection with the Geant4 process, GAG displays 347 421 the command menu, using expandable tree browser whose look and feel is similar to 348 422 a file browser. Disabled commands are shown in opaque. GAG 349 doesn &rsquo;t display commands that are just below the root of423 doesn't display commands that are just below the root of 350 424 the command hierarchy. Direct type-in field is available for such 351 425 input. Guidance of command categories and commands are displayed … … 375 449 in the middle of a long session of execution. Log can be saved to a 376 450 file independent of the above redirection . GAG displays warning or 377 error messages from G EANT4 in a pop-up warning widget.451 error messages from Geant4 in a pop-up warning widget. 378 452 </listitem> 379 453 </varlistentry> … … 392 466 393 467 <para> 394 The libraries that do n't depend on external packages are created by default, using395 Geant4 configure scripts.468 The libraries that do not depend on external packages are created by default, 469 using Geant4 configure scripts. 396 470 They include <emphasis>G4UIterminal</emphasis>, <emphasis>G4UItcsh</emphasis> 397 471 and <emphasis>G4UIGAG</emphasis> in libraries <emphasis>libG4UIbasic.a/so</emphasis> and … … 401 475 402 476 <para> 403 To make the libraries of <emphasis>G4UIXm</emphasis>, 477 To make the libraries of <emphasis>G4UIXm</emphasis>, <emphasis>G4UIXaw</emphasis>, 404 478 <emphasis>G4UIQt</emphasis> and 405 479 <emphasis>G4UIWin32</emphasis> , respective environment variables 406 480 <emphasis role="bold">G4UI_BUILD_XM_SESSION</emphasis>, 407 <emphasis role="bold">G4UI_BUILD_QT_SESSION</emphasis> or 481 <emphasis role="bold">G4UI_BUILD_XAW_SESSION</emphasis>, 482 <emphasis role="bold">G4UI_BUILD_QT_SESSION</emphasis> and 408 483 <emphasis role="bold">G4UI_BUILD_WIN32_SESSION</emphasis> must be set 409 484 explicitly before creating libraries. … … 411 486 412 487 <para> 413 However, if the environment variable <emphasis role="bold">G4UI_NONE</emphasis> is488 If the environment variable <emphasis role="bold">G4UI_NONE</emphasis> is 414 489 set, no interface libraries are built at all. 415 490 </para> … … 432 507 <para> 433 508 To use a given interface 434 (<literal>G4UIxxx</literal> where <literal>xxx = terminal,Xm, Win32, Qt, 435 GAG, GainServer</literal>) in your program, you can do it by two ways : 509 (<literal>G4UIxxx</literal> where <literal>xxx = terminal,Xm, Xaw, Win32, Qt, 510 GAG, GainServer</literal>) in your program, there are two ways. 511 436 512 <itemizedlist spacing="compact"> 437 <listitem> <para>Calling G4UIxxx directly :513 <listitem> Calling G4UIxxx directly : 438 514 <informalexample> 439 515 <programlisting> … … 446 522 </programlisting> 447 523 </informalexample> 448 Note : For a tcsh session, the second line must be (See the examples in "examples/novice/N0x" in which the terminal session is used) : 449 524 525 If you want to select a session type according to your environment variable, 526 the code can be: 527 528 <informalexample> 529 <programlisting> 530 // to include the class definition in the main program: 531 #if defined(G4UI_USE_TCSH) 532 #include "G4UIterminal.hh" 533 #include "G4UItcsh.hh" 534 #elif defined(G4UI_USE_XM) 535 #include "G4UIXm.hh" 536 .... 537 #endif 538 539 #if defined(G4UI_USE_TCSH) 540 session = new G4UITerminal(new G4UItcsh); 541 #elif defined(G4UI_USE_XM) 542 session = new G4UIXm(argc,argv); 543 #elif ... 544 </programlisting> 545 </informalexample> 546 547 Note : For a tcsh session, the second line must be 450 548 <informalexample> 451 549 <programlisting> … … 453 551 </programlisting> 454 552 </informalexample> 455 456 </para></listitem> 457 <listitem><para>Using <emphasis>G4UIExecutive</emphasis> (implement in all novice examples) : 553 554 If the user wants to deactivate the default signal handler (soft abort) 555 raised by "Ctr-C", the false flag can be set in the second argument 556 of the <emphasis>G4UIterminal</emphasis> constructor like; 557 558 <informalexample> 559 <programlisting> 560 G4UIsession* session = new G4UIterminal(new G4UItcsh, false). 561 </programlisting> 562 </informalexample> 563 </listitem> 564 565 566 <listitem>Using <emphasis>G4UIExecutive</emphasis> 567 (implemented in all novice examples) : 568 569 The above code is rather troublesome. 570 This is more convenient way for choosing a session type. 458 571 <informalexample> 459 572 <programlisting> … … 471 584 </programlisting> 472 585 </informalexample> 473 </para> 474 </listitem> 586 </listitem> 475 587 </itemizedlist> 476 588 </para> 477 589 478 <para>The two methods are similar. If you want to choose between several viewer driver at load, with the <emphasis>first</emphasis> method you will have to write : 479 <informalexample> 480 <programlisting> 481 // to include the class definition in the main program: 482 #if defined(G4UI_USE_TCSH) 483 #include "G4UIterminal.hh" 484 #include "G4UItcsh.hh" 485 #elif defined(G4UI_USE_XM) 486 #include "G4UIXm.hh" 487 .... 488 #endif 489 490 #if defined(G4UI_USE_TCSH) 491 session = new G4UITerminal(new G4UITerminal); 492 #elif defined(G4UI_USE_XM) 493 session = new G4UIXm(argc,argv); 494 #elif ... 495 </programlisting> 496 </informalexample> 497 That is not realy simple. The best way to do this is the <emphasis>second</emphasis> method : 498 <informalexample> 499 <programlisting> 500 #ifdef G4UI_USE 501 #include "G4UIExecutive.hh" 502 #endif 503 ... 504 505 // to instantiate a session of your choice and start the session 506 // G4UIExecutive will open for you the good driver (depending on G4UI_USE_xxx flags) 507 #ifdef G4UI_USE 508 G4UIExecutive* ui = new G4UIExecutive(argc,argv); 509 #endif 510 </programlisting> 511 </informalexample> 512 513 </para> 514 <para> 515 If the user wants to deactivate the default signal handler (soft abort) 516 raised by "Ctr-C", the false flag can be set in the second argument 517 of the <emphasis>G4UIterminal</emphasis> constructor like; 518 519 <informalexample> 520 <programlisting> 521 G4UIsession* session = new G4UIterminal(new G4UItcsh, false). 522 </programlisting> 523 </informalexample> 524 </para> 525 526 <para> 527 Again, environment variable must be preset to select a given interface. But for your 528 convenience, some of them are set by defaults. 590 591 <para> 592 A corresponding environment variable must be preset 593 to select a given interface. 594 But some of them are set by defaults for your convenience. 529 595 530 596 <itemizedlist spacing="compact"> … … 536 602 always built (see "G4UI_BUILD.gmk") and linked, so the user can 537 603 instantiate one of these sessions without rebuilding the libraries 538 and without setting any environment variables. For backwards 604 and without setting any environment variables. 605 <!--For backwards 539 606 compatibility with user code, as typified by geant4/examples main 540 607 programs, the C-pre-processor variables corresponding to the … … 545 612 if he/she sets no environment variables, then the C-pre-processor variable 546 613 <emphasis role="bold">G4UI_USE_TERMINAL</emphasis> is set by default, 547 although there is no need to use it. 614 although there is no need to use it.--> 548 615 </para></listitem> 549 616 <listitem><para> 550 617 The environment variable <emphasis role="bold">G4UI_USE_XM</emphasis>, 551 <emphasis role="bold">G4UI_USE_QT</emphasis> or618 <emphasis role="bold">G4UI_USE_QT</emphasis>, <emphasis role="bold">G4UI_USE_XAW</emphasis> or 552 619 <emphasis role="bold">G4UI_USE_WIN32</emphasis> must be set to use the 553 620 respective interface. The file "$G4INSTALL/config/G4UI_USE.gmk"
Note: See TracChangeset
for help on using the changeset viewer.