Configuration Guide |
Applications that run under Motif use resource files to set defaults for the GUI. The resource file controls how Motif and the application running under Motif appear and behave. You can set up the initial state; users can later change these settings to suit their preferences.
Resource Files |
Resource preferences are indicated by setting attribute/value pairs.
Panther applications use resource files to determine values for a variety of attributes. These include:
Each application can have an application-specific resource file. The name of this file is determined by the class name for the application. The class name for a Panther application is set by the argument to Panther's GUI initialization function. To change the class name for a Panther application executable, edit the argument supplied to the function At initialization, the main routine of a Panther application (usually either The default class name for all Panther software tools in the distributed software is Under Motif, resource file entries are formatted as colon separated attribute/value pairs:
The value is understood to be any text to the right of the colon. White space between the colon and In this example, Comments are indicated by starting the line with an exclamation point. Refer to your Motif documentation for a full explanation of resources and resource files.
A resource database is constructed from several sources, listed here in descending order of precedence:
Resource Filenames
sm_pi_xm_setup
in piinit.c
; for a Panther development executable, edit the argument to sm_pi_xm_jxsetup
in pijxinit.c
. These source files are in the distribution's link
directory.
jmain.c
or jxmain.c
) calls either the function sm_pi_init
or sm_pi_jxinit
to initialize the GUI. These routines in turn call sm_pi_xm_setup
or sm_pi_xm_jxsetup
, which sets the class name.
Prolifics
. Therefore the application-specific resource filename is Prolifics
.
Resource File Format
attribute:value
value
is ignored. In the following example, the attribute stackedWindowsAreDialogs
is set to false
:
Prolifics*stackedWindowsAreDialogs: False
Prolifics
is the class name. It restricts this resource to applications of the class Prolifics
. Resources can be further restricted to screens and even to individual widgets. The class name for a Panther application is determined at application initialization. You can also specify an instance name for an application via the standard Xt command line switch -name
.
Location of Resource Files
Xdefaults
file in the user's home directory .Xdefaults
resource settings supersede duplicate settings in all other resource files, and so can be used to set individual user preferences. If you change the .Xdefaults
file while the Motif Window Manager is running, reload the resource file with this command:
xrdb -load .Xdefaults
XAPPLRESDIR
. This file can contain the user's or site administrator's preferences./usr/lib/X11/app-defaults
. These resources are then global to all users of a particular application.Resources settings at each level override duplicate settings in lower-level resource files.
Colors |
Panther running under a GUI offers access to many more color choices than character-mode. You can use Motif resource files to map Panther colors to Motif colors. These colors can be used in widget and screen properties.
Panther defines sixteen basic colors—eight highlighted and eight unhighlighted. These colors are displayed on the editor's color palette (refer to "How to Set an Object's Color with the Color Palette" in Using the Editors):
The resource file can map basic Panther colors to any of the colors supported by Motif with this syntax:
Prolifics.prolColor: motifColor
prolColor
motifColor
rgb.txt
file on your system. For example:
Prolifics.blue: DarkSlateBlue
Refer to the Motif User's Guide for details.
Note:
To create custom color aliases beyond the sixteen basic colors, use the configuration map file—refer to "Configuration Map File" in Application Development Guide.
Prolifics.green: #00a800
You can use Motif resources to set an application's default background and foreground colors and the colors of individual widget types. You can do so provided the following conditions are true:
GUI
(refer to "Configuration Map File" in Application Development Guide).
How to Set an Application's Background and Foreground Colors
bg
and -fg
switches. For example:
In a resource file, use this syntax:
prodev -bg Yellow -fg Purple
Prolifics*background: motifColor
Prolifics*foreground: motifColor
motifColor
can be either a Motif color name or a hex value preceded by a # symbol.
This setting overrides any other foreground color for text widgets in applications of class Prolifics*XmText*foreground: blue
Prolifics
. A setting like the following changes the text widget for the specified screen vidscreen
:
Prolifics*vidscreen*XmText*foreground: blue
Motif colors are listed in the
Motif Colors
rgb.txt
file, often found in the directory /usr/lib/X11
. If your rgb.txt
file is located in a different directory, use the Prolifics.rgbFilename
:directory resource to point to it. The rgb.txt
file lists color names along with their red, green, and blue components. The colors are system dependent. Some common color names are listed in Table 4-1.
Resource Options |
This section describes resources that control behavior and the appearance of Panther running under Motif.
baseWindow
true
or false
:
focusAutoRaise
Prolifics*focusAutoRaise: true
fontList
Prolifics*fontList: fixed
Use a more fully qualified string to set fonts for parts of your application. For example, the following entry sets tooltip text to 18 point Helvetica:
Prolifics*toolbar*tooltip.fontList: *-helvetica-*-18-*
formMenus
formMenus
can be set to true or false:
baseWindow
is also false, then no menu bars appear at all.
formStatus
baseWindow
resource.
There are five levels of status messages:
d_msg_line
wait
field
ready
background
Background status messages can only appear in the base window. You can set formStatus
to true or false:
false
(default)—All status messages appear in the base window. Individual screens have no status line of their own. If there is no base window—that is, baseWindow
: false
—then there is no status line at all.
introPixmap
labelString
edit_cut
or edit_paste
. This statement sets the label for edit_cut
to Cut
:
Prolifics*XmMenuShell*edit_cut.labelString: Cut
mnemonic
edit_cut
or edit_paste
. This statement sets for edit_cut's
mnemonic to t
:
Prolifics*XmMenuShell*edit_cut.mnemonic: t
moveThreshold
positionIsFrame
The window manager can have a resource of the same name. The value of the Panther resource should match the value of the window manager.
pressAndMove
Combined Resource Settings |
You can combine resource settings in order to ensure compatibility with Windows and compliance with Motif standards, with respect to the appearance and behavior of menu bars and status lines:
Prolifics*baseWindow: true
Prolifics*formStatus: false
Prolifics*formMenus: false
Prolifics*baseWindow: true
Prolifics*formStatus: true
Prolifics*formMenus: true
Do not use application level menu bars or background status messages with this combination; they will not appear.
Prolifics*baseWindow: false
Prolifics*formStatus: true
Prolifics*formMenus: true
Restricted Resources |
The following items in the distributed Panther file must not be changed:
Prolifics*...*translations
Prolifics*keyboardFocusPolicy
Prolifics*...*traversalOn
You can change all other items, including Mwm*Prolifics*keyboardFocusPolicy
.
Global Resource and Command Line Options |
The resources in Table 4-2 are global settings that function on an application-wide basis. You can also specify them on the command line, as you can standard X Toolkit command line options. Refer to the X Toolkit manual for a full list of command line switches.
Table 4-2 Global resource options
The following illustrates a sample command line resource setting:
prodev -fg 'white' myscreen.scr
Widgets are arranged in a parent-child hierarchy. The tables in this section describe the widget hierarchy in Panther running under Motif. This information is required in order to set resources for particular widgets or classes of widgets in your application. Refer to the OSF/Motif Programmer's Guide
for more information on widgets, widget classes, and the resources associated with them.
The base screen in a Panther application is an ApplicationShell
widget. Its class is given by the first argument to the initialization routine, and its name is the name of the application program (the value of argv[0]
in main
). If the baseWindow
resource is set to false
, then this shell is created but never displayed.
Note: Avoid application program names that contain periods or asterisks; the resource parser interprets these as special characters. Periods that precede widget name extensions are exempt from this restriction: extensions are stripped from Panther names before Motif uses them.
By default, Panther has class name Prolifics
and application name prodev
or prorun
.
Table 4-3 lists the widget hierarchy for the base screen.
The status
area is used for the Panther status line in the base screen.
The creation of dialog boxes is handled by Panther in some cases, and by Motif in others. Table 4-4 lists the appropriate function or Motif resource associated with the creation of specific dialog box types:
Dialog box type | Created by |
---|---|
File selection |
sm_filebox library function |
Message |
Need to post message |
Error message |
|
Query message |
|
Panther specifies the message string, which buttons appear, and which button is the default. The Panther message call can specify the icon to appear. Other options, like the title bar text, can be set in the resource file.
Children of dialog boxes are handled by Motif. Refer to your Motif documentation for details.
The widgets used in Panther screens are all subclasses of the Motif shell
widget. The shell
's parent is the ApplicationShell
. Table 4-5 lists the widget hierarchy for Panther screens.
Panther screens have a status line only if the value of the formStatus
resource is true
. They have a menu bar only if formMenus
is true
.
New screens are named shell
before they are saved.
Because the name of the shell used for Panther screens is the screen name, resources can be restricted to a specific screen if you begin the specification with class*screen_name
. For example, Prolifics*vidscrn
... begins a specification for a screen named vidscrn
in an application of class Prolifics
. Resources restricted to a named screen are equivalent to screen property. For example:
Prolifics*vidscrn.background: gold
is the same as specifying a screen color property.
area
is the parent widget for all the widgets on a Panther screen. To place your own widgets on a Panther screen, you need the widget ID of area
. The library function sm_drawingarea returns the widget ID of
area
. A related function, sm_translatecoords, translates Panther screen coordinates into pixel coordinates relative to the upper left hand corner of
area
.
Panther widgets are created as child widgets of area
. If a widget has a name, its corresponding Motif widget gets the same name. If a field doesn't have a name, its Motif widget is named _fld
#, where # is the field number. In a named array consisting of multiple fields, each widget has the same name. Motif widgets that represent multiple fields take the name of the first field.
Motif variants of sm_widget such as sm_xm_widget return a widget ID. Asterisks in the table below indicate which widget is returned by sm_widget in cases where there is more than one possibility. If the widget returned by sm_widget is not the one you are looking for, use
XtParent
to obtain the widget ID of its parent. This is particularly useful when working with scale widgets and scrolling multiline and list box widgets.
Table 4-6 lists the widget hierarchy for Panther widgets. Some entries in the table have prefixes or suffixes with their names. For example, field
-nameSW
indicates that the widget's name is composed of the field's name followed by the characters SW
.
To refer to a whole class of widgets, use the widget class. For example, Prolifics
*XmText
refers to all text widgets. To refer to a class of widgets on a screen, use the screen name followed by the widget class. For example, Prolifics*empscreen*XmText
refers only to text widgets on the screen empscreen
. To refer to an individual widget, use the screen name followed by the widget's name. For example, Prolifics*empscreen*empname
refers only to the empname
widget on the screen empscrn
.
In the option menu widget, the text field and the popup pane are linked through the subMenuID
field of the RowColumn
widget. Because the push buttons in the option menu are named by their contents, it is easier to set a resource for all the push buttons in an option menu than it is to set a resource for an individual button.
Menus—instantiated as menu bars and their submenus, as popup menus, or as toolbars—are created within RowColumn
widgets. Menu bars are children of either the base screen's or an individual screen's MainWindow
. Submenus are children of MenuShells
, but the name of the shell is unclear, because Motif reuses these shells. If a new shell is created, its name is popup
_submenu-name
. Specify resources for a submenu as follows:
Prolifics*XmMenuShell.submenu-name
Table 4-7 lists the hierarchy for menus and popup menus.
Submenus pop up through the auspices of a CascadeButton
widget. A submenu is tied to its CascadeButton
via the XmNsubMenuID
field of the button.
Menu items are children of the menu's RowColumn
widget. Table 4-8 lists their hierarchy.
Toolbar items are children of the menu's RowColumn
widget. Table 4-9 lists their hierarchy.
Object | Name | Widget class |
---|---|---|
button |
|
|
separator |
|
|
Sample Motif Resource File |
!###########################################################
!### Geometry Resources ###
!###########################################################
! Set this to true if you use interactive placement for your
! window manager and want Prolifics to respect it. Default
! value is false if not specified.
Prolifics.interactivePlacement: false
! Set Geometry for the base window.
! Default
Prolifics.geometry: 635+0+0
! Use this as an example if Interactive Placement is set to
! true.
!Prolifics.geometry: 635
!############################################################
!### Double Click Resources ###
!############################################################
! Set your preference for double click time in thousandths of
! a second (e.g. 500 = 1/2 second). If you find that double
! clicks are being treated as separate clicks, then raise
! this value. If separate clicks are unexpectedly being
! treated as a double click, then lower this value.
Prolifics.multiClickTime: 400
!###########################################################
!### Color Resources ###
!############################################################
! Set the location of the X rgb color database file.
! This must be changed to reflect the site-specific location.
Prolifics.rgbFileName: /usr/lib/X11/rgb.txt
! Set any GUI colors in your color scheme.
Prolifics*foreground: white
Prolifics*background: dark slate gray
! Set the 16 Prolifics colors. These are mandatory, as
! Prolifics needs a way to map the 16 Basic colors to actual
! GUI values. But you can modify the values to suit your
! needs.
Prolifics.black: #000000
Prolifics.blue: #0000a8
Prolifics.green: #00a800
Prolifics.cyan: #00a8a8
Prolifics.red: #a80000
Prolifics.magenta: #a800a8
Prolifics.yellow: #a85400
Prolifics.white: #a8a8a8
Prolifics.hi_black: #545454
Prolifics.hi_blue: #5454ff
Prolifics.hi_green: #54ff54
Prolifics.hi_cyan: #54ffff
Prolifics.hi_red: #ff5454
Prolifics.hi_magenta:#ff54ff
Prolifics.hi_yellow: #ffff54
Prolifics.hi_white: #ffffff
!###########################################################
!### Screen Editor Resources ###
!############################################################
! Resources in this section only affect the operation of the
! Prolifics Screen Editor. They should be removed when
! supplying a resource file to your end-users.
! Determines how many pixels the mouse pointer must move in
! Edit Mode before being considered a drag.
Prolifics.moveThreshold: 6
! Set the path of the Editor help file. This must be set in
! order to use online Help within the Screen Editor.
! Prolifics.editorHelpPath: $SMBASE/docs/books
! Splits the Property Window drop down into two or more
! columns if more than 15 items appear, to ensure that all of
! the list is visible. Users of high-resolution monitors may
! use a higher threshhold as the value of numColumns: 30 on a
! 17" 1024x768 monitor, for instance.
Prolifics*smpropty*proptext_pane*packing: PACK_COLUMN
Prolifics*smpropty*proptext_pane*orientation: HORIZONTAL
Prolifics*smpropty*proptext_pane*numColumns: 15
!############################################################
!### General Resources ###
!############################################################
! Point this resource to an XPM, GIF or JPEG file to display
! when the application starts up.
Prolifics.introPixmap:
! Set this resource to display the application name on the
! base window ! title bar.
Prolifics.title: Prolifics for Motif
! Set this to false to remove all the extra insert cursors
! that Motif 1.2 displays by default. Defaults to true if not
! specified.
Prolifics*cursorPositionVisible: false
! Uncomment the following line to enable Tear-Off Menus.
! Tear-Off Menus are disabled by default.
!Prolifics*tearOffModel: TEAR_OFF_ENABLED
! Set the following resource to true to force all Prolifics
! stacked windows to be application modal dialogs. Defaults
! to false.
Prolifics*stackedWindowsAreDialogs: false
! Specify the application-wide default font. Use a more fully
! qualified string to set fonts for parts of your application
! (e.g. Prolfiics*message*fontlist for message boxes).
Prolifics*fontList: fixed
! Example of specifying the font for the tooltip text.
!Prolifics*toolbar*tooltip.fontList: fixed
! The following prevents file selection boxes from changing
! their size when the Filter button is pressed. This may be
! changed according to taste.Defaults to RESIZE_ANY if not
! specified.
Prolifics*XmFileSelectionBox.resizePolicy: RESIZE_NONE
! Newer filebox versions have a separate filter field.
Prolifics*XmFileSelectionBox.pathMode: PATH_MODE_RELATIVE
! Set the full path and name of the runtime help file. This
! option contains the name of the help file used by the
! external help system you've installed. The default value
! is empty.
Prolifics.helpFile:
! Under VMS, text widgets seem to grab the selection
! unless the following is set.
Prolifics*area*navigationType: NONE
!############################################################
!### Drag and Drop ###
!############################################################
! The Motif Drag and Drop protocol is often buggy in many
! commercial Motifs. In addition, it increases widget
! creation overhead and may affect performance. These
! resources are set to disable Motif Drag and Drop. This does
! NOT affect the ability to drag and drop widgets within the
! Prolifics Screen Editor. You may enable these resources by
! changing their values.
Prolifics*dragReceiverProtocolStyle: DRAG_NONE
Prolifics*dragInitiatorProtocolStyle: DRAG_NONE
Prolifics*dropSiteActivity: DROP_SITE_INACTIVE
!############################################################
!### Edit and Windows Menu Resources ###
!############################################################
! Text and mnemonics to be used in window and edit menu
! items.
Prolifics*XmMenuShell*windows_raise.labelString: Raise All
Prolifics*XmMenuShell*windows_raise.mnemonic: R
Prolifics*XmMenuShell*edit_cut.labelString: Cut
Prolifics*XmMenuShell*edit_cut.mnemonic: t
Prolifics*XmMenuShell*edit_copy.labelString: Copy
Prolifics*XmMenuShell*edit_copy.mnemonic: C
Prolifics*XmMenuShell*edit_paste.labelString:Paste
Prolifics*XmMenuShell*edit_paste.mnemonic: P
Prolifics*XmMenuShell*edit_delete.labelString: Delete
Prolifics*XmMenuShell*edit_delete.mnemonic: D
Prolifics*XmMenuShell*edit_select.labelString: Select All
Prolifics*XmMenuShell*edit_select.mnemonic: S
Prolifics*XmMenuShell*edit_clear.labelString: Clear
Prolifics*XmMenuShell*edit_clear.mnemonic: l
! The standard Prolifics key file for X, "xwinkeys", maps
! unmodified, shifted, and control function keys 1-12 into
! the Prolifics logical keysPF1-12, SPF1-12, and SFT1-12.
! This conforms to the standard key conventions used for
! Prolifics on character terminals.
! Unfortunately, these may conflict with the fallback or
! vendor-specific default bindings which Motif uses for its
! virtual keysyms. The following line disables all of the
! virtual keysyms within a Prolifics application. (Actually,
! the default binding for osfMenuBar is remapped to F25.
! If we were to unmap it, the Motif library would reset it
! to F10.)
! If you prefer the standard Motif usage for the function
! keys, you can change the Prolifics key file to avoid
! the keys which conflict with Motif.
! The following line can then be commented-out.
! If you retain any of the following, you must retain
! entries for both osfMenu and osfMenuBar or the
! program will crash on some versions of Motif.
! (You can change to which keys they are bound.)
Prolifics*defaultVirtualBindings: \n\
osfMenu: <Key>F26 \n\
osfMenuBar: <Key>F25 \n\
osfActivate: <Key>KP_Enter \n\
osfCancel: <Key>Escape \n\
osfDown: <Key>Down \n\
osfLeft: <Key>Left \n\
osfRight: <Key>Right \n\
osfUp: <Key>Up \n\
osfBackSpace: <Key>BackSpace \n\
osfDelete: <Key>Delete \n\
osfHelp: <Key>F1
!
! Sun CDE patches
!
Prolifics*enableToggleColor: false
Prolifics*enableCDEColorFactors: false
Prolifics*enableToggleVisual: false
Prolifics*enableEtchedInMenu: false