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:
imal*Editor*Translations: #override
n
Key
0x4: delete-next-character()
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 imal 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.
imal*drawing_area2*background:green -Sets the left drawing area to ``green''.
imal*drawing_area2*background:#2233AA -Sets the left drawing area to red=22, green = 33, and blue=AA hex (34, 51, and 170 decimal, respectively).
imal*drawing_area*background:#223344
imal*MenuBar*background:#223344
To set the main drawing window color, select ``colors...set colors'', then select ``erase background''.
imal*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.
imal*XmToggleButton*fontList: *-courier-medium-r-normal-0-0-0-0* Sets the font for all toggle buttons
imal*marginHeight: 0 Sets the height of the margin in all widgets
imal*marginWidth: 0 Sets the height of the margin in all widgets
imal*foreground: black Sets the widget text color
imal*background: gray Sets the background color (Foreground and background colors of the main drawing area are set separately, from within imal).
imal*shadowThickness: 1 Sets the depth of shadows on all buttons
imal*MenuBar*spacing: 3 Sets the separation between items on menus
imal*MenuBar*background: gray Sets the color of menu bar
imal*MenuBar*fontList: *helvetica-bold-r-normal-12*
Sets the font for the top menu bar
imal*fontName: *times-bold-r-normal-12* Sets the default font
imal*information_area.foreground:black Sets the text color of the information area at the left
imal*information_area.background:gray Sets the background color of the information area at the left
imal*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:
imal*FileSelector*background: gray
imal*FileSelector*foreground: black
imal*FileSelector*fontList:*helvetica-bold-r-normal-12*
imal*FileSelector*marginWidth: 5
imal*FileSelector*marginHeight: 5
imal*FileSelector*listVisibleItemCount: 30 Sets the number of files to show at a time
imal*FileSelector*borderWidth 0
Other miscellaneous examples:
imal*Editor*foreground: black Color of text in text editor
imal*Editor*background: gray Color of text editor
imal*Editor*fontList:*helvetica-bold-r-normal-12* Font for text in editor
imal*Warning*background: red Set warning messages to red
imal*OK*background: red
imal*Cancel*background: white
imal*Help*background: blue Set the OK, Cancel, Help buttons to red, white, and blue, respectively
imal*f101*background: red set the 1st item in the first menu to red.
imal*borderWidth: 2000000000 Add a border 2 billion pixels wide around each image (Not recommended).
imal*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:
imal*DialogForm*fontList: *helvetica-bold-r-normal-12*
imal*DialogForm*radiobox*fontList: fixed
imal*DialogForm*boxbutton*fontList: fixed
imal*DialogForm*boxtext*fontList: fixed
imal*DialogForm*boxpushbutton*fontList: fixed
imal*DialogForm*boxfilename*fontList: fixed
imal*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.
imal*Interaction mode.labelString: Information at your fingertips
imal*DialogForm*File type.labelString: This is a feature
imal*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.
imal*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:
imal*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
imal*OK*fontList: *helvetica-bold-r-normal-12*
imal*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:
imal*XmMessageBox*marginHeight: 5
Sets the vertical margin around warning and information boxes
imal*XmMessageBox*marginWidth: 5
Sets the horizontal margin around warning and information boxes
imal*XmMessageBox*foreground: black
Sets the text color in warning and information boxes
imal*XmMessageBox*background: gray
Sets the color of warning and information boxes
imal*XmMessageBox*fontList: *helvetica-bold-r-normal-12*
Sets the font to use in warning and information boxes
imal*XmDialogShell*background: gray
Sets the color of dialog boxes, clickboxes, etc.
imal*XmDialogShell*foreground: black Sets the the text color of dialog boxes, clickboxes, etc.
imal*XmArrowButton.background: gray Sets the color of the four arrow buttons in the information area.
Note: if you rename imal, 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:
imal*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'').
imal*fileMenu*background: bisque Sets the color of the file menu, including the menu items, to ``bisque''.
imal*DialogForm.fontList:*helvetica-bold-r-normal-12*
imal*DialogForm*XmToggleButton*fontList:fixed
imal*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.
imal*List.XmLabel.fontList: *helvetica-bold-r-normal-12*
sets the labels in all lists to helvetica font, while
imal*List*fontList: *helvetica-bold-r-normal-12*
sets all text in all lists to helvetica font.