Previous IDL Interface Guide: Customizing IDL on Motif Systems Next

Using X Resources to Customize IDL

IDL on UNIX platforms respects the values of a number of X Window System (Motif) resources.

X Resources and IDL Preferences

Beginning with IDL 6.2, many values used to customize the appearance and behavior of IDL on UNIX platforms are stored in IDL preferences rather than in X resources. See IDL Preferences for a detailed description of IDL's preferences system.

To provide backwards compatibility with older versions, current versions of IDL are still able to check the values of X resources set in the user's .idlde or .Xdefaults files and transfer them, if found, to the corresponding IDL preference setting. The mechanism used is described in detail in Support for Obsolete Preference Mechanisms.

Not all X resources have corresponding preference values. Generally speaking, the X resource values that have not been implemented as preferences either control aspects of the appearance of the IDL Development Environment or define user macros. These values may become IDL preferences in a future version of IDL.

X Resources in Brief

The component widgets of an X Window System application each have two names, a class name that identifies its type (e.g., XmText for the Motif text widget) and an instance name (e.g., command, the name of the IDLDE command input text widget). The class name can be used to set resources for an entire class of widgets (e.g., to make all text widgets have a black background) while the instance name is used for control of individual widgets (e.g., set the IDLDE command input window font without affecting other widgets).

Applications consist of a tree of widgets, each having a class name and an instance name. To specify a resource for a given widget, list the names of the widgets lying between the top widget and the target widget from left to right, separated by periods. In a moderately complicated widget hierarchy, only some of the widgets are of interest; there are intervening widgets that serve uninteresting purposes (such as a base that holds other widgets). A star (*) character can be used as a wildcard to skip such widgets. Another fact to keep in mind is that a given resource specification is interpreted as broadly as possible to apply to any widget matching that description. This allows a very small set of resource specifications to affect a large number of widgets.

Resource Files

There are two resource files used to customize the IDL Development Environment. An installation-wide resource file called Idl is located in

$IDL_DIR/resource/X11/lib/app-defaults  

and a user resource file called .idlde is located in your home directory.

Modifying the global Idl resource file effects an installation-wide customization. Changes to the Idl file are not migrated when a new version of IDL is installed.

The user resource file, .idlde, customizes individual versions of IDLDE and is divided into two sections. The first section contains user-defined customization resources. You can place comments starting with "!" or "!!" in the first section of .idlde. When newer versions of .idlde are written, system comments are prefixed with "!!!". The second section of .idlde is used to store IDLDE preferences; it is modified when IDLDE preferences are modified via the Preferences tab of the Motif IDLDE, and should not be modified manually.


Note
IDLDE preferences saved in the .idlde file should not be confused with the IDL preference system included in IDL versions 6.2 and later. In some cases, values of the IDLDE preferences from the .idlde file are migrated to the newer preferences system; see Support for Obsolete Preference Mechanisms for details.

If you use IDL in command-line mode rather than via the IDL Development Environment, you can include resources in the .Xdefaults file located in your home directory.

Format of IDL Resources

IDL resource strings begin with the characters "Idl". Most of these resources have been superseded by preferences in the IDL preference system.

Resource strings that apply only to the IDL Development Environment begin with the characters "Idlde" or "idlde". For example, the resource

idlde*hideCommand  

controls whether the IDLDE Command Line is visible when IDL starts up.

Resources that include the string "idlde" must be included either in the system-wide Idl resource file, or in a .idlde file in your home directory. Resources that apply to IDL whether it is running in command-line mode or via the IDLDE can be included in either the system-wide Idl resource file or in a .Xdefaults file in your home directory.

To specify a value for an X resource, append a colon character and the value after the resource string. Whitespace is ignored. For example:

idlde*hideCommand:False  

is the same as

idlde*hideCommand:        False  

X Resources Used by IDL

IDL uses a large number of resources to control the behavior and appearance of the IDL Development Environment and any graphical application written in IDL. To learn more about the specific resources used, or to modify individual values, inspect the installation-wide resource file Idl, located in

$IDL_DIR/resource/X11/lib/app-defaults  


Note
In order to maintain backward compatibility with previous versions of IDL, the Idl resource file contains values for some resources that correspond to IDL preferences. X resources that have been superseded by preferences are ignored by IDL. See Support for Obsolete Preference Mechanisms for details.


Tip
We suggest that you use preferences rather than X resources when possible. If you must make changes to X resources, make the changes in a user-specific .idlde file or .Xdefaults file.

Reserving Colors

If you use a PseudoColor display device, when IDL starts, it attempts to secure entries in the shared system color map for use when drawing graphics. If the entry Idl.colors exists in one of the X resource files inspected by IDL at startup, IDL will first migrate the specified value to the value of the IDL_GR_X_COLORS preference, and then attempt to allocate the number of colors specified from the shared colormap. If for some reason it cannot allocate the requested number of colors from the shared colormap, IDL will create a private colormap. Using a private colormap ensures that IDL has the number of colormap entries necessary, but can lead to colormap flashing when the cursor or window focus moves between IDL and other applications.

One way to avoid creating a private colormap for IDL is to set the IDL_GR_X_COLORS preference equal to a negative number. This causes IDL to try to use the shared colormap, allocating all but the specified number of colors. For example, setting the preference value to -10 instructs IDL to allocate all but 10 of the currently available colors for its use. Thus, if there are a total of 220 colors not yet reserved by other applications (such as the windowing system), IDL will allocate 210 colors from the shared colormap.

The IDLDE application itself uses between 10-15 colors. On startup, the IDLDE will attempt to use colors in the shared colormap, but will reserve colors for itself if appropriate matching colors in the shared colormap are not found. As a result, running IDL with the IDLDE may use more colors than running IDL with the tty (plain command line) interface.


Note
If you use a TrueColor display device, IDL does not rely on the system's shared color map when drawing graphics. There is no need to either reserve colors from the shared color map or create a private color map.

  IDL Online Help (March 06, 2007)