Ignore:
Timestamp:
Dec 16, 2009, 12:14:47 PM (15 years ago)
Author:
garnier
Message:

CVS update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/GettingStarted/graphicalUserInterface.xml

    r1213 r1222  
    22<!--                                                          -->
    33<!--  [History]                                               -->
     4<!--    Converted to DocBook: Katsuya Amako, Aug-2006         -->
    45<!--    Update G4UIExecutive : Laurent Garnier, Dec-2009      -->
    5 <!--    Converted to DocBook: Katsuya Amako, Aug-2006         -->
     6<!--    Reviced : Koichi Murakami, Dec-2009                   -->
    67<!--                                                          -->
    78<!-- ******************************************************** -->
     
    2829
    2930<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
     31The "intercoms" category provides an expandable command interpreter.
     32It is the key mechanism of Geant4 to realize secure user interactions
     33in all categories without being annoyed by the dependencies among categories.
     34<!--
     35The direct use
    3436of Geant4 classes in a C++ program offers a first ground level of
    3537interactivity, i.e., the batch session. As seen in the
    3638examples/novice/N01, Geant4 commands and macros are to be
    37 hard-coded in the program.
    38 </para>
    39 
     39hard-coded in the program.-->
     40The Geant4 commands can be used both in a interactive terminal session and
     41in a batch mode with a maco file or a direct C++ call.
     42</para>
    4043
    4144
     
    4952
    5053<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;
     54Geant4 can be controllled by a seriese of Geant4 UI commands.
     55The "intercoms" category provides the abstract class
     56<emphasis>G4UIsession</emphasis> that processes interactive commands.
     57The concrete implementation of (graphical) user interfaceis is located
     58in the "interfaces" category. This interfacing strategy opens an
     59important door towards various user interface tools,
     60and allows Geant4 to utilize the state-of-the-art GUI tools
     61such as Motif, Qt, and Java etc.
     62The richness of the collaboration realizes
     63various user interfaces to the Geant4 command system.
     64The following interfaces is currently available;
    6165
    6266<orderedlist spacing="compact">
    6367  <listitem><para>
    64   Character terminal (dumb terminal and tcsh(bash)-like terminal),
    65   the default user interface of Geant4,
     68  Character terminal (dumb terminal and tcsh-like terminal),
     69  that is the default user interface of Geant4
    6670  </para></listitem>
    6771  <listitem><para>
    68   Xm, Win32, Qt variations of the upper terminal by using a
    69   Motif, Qt or Windows widget to retrieve commands, and
     72  Xm, Xaw, Win32, Qt variations of the above terminal by using a
     73  Motif, Athena, Qt or Windows widget
    7074  </para></listitem>
    7175  <listitem><para>
    72   GAG, a fully Graphical User Interface and its network extension
     76  GAG, a fully graphical user interface and its network extension
    7377  GainServer of the client/server type.
    7478  </para></listitem>
     
    7781
    7882<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
     83Implementation of the user sesssions (1 and 2) is included
     84in the <literal>source/interfaces/basic</literal> directory.
     85As for GAG, the front-end class is included
     86in the source/interfaces/GAG directory,
     87while its partner GUI package MOMO.jar is available
     88under the <literal>environments/MOMO</literal> directory.
     89MOMO.jar, Java archive file, contains
    8790not only GAG, but also GGE and other helper packages.
    88 Supplementary information is available
    89 from the author's Webpage(see URL below).
     91Supplementary information is available 
     92from the author's web page (see URL below).
    9093</para>
    9194
     
    114117<para>
    115118These 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,
     120including <emphasis>cygwin</emphasis> on Windows.
     121
     122The 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
     176G4UItcsh supports user-friendly key bindings a-la-tcsh.
     177<emphasis>G4UItcsh</emphasis> runs on Solaris and Linux.
     178The following keybindings are supported;
    120179
    121180<variablelist>
     
    197256
    198257<para>
    199 In addition, the following string substitutions are supported;
    200 
     258The example below shows how to set a user's prompt.
     259<informalexample>
     260<programlisting>
     261  G4UItcsh* tcsh = new G4UItcsh();
     262  tcsh-> SetPrompt("%s&gt;");
     263</programlisting>
     264</informalexample>
     265
     266The following strings are supported as substitutions in a prompt string.
    201267<variablelist>
    202268  <varlistentry>
     
    219285  </varlistentry>
    220286</variablelist>
     287</para>
     288
     289<para>
     290Command history in a user's session is saved
     291in a file <literal>$(HOME)/.g4_hist</literal>
     292that is automatically read at the next session,
     293so that command history is available across sessions.
    221294</para>
    222295
     
    226299<sect3 id="sect.HowToSetUpInter.DescInter.G4UIXm">
    227300<title>
    228 <emphasis>G4UIXm</emphasis>, <emphasis>G4UIQt</emphasis> and
     301<emphasis>G4UIXm</emphasis>, <emphasis>G4UIXaw</emphasis>, <emphasis>G4UIQt</emphasis> and
    229302<emphasis>G4UIWin32</emphasis> classes
    230303</title>
     
    232305<para>
    233306These interfaces are versions of <emphasis>G4UIterminal</emphasis>
    234 implemented over libraries Motif, Qt and WIN32 respectively.
     307implemented over libraries Motif, Athena, Qt and WIN32 respectively.
    235308<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
     310widget, <emphasis>G4UIQt</emphasis> the Qt dialog widget,
     311and <emphasis>G4UIWin32</emphasis> the Windows "edit" component to do the
    238312command capturing. These interfaces are useful if working in
    239313conjunction with visualization drivers that use the Xt library, Qt library or
     
    243317<para>
    244318A command box is at disposal for entering or recalling Geant4 commands.
    245 Command completion by typing &amp;ldquo;TAB&amp;rdquo; key is
    246 available on the command line. The shell commands "exit, cont,
    247 help, ls, cd..." are also supported. A menu bar could be customized
     319Command completion by typing "TAB" key is
     320available in the command box. The shell commands "exit, cont,
     321help, ls, cd..." are also supported. A menu bar can be customized
    248322through the <emphasis>AddMenu</emphasis> and
    249323<emphasis>AddButton</emphasis> method. Ex:
     
    278352
    279353<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>,
     355less user friendly, runs on Unix with Athena widgets. <emphasis>G4UIQt</emphasis> run
    281356everywhere with Qt.
    282357<emphasis>G4UIWin32</emphasis> runs on Windows.
     
    307382<para>
    308383Client GUIs, GAG and Gain have almost similar look-and-feel. So,
    309 GAG's functionalities are briefly explained here. Please refer to
    310 the above URL for details.
     384GAG's functionalities are briefly explained here.
     385Please refer to the URL previously mentioned for details.
    311386</para>
    312387
     
    318393 an executable simulation program via pipes. Geant4's
    319394front-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;
     395communicate with GAG. GAG runs on Linux and Windows.  MOMO.jar can be run by a command;
    322396</para>
    323397
    324398<informalexample>
    325399<programlisting>
    326    %java -jar MOMO.jar
     400   %java -jar  $G4INSTALL/environments/MOMO/MOMO.jar
    327401</programlisting>
    328402</informalexample>
     
    335409    <term>GAG Menu:</term>
    336410    <listitem>
    337     The menus are to choose and run a GEANT4 executable file, to kill or exit
    338     a GEANT4 process and to exit GAG. Upon the normal exit or an
     411    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
    339413    unexpected death of the Geant4 process, GAG window are
    340     automatically reset to run another GEANT4 executable.   
    341     </listitem>
    342   </varlistentry>
    343   <varlistentry>
    344     <term>GEANT4 Command tree:</term>
    345     <listitem>
    346     Upon the establishment of the pipe connection with the GEANT4 process, GAG displays
     414    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
    347421    the command menu, using expandable tree browser whose look and feel is similar to
    348422    a file browser. Disabled commands are shown in opaque. GAG
    349     doesn &amp;rsquo;t display commands that are just below the root of
     423    doesn't display commands that are just below the root of
    350424    the command hierarchy. Direct type-in field is available for such
    351425    input. Guidance of command categories and commands are displayed
     
    375449    in the middle of a long session of execution. Log can be saved to a
    376450    file independent of the above redirection . GAG displays warning or
    377     error messages from GEANT4 in a pop-up warning widget.
     451    error messages from Geant4 in a pop-up warning widget.
    378452    </listitem>
    379453  </varlistentry>
     
    392466
    393467<para>
    394 The libraries that don't depend on external packages are created by default, using
    395 Geant4 configure scripts.
     468The libraries that do not depend on external packages are created by default,
     469using Geant4 configure scripts.
    396470They include <emphasis>G4UIterminal</emphasis>, <emphasis>G4UItcsh</emphasis>
    397471and <emphasis>G4UIGAG</emphasis> in libraries <emphasis>libG4UIbasic.a/so</emphasis> and
     
    401475
    402476<para>
    403 To make the libraries of <emphasis>G4UIXm</emphasis>,
     477To make the libraries of <emphasis>G4UIXm</emphasis>, <emphasis>G4UIXaw</emphasis>,
    404478 <emphasis>G4UIQt</emphasis> and
    405479<emphasis>G4UIWin32</emphasis> , respective environment variables
    406480<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
    408483<emphasis role="bold">G4UI_BUILD_WIN32_SESSION</emphasis> must be set
    409484explicitly before creating libraries.
     
    411486
    412487<para>
    413 However, if the environment variable <emphasis role="bold">G4UI_NONE</emphasis> is
     488If the environment variable <emphasis role="bold">G4UI_NONE</emphasis> is
    414489set, no interface libraries are built at all.
    415490</para>
     
    432507<para>
    433508To 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,
     510GAG, GainServer</literal>) in your program, there are two ways.
     511
    436512<itemizedlist spacing="compact">
    437    <listitem><para> Calling G4UIxxx directly :
     513   <listitem> Calling G4UIxxx directly :
    438514   <informalexample>
    439515   <programlisting>
     
    446522   </programlisting>
    447523   </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
    450548   <informalexample>
    451549   <programlisting>
     
    453551   </programlisting>
    454552   </informalexample>
    455    
    456    </para></listitem>
    457    <listitem><para>Using <emphasis>G4UIExecutive</emphasis> (implement in all novice examples) :
     553
     554If the user wants to deactivate the default signal handler (soft abort)
     555raised by "Ctr-C", the false flag can be set in the second argument
     556of 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.
    458571     <informalexample>
    459572     <programlisting>
     
    471584     </programlisting>
    472585     </informalexample>
    473 </para>
    474 </listitem>
     586   </listitem>
    475587</itemizedlist>
    476588</para>
    477589
    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>
     592A corresponding environment variable must be preset
     593to select a given interface.
     594But some of them are set by defaults for your convenience.
    529595
    530596<itemizedlist spacing="compact">
     
    536602   always built (see "G4UI_BUILD.gmk") and linked, so the user can
    537603   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
    539606   compatibility with user code, as typified by geant4/examples main
    540607   programs, the C-pre-processor variables corresponding to the
     
    545612   if he/she sets no environment variables, then the C-pre-processor variable
    546613   <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.-->
    548615   </para></listitem>
    549616   <listitem><para>
    550617   The environment variable <emphasis role="bold">G4UI_USE_XM</emphasis>,
    551 <emphasis role="bold">G4UI_USE_QT</emphasis> or
     618<emphasis role="bold">G4UI_USE_QT</emphasis>,   <emphasis role="bold">G4UI_USE_XAW</emphasis> or
    552619   <emphasis role="bold">G4UI_USE_WIN32</emphasis> must be set to use the
    553620   respective interface. The file "$G4INSTALL/config/G4UI_USE.gmk"
Note: See TracChangeset for help on using the changeset viewer.