'\"macro stdmacro
.if n .pH g1.buildmenu @(#)buildmenu	40.2 of 12/29/89
.\" @(#)buildmenu.1 1.4 89/07/21 ; (c) 1989 - Sun Microsystems, Inc.
.nr X
.if \nX=0 .ds x} BUILDMENU 1 "10 Jul 1989" "\&"
.if \nX=1 .ds x} BUILDMENU 1 "10 Jul 1989"
.if \nX=2 .ds x} BUILDMENU 1 "" "\&"
.if \nX=3 .ds x} BUILDMENU "" "" "\&"
.TH \*(x}
.IX buildmenu#(1) "" "\fLbuildmenu\fP(1)"
.SH NAME
buildmenu \- builds an OpenWindows (tNt) Menu from a SunView style menu file.
.SH SYNOPSIS
.B buildmenu
[
.B \-root
]
[
.BI \-title " title"
]
[
.BI \-position " position"
]
[
.B \-pinnable
]
[
.I menufile
]

.SH DESCRIPTION
.LP
.I buildmenu
converts a SunView style menu file into the NeWS toolkit PostScript commands to
build the same menu under X11/NeWS.
.LP
If the filename is missing, the menufile is read from ~/.openwin-menu.
If the filename is '-', the menufile is read from stdin.
In any case, the PostScript language is written to stdout.
.LP
The expected usage would be for the user to \fIinsert\fP a submenu into the
default root menu rather than simply copying the default root menu and
modifying it.
.LP
For example if you have a SunView style menu in ~/.mymenu you would put this
line in your .openwin-init to append your menu to the default
X11/NeWS root menu.
.LP
.B "buildmenu ~/.mymenu -position 99 -title \(lqMy Tools\(rq -pinnable | psh"

.SS The OpenWindows Menu File Format
.LP
The file $OPENWINHOME/lib/openwin-menu contains the specification of the
default root menu.  You can change the menu by creating your
own file and storing it in your home directory with the name .openwin-menu.
.LP
Lines in the file have the following format:  The left side is a menu item to
be displayed, and the right side is a command to be executed when that menu
item is chosen.  Lines may be continued to the next line by putting a backslash
at the end of the line to be continued.  Blank lines and comment lines
beginning with '#' are ignored.
.LP
The menu items can be any string as long as strings with embedded blanks are
delimited by double quotes.  The SunView notion of having the full pathname of
an icon file delimited by angle brackets is unsupported and the basename(1) of
the icon file is used as the item label in place of the icon.
.LP
There are five reserved-word commands that can appear on the right side.
.TP 15
.B EXIT
Exit the server (requires confirmation).
.TP 15
.B REFRESH
Redraw the entire screen.
.TP 15
.B MENU
This menu item is a pull-right item with a submenu.  If a filename follows the
MENU command, the submenu contents are taken from that file, (shell varaiables
and ~'s are interpreted correctly).  Otherwise, all the lines between a MENU
command and a matching END command are added to the submenu.
.TP 15
.B END
Mark the end of a nested submenu.  The left side of this line should match the
left side of a line with a MENU command.  If the string PIN follows the END
command then this submenu has an OpenLook pin on it.
.TP 15
.B POSTSCRIPT
This rest of the line is to be directly interpreted as PostScript language code
when the item is invoked.
.LP
If the command is not one of these five reserved-word commands, it is treated
as a command line and executed.  Full shell interpretation is done on the
commands.
.SS "Here is a menu file that demonstrates all of these features"
.LP
.sp .25
.ta +20n; +20n; +20n; +20n
.TP 20n
"Mail reader"	mailtool
.PD 0
.TP
"My tools"	MENU	~/.rootmenu
.TP
"Click to type"	POSTSCRIPT	/ClickFocus setfocusmode
.TP
"Follow mouse"	POSTSCRIPT	/CursorFocus setfocusmode
.TP
"Print selection"	news_selection | lpr
.TP
"Nested menu"	MENU
.TP
	"Command Tool"	cmdtool
.TP
	"Shell Tool"	shelltool
.TP
"Nested menu"	END	PIN
.TP
Repaint	REFRESH
.TP
Quit	EXIT


.SH OPTIONS
.TP 5
.B \-root
This replaces the existing rootmenu rather than inserting or changing an
item in it.  OpenWindows uses this mode to install your default menu from
~/.openwin-menu or $OPENWINHOME/lib/openwin-menu if ~/.openwin-menu does
not exist.
.TP 5
.BI \-title " title"
This sets the name of the menu item you wish to insert.  If there already
exists an item in the root menu with the label "\fItitle\fP" then this menu
item is replaced by this menu.  If you have also set
.B \&-root
above then
this sets the title of the root menu.
.TP 5
.BI \-position " position"
This sets where you would like this item to be inserted in the root menu.
This option has no effect if you specify \fI-root\fP, since you are replacing
the whole root menu.  The default is 0, meaning insert at the beginning of
the root menu.
.TP 5
.B \-pinnable
This makes the top level menu you are inserting have an OpenLook pin.  The
default is to not have one.

.SH FILES

$OPENWINHOME/lib/openwin-menu

.SH "SEE ALSO"
  xnews(1)
