home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / maths / plplot / plplot_2 / drivers / tk / help_gui.t < prev    next >
Encoding:
Text File  |  1994-05-26  |  6.3 KB  |  142 lines

  1. # $Id: help_gui.tcl,v 1.9 1994/05/26 19:23:17 mjl Exp $
  2. # $Log: help_gui.tcl,v $
  3. # Revision 1.9  1994/05/26  19:23:17  mjl
  4. # Inserted missing CVS Id and Log fields.
  5. #
  6. #----------------------------------------------------------------------------
  7. # help_gui w
  8. #
  9. # Create a top-level window that displays info for On GUI.. help item.
  10. # Maurice LeBrun, IFS
  11. # Adapted from mkStyles.tcl from widget demo.
  12. #
  13. # Arguments:
  14. #    w -    Name to use for new top-level window.
  15. #----------------------------------------------------------------------------
  16.  
  17. proc help_gui {{w .help_gui}} {
  18.     catch {destroy $w}
  19.     toplevel $w
  20.     dpos $w
  21.     wm title $w "Help on GUI"
  22.     wm iconname $w "help_gui"
  23.     normal_text_setup $w 
  24.  
  25.     insertWithTags $w.t {\
  26.       The PLPLOT/TK user interface is constructed from TK widgets, using Tcl 
  27. as a (dynamic) specification language.  The Tcl scripts provided with PLPLOT
  28. control the layout of the user interface, initialization of the widgets, and
  29. some of the binding of actions to events.  Widgets, on the other hand, are
  30. all coded in C for speed.  
  31.  
  32.       The fundamental addition to PLPLOT to allow it to use Tcl/TK effectively
  33. has been the creation of a PLPLOT widget, called a "plframe".  It was
  34. originally based on the TK frame widget but has many enhancements, as well
  35. as close ties to the underlying graphics library.  The plframe widget can
  36. be created, mapped, and destroyed basically just like a TK frame widget.
  37. In addition, it supports numerous widget commands.
  38.  
  39.       The default PLPLOT/TK interface looks like a window with a top-level 
  40. menu bar, containing any number of frames devoted to plotting.  These child
  41. windows contain a bar with an end-of-plot indicator, a "Plot" menu, a forward
  42. page button (also a back page button when plrender is being used), and a
  43. region for issuing status or prompt messages (initially containing the main
  44. window name of the application).  Scrollbars appear to the right and bottom
  45. of the plframe when in zoom mode.  The actual plframe has no decoration, but
  46. interacts with all of the surrounding widgets.  The plframe and surrounding
  47. widgets should be considered as one entity.
  48.  
  49.       There are several ways in which the plframe widget can be utilized, but
  50. the most usual is via selection of the TK driver when running an
  51. application linked to PLPLOT.  The structure of the code then can be
  52. illustrated as follows:
  53.  
  54.  
  55.    Parent process               Communication        Child process
  56.                           channel
  57.  
  58.        User-code
  59.     |                           plserver
  60.    plplot TK driver                    |
  61.    Tcl interpreter <------- TK send -------> Tcl interpreter
  62.     |                     |
  63.        data writer  -------- named pipe- -----> plframe widget
  64.                            data reader
  65.                         |
  66.                          child X window
  67.  
  68.  
  69.       The user-code and the renderer (called } normal
  70.     insertWithTags $w.t {plserver} bold
  71.     insertWithTags $w.t {) form a client/server
  72. relationship, and are separate processes.  Under typical usage, where the
  73. user-code starts first, it forks (vfork on systems that support it) and execs
  74. the renderer.  Tcl/TK communication (via X properties) is used between their
  75. embedded interpreters to send commands back and forth.  An extended version
  76. of Tcl called Tcl-DP allows sockets to be used for this, and the model will
  77. eventually be extended to allow the user code and the renderer to be running
  78. on different machines.  The existence of an interpreter in each process
  79. (actually each plplot stream that uses the TK driver) allows for a very easy
  80. and robust method of sending commands between processes.  The data goes
  81. through via an alternate channel for maximum speed.
  82.  
  83. Also supported are some alternate configurations:
  84.  
  85. (a) the server creates widgets, then launches applications passing the
  86.       name of the plframe widget to plot to.  You could launch multiple
  87.       codes, with each plotting into a specific widget.
  88.  
  89. (b) the server creates widgets, then calls functions to do the actual
  90.       plotting.  This is in fact the easiest configuration since all the
  91.       work is done in one process, but has the disadvantage that the
  92.       user interface goes "dead" while the calculation is proceeding.
  93.  
  94.       By offloading the GUI-building code into a simple script language, it 
  95. becomes easy to build menus, buttons, scrollbars, etc.  All of these are
  96. configurable by the user, as well as the ability to map events (such as
  97. button presses) to functions calls in your own program. Note: the
  98. alternate configurations as well as the customization options are not yet
  99. fully tested.
  100.  
  101.       Most of the currently supported operations of the PLPLOT/TK user 
  102. interface are self-explanatory, and can be understood with a bit of
  103. experimentation.  Better documentation will eventually follow.  Some
  104. points to remember:
  105.  
  106.     1. When the plframe widget is created, it grabs the input focus to
  107. allow easy advancement to the next plot by hitting <Return> (note: TK focus
  108. doesn't behave quite the same as under other X toolkits).  However it is
  109. possible for it to lose the focus by bringing up help windows and such.  If
  110. the user interface seems to be responsive, try moving the mouse cursor into
  111. the window you want to receive the input.  Most widgets (including plframe)
  112. will grab the focus when you move the cursor into their window.
  113.  
  114.     2. There are sometimes keyboard-based shortcuts.  The ``OK'' button
  115. at the bottom of most dialogs can typically be selected by hitting <Return>.
  116. You can move between multiple input entries in a dialog by hitting <Tab>.
  117. The text widgets used in the help entries can be scrolled by using the
  118. up and down arrow keys, page up or page down keys, space, backspace, and
  119. delete keys.
  120.  
  121.     3. A good way to customize the resources (fonts, colors, etc) used
  122. in the interface is to copy the plconfig.tcl file, modify it according to
  123. taste, then put it into a directory where it will be found at startup.  Also
  124. a tclIndex file must be created for it (``plserver -mkidx'' will do this) and
  125. put in the same directory.  The Tcl interpreter searches directories for
  126. commands in the following order:
  127.  
  128.      user-specified directory(s)    (set by -auto_load argument)
  129.      Current directory
  130.      ${PLPLOT_DIR}/tcl
  131.      ${HOME}/tcl
  132.      INSTALL_DIR/tcl
  133.  
  134. where HOME and PLPLOT_DIR are environmentals, and INSTALL_DIR is
  135. set during installation (typically /usr/local/plplot).
  136.  
  137. I'll probably think of more later..
  138. } normal
  139.     $w.t configure -state disabled
  140.     $w.t mark set insert 0.0
  141. }
  142.