XWINDOW Name
XWINDOW Purpose
This routine implements a "smart" resizeable graphics window.
It is used as a wrapper for built-in IDL graphics procedures
such as SURFACE, CONTOUR, PLOT, SHADE_SURF, etc. In additon,
it can be used to display any user-written graphics procedure
so long as that procedure follows three simple rules: (1) It
does not open it's own graphics windows, (2) It is defined with
no more than ten positional arguments (an unlimited number
of keyword arguments are allowed), and (3) It is defined
with an _EXTRA keyword.
Keyword arguments permit the window to have its own portion
of a color table and to be able to change the colors loaded in
that portion of the color table. Colors are updated
automatically on both 8-bit and 24-bit color displays. In
addition, the window colors can "protect" themselves. I mean
by this that the window can re-load its own colors into the
color table when the cursor is moved over the window. This
prevents other applications from changing the colors used to
display data in this window. (This is an issue mainly in
IDL 5.x applications where widget applications can run
concurrently with commands from the IDL command line.)
Keyword arguments also permit the window to create output
files of its contents. These files can be color and
gray-scale PostScript, GIF, TIFF, or JPEG files.
Author
************* CM 19 Jan 1999 VERSION **********
Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
craigm@lheamail.gsfc.nasa.gov
Originally by:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
Category
Widgets, Graphics. Calling Sequence
XWINDOW, command, P1, P2, ... , keywords=..., ...
Required Inputs
COMMAND: The graphics procedure command to be executed. This parameter
must be a STRING. Examples are 'SURFACE', 'CONTOUR', 'PLOT', etc.
Optional Inputs
Pn: A positional parameter appropriate for the graphics command.
Any number of parameters between 0 and 10 may be given.
Input Keyword Parameters
CPMENU: Setting this keyword adds a "Color Protection" button to the
"Controls" menu. Color protection can then be turned ON or OFF for the
window. Otherwise, the color protection scheme used to open the window
cannot be changed once the window is open. (See the PROTECT keyword.)
The default is to have this keyword OFF.
ERASE: Setting this keyword "erases" the contents of the current
graphics window before re-executing the graphics command. For example,
this keyword might need to be set if the graphics "command" is TVSCL.
The default is to NOT erase the display before reissuing the graphics
command.
_EXTRA: This keyword forms an anonymous structure of any unrecognized
keywords passed to the program. The keywords must be appropriate
for the graphics command being executed.
GROUP_LEADER: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
OUTPUT: Set this keyword if you want a "File Output" menu on
the menu bar. The default is to have this item turned OFF.
JUST_REGISTER: If this keyword is set, the XWINDOW program is just
registered with XMANAGER, but XMANAGER doesn't run. This is
useful, for example, if you want to open an XWINDOW window in
the widget definition module of another widget program.
NO_CHANGE_CONFIG: Normally as the XWINDOW graphics window is resized
the size (or aspect ratio, in the case of PostScript) of the
hardware configuration dialogs change to reflect the new size of
the graphics window. This results in file output that resembles
the current graphics window in size and aspect ratio. If you want
the file output dialogs to remember their current configuration
even as the window is resized, set this keyword.
NOMENU: Setting this keyword results in a graphics window without
menu items. The default is to have a "Controls" menu item in the
window menu bar with a "Quit" button. Setting this keyword
automatically turns of the COLORS, OUTPUT, and CPMENU menu
choices. (Note that the values specified by the COLORS keyword
will still be valid for color protection, but no "Change Colors..."
menu item will appear.)
PROTECT: If this keyword is set, color protection for the draw
widget is turned ON. What this means is that the window colors
(see the XCOLOR keyword) will be restored when the cursor enters
the draw widget window. This prevents someone at the IDL command
line in IDL 5.0 from changing the window display colors permanently.
WTITLE: This is the window title. It is the string "Resizeable
COMMAND Window (1)" by default, where COMMAND is the input
parameter. And the number (1 in this case) is the window
index number of the draw widget.
WXPOS: This is the initial X offset of the window. Default is to
position the window in the approximate middle of the display.
WYPOS: This is the initial Y offset of the window. Default is to
position the window in the approximate middle of the display.
WXSIZE: This is the initial X size of the window. Default is 400
pixels.
WYSIZE: This is the initial Y size of the window. Default is 400
pixels.
XCOLORS: Using this keyword adds a "Change Colors..." button to the
"Controls" menu. Set this keyword to the number of colors available
in the window and the starting index of the first color. For example,
to allow the window access to 100 colors, starting at color index 50
(i.e., color indices 50 to 149), use XColor=[100, 50]. If you use the
keyword syntax "/XColor", all the colors available will be used, not just
one color. If the keyword is set to a scalar value greater than 1, the
starting color index is set to 0. The default value for this keyword
is [(!D.N_COLORS < 256), 0]. Note that color "protection" may be
turned on (via the PROTECT keyword) even if this keyword is NOT used.
Output Keyword Parameters
DRAWID: This keyword returns the draw widget identifier of the draw
widget created in XWINDOW.
TOP: This keyword returns the identifier of the top-level base widget
created by XWINDOW.
WID: This keyword returns the window index number of the draw widget
created in XWINDOW.
Common Blocks
None.
Side Effects
If color protection is ON, the window colors are reloaded when the
cursor enters the XWINDOW graphics windows.
RESTRICTIONS: This program requires three additional programs from
the Fanning Software Consulting library: PSWINDOW, PS_FORM (CM
version; available at
http://astrog.physics.wisc.edu/~craigm/idl), and XCOLORS. You
might also want to get the program TVIMAGE if you will be
displaying images in XWINDOW graphics windows.
If the "command" program requires keywords that are also keywords
to XWINDOW, then you must use the keyword twice on the command line.
Example
To display a surface in the window, type:
XWINDOW, 'SURFACE', Dist(20), Charsize=1.5
To enable the Change Colors and File Output menu items, type:
XWINDOW, 'SHADE_SURF', Dist(30), /XColors, /Output
Modification History
Written by: David Fanning, October 96.
XSIZE and YSIZE keywords changed to WXSIZE and WYSIZE so as not to
conflict with these keywords on other programs. 14 April 1997, DWF.
Updated as non-blocking widget for IDL 5.0. 14 April 1997, DWF.
Extensively modified to work on either 8-bit or 24-bit displays,
to enable color protection schemes, to send the contents to a
number of different output files, and to give the user choices
about which menu items to enable. 21 April 1997, DWF.
Renamed COLORS keyword to XCOLORS and fixed a problem cancelling
out of File Configuration dialogs. 23 April 1997, DWF.
Modification: Craig Markwardt, 21 October 1997
Added capability for up to ten positional parameters
Modification: CM 15 May 1998
PS_FORM dependencies are not hardcoded now. Requires
CM version of PS_FORM function.
Modification: CM 19 Jan 1999
Added Parent keyword to widget invocation of PS_FORM, and
make widgets MODAL-safe.