next up previous contents index
Next: Non-Motif Resources Up: Customizing tnimage Previous: Customizing tnimage   Contents   Index


X Window Resources

Each of the Motif widgets in tnimage has resources that can be individually set, by specifying the widget's name in your .Xdefaults or Tnimage file (in /var/X11R6/lib/app-defaults/). These files also interact with the X Window keymapping which can be changed with xmodmap.

As an example, suppose for some bizarre reason it was desired to make the 'Del' key actually delete the character under the cursor. One way of doing this is as follows:

1. Create a keymap file: xmodmap -pke > keymaps

2. Edit the line for keycode 91 to read: keycode 91 = 0x004 . (The keycode can be obtained using xev).

3. Load the new key translation table: xmodmap keymaps . Pressing the Del key now creates an 0x004. ('Delete' or some valid key name could also be used -- these are listed in the file /usr/X11/include/X11/keysym.h).

4. Alternatively, edit .Xdefaults in your home directory and add the line:

tnimage*Editor*Translations: #override $ \backslash$n $ \backslash$

$ <$Key$ >$ 0x4: delete-next-character() $ \backslash$n

(Note this must be entered exactly; in particular, the number must be 0x004 in the keymap file but 0x4 in the .Xdefaults file.

5. The change will now take effect in the Macro Editor only. On some systems, it may be necessary to restart the window manager for the new key to take effect. Leaving out the ``*Editor'' portion will cause the change to take effect in all Widgets.

Some of the important widgets in tnimage are:

Editor - macro editor (Text)

MenuBar - the top menu bar (MenuBar)

f101 to f199 - the menu items for first menu (``File'') (PushButton)

f201 to f299 - the menu items for second menu (``Image'') (PushButton)

etc

drawing_area - the main drawing window (DrawingArea)

drawing_area2 - the status area at left (DrawingArea)

Image - all the images (DrawingArea)

List - list selection boxes (ScrolledList)

Each of these has an extensive set of resources (such as fonts, colors, etc) that can be modified. For instance, Text Widgets have delete-next-word(), cut-clipboard(), page-left(). Refer to the X Window system manuals for details.

Here are additional examples. More specific settings will override more general ones.

tnimage*drawing_area2*background:green -Sets the left drawing area to ``green''.

tnimage*drawing_area2*background:#2233AA -Sets the left drawing area to red=22, green = 33, and blue=AA hex (34, 51, and 170 decimal, respectively).

tnimage*drawing_area*background:#223344

tnimage*MenuBar*background:#223344

To set the main drawing window color, select ``colors...set colors'', then select ``erase background''.

tnimage*Open*fontList: -adobe-courier-medium-r-normal-0-0-0-0-m-0-iso8859-1 Sets the font for the Open button on the information window at left. This can improve the appearance if the default font on your system is too big.

tnimage*XmToggleButton*fontList: *-courier-medium-r-normal-0-0-0-0* Sets the font for all toggle buttons

tnimage*marginHeight: 0 Sets the height of the margin in all widgets

tnimage*marginWidth: 0 Sets the height of the margin in all widgets

tnimage*foreground: black Sets the widget text color

tnimage*background: gray Sets the background color (Foreground and background colors of the main drawing area are set separately, from within tnimage).

tnimage*shadowThickness: 1 Sets the depth of shadows on all buttons

tnimage*MenuBar*spacing: 3 Sets the separation between items on menus

tnimage*MenuBar*background: gray Sets the color of menu bar

tnimage*MenuBar*fontList: *helvetica-bold-r-normal-12*
Sets the font for the top menu bar

tnimage*fontName: *times-bold-r-normal-12* Sets the default font

tnimage*information_area.foreground:black Sets the text color of the information area at the left

tnimage*information_area.background:gray Sets the background color of the information area at the left

tnimage*list*fontList:*times-bold-r-normal-12* Sets the font in list boxes to times bold (Not recommended, a fixed width font should be used).

These resources control the appearance of the file selection dialog:

tnimage*FileSelector*background: gray

tnimage*FileSelector*foreground: black

tnimage*FileSelector*fontList:*helvetica-bold-r-normal-12*

tnimage*FileSelector*marginWidth: 5

tnimage*FileSelector*marginHeight: 5

tnimage*FileSelector*listVisibleItemCount: 30 Sets the number of files to show at a time

tnimage*FileSelector*borderWidth 0

Other miscellaneous examples:

tnimage*Editor*foreground: black Color of text in text editor

tnimage*Editor*background: gray Color of text editor

tnimage*Editor*fontList:*helvetica-bold-r-normal-12* Font for text in editor

tnimage*Warning*background: red Set warning messages to red

tnimage*OK*background: red

tnimage*Cancel*background: white

tnimage*Help*background: blue Set the OK, Cancel, Help buttons to red, white, and blue, respectively

tnimage*f101*background: red set the 1st item in the first menu to red.

tnimage*borderWidth: 2000000000 Add a border 2 billion pixels wide around each image (Not recommended).

tnimage*borderColor: papaya whip Change image border to papaya whip.

The labels and fonts for the dialog boxes may also be individually set. In this case, the resource name is the default string for the label. This also permits non-English labels to be substituted. For example:

tnimage*DialogForm*fontList: *helvetica-bold-r-normal-12*

tnimage*DialogForm*radiobox*fontList: fixed

tnimage*DialogForm*boxbutton*fontList: fixed

tnimage*DialogForm*boxtext*fontList: fixed

tnimage*DialogForm*boxpushbutton*fontList: fixed

tnimage*DialogForm*boxfilename*fontList: fixed

tnimage*fontList: hanzigb16st This sets all fonts to Chinese. For fonts encoded by multibyte strings (such as Chinese fonts), the label string and your locale must also be changed.

tnimage*Interaction mode.labelString: Information at your fingertips

tnimage*DialogForm*File type.labelString: This is a feature

tnimage*DialogForm*Read Image.labelString:
Where do you want to go today

These three resources change the text in the menu from ``Interaction mode'', `` File type'', or ``Read image'' to the corresponding commonly-used computer terms. The latter two text labels are changed only if they occur in a DialogForm Widget.

tnimage*DialogForm*Filename.labelString: µµÃû

(An example of a foreign-language font; may not display correctly on all systems)

The time interval (in msec) between double-clicks may also be changed. For example:

tnimage*XmFileSelectionBox*doubleClickInterval: 1000

sets it to 1 sec. Unfortunately, the requirement for double-clicking itself is a limitation of Motif and cannot be easily removed.

Capitalization and spacing of the original label must be specified exactly. More specific settings override less specific ones. For example, the combination

tnimage*OK*fontList: *helvetica-bold-r-normal-12*

tnimage*DialogForm*OK*fontList: *helvetica-bold-r-normal-24*

will set a size of 24 for the OK button in dialog boxes and 12 elsewhere.

If the specific resource name is unknown, it may still be set by specifying the general Motif class name beginning with Xm. This is true for any Motif program. For example:

tnimage*XmMessageBox*marginHeight: 5

Sets the vertical margin around warning and information boxes

tnimage*XmMessageBox*marginWidth: 5

Sets the horizontal margin around warning and information boxes

tnimage*XmMessageBox*foreground: black

Sets the text color in warning and information boxes

tnimage*XmMessageBox*background: gray

Sets the color of warning and information boxes

tnimage*XmMessageBox*fontList: *helvetica-bold-r-normal-12*
Sets the font to use in warning and information boxes

tnimage*XmDialogShell*background: gray
Sets the color of dialog boxes, clickboxes, etc.

tnimage*XmDialogShell*foreground: black Sets the the text color of dialog boxes, clickboxes, etc.

tnimage*XmArrowButton.background: gray Sets the color of the four arrow buttons in the information area.

Note: if you rename tnimage, the .Xdefaults file should contain the actual name specified on the command line.

A number of other generic resources may also be set by specifying the Motif widget class (such as XmPushButton, XmList, etc.). In general, any resources (of which there are many) not explicitly hard-coded in the program can be set two different ways: by specifying the Xm class (such as ``XmFileSelectionBox''), or by specifying the name used in the program (such as``FileSelector''). The latter method permits specifying properties for each widget instead of all instantiations of the widget type. So in this spirit, below are listed the names of most of the main widgets used in the program.

Message boxes: Information Prompt Error Question YesNoQuestion Warning

Top menu bar: MenuBar

Arrow buttons at left: Button

OK buttons at bottom of dialog boxes: Slew OK Help Open Save Cancel No

Components of dialog boxes: radiobox label DialogForm

The main windows: Main drawing_area_form drawing_area2 frame information_area drawing_area

Images: Image

List boxes: List list drag_area GraphForm graph

Click box components: FileSelector Chdir Editor ClickboxForm MultiClickboxForm PrintItemForm EditForm Menu3DForm SamplePaletteColorForm SamplePalettePseudoForm

Menu items: f101 to f999.

Menus: fileMenu imageMenu processMenu colorMenu drawMenu aboutMenu configMenu helpMenu.

3D controls: Menu3DForm

More examples:

tnimage*fileMenu.background: LavenderBlush1 Sets the color of the file menu to ``Lavender Blush 1'' (See the file /etc/X11/rgb.txt for a list of valid color names, or use a 6-digit hex number such as ``#aa7733'').

tnimage*fileMenu*background: bisque Sets the color of the file menu, including the menu items, to ``bisque''.

tnimage*DialogForm.fontList:*helvetica-bold-r-normal-12*

tnimage*DialogForm*XmToggleButton*fontList:fixed

tnimage*DialogForm*XmPushButton*fontList:*times-bold-r-normal-12*

These 3 lines set the toggle buttons to ``fixed'' font, the push buttons to a times font, and everything else (i.e., the labels) to helvetica. Use `xlsfonts' to find what fonts are available on your system.

tnimage*List.XmLabel.fontList: *helvetica-bold-r-normal-12*
sets the labels in all lists to helvetica font, while

tnimage*List*fontList: *helvetica-bold-r-normal-12*
sets all text in all lists to helvetica font.

Notes

  1. Be conservative about setting all these widgets to different colors when using an 8-bit display. Each color used by a widget is one less color available for rendering images. In particular, the top menubar and individual menu items should be set to the same color, otherwise if tnimage starts up in ``modifiable colormaps'' mode, the menus may become unreadable. Modifiable colormaps mode is set automatically if there are fewer than 32 color entries available.

  2. Similarly, when running tnimage on an 8-bit display, it is advisable to close programs such as Netscape that allocate colors. Some window managers, such as Solaris' CDE, allocate most of the colors automatically, which can result in poor image quality. In Solaris, it is strongly recommended to set tnimage to use ``installed colormaps'' (see Sec. 11.4).

  3. Be careful not to put spaces after the setting in your .Xdefaults file or after font names in your tnimage.ini file. This will confuse Motif.
  4. Some resources, such as ``transient'', although legal, produce instability in Motif, and must not be put in .Xdefaults.


next up previous contents index
Next: Non-Motif Resources Up: Customizing tnimage Previous: Customizing tnimage   Contents   Index
root 2006-11-13