Adding Menu Buttons
The heart of the SLD interactive one event display is its menu system.
This system has been set up in a such a way that it is easy
to add new buttons to an existing menu or to add whole new menus.
You simply create a constant file containing DSPUMNU banks and then
link these banks into the rest of the menu via a DSP USERDATA command
(a certain subclass of items can even be added to the menus on-the-fly
during the interactive session; see details later).
You define a number of different attributes for each menu button.
The menu button can call a prepmort routine, issue an IDA command,
call an IDA command file, redraw part of the picture, or define what
happens later when one picks on a piece of physics data.
Some menu buttons do simple things.
For example, the "X View" button in the main menu just rotates the
current picture so that the view is along the X axis.
Other buttons do more complicated things.
For example, the "Cluster Pick Gets Kal Closeup" button in the KAL menu
sets things up so that if one later picks on a KAL cluster,
the cluster is redrawn in more detail, the current view parameters are
saved, and the drawing is then rotated and zoomed to home in on the
cluster.
DSPMENU and DSPUMNU
The basic menu banks are defined by DSPMENU banks in DSPMENU CONSTANT.
You define additional menu banks by writing DSPUMNU (for User Menu)
banks, which the display system then merges into its dspmenu banks.
To do the merge, you issue the IDA command DSP USERDATA followed by
the filename of the constant file that contains the dspumnu banks.
In writing your new dspumnu banks, study the existing dspumnu banks
in KALUDSP, DBUDSP, CRDUDSP, and GEAUDSP CONSTANT
(and the basic dspmenu banks in DSPMENU CONSTANT).
The Contents of DSPUMNU
-
MENUNAME (required)
should be a unique name for each menu. It can be up to 8 characters.
If you are adding buttons to an existing menu,
use the menuname that has already been established for that menu.
If you want to create an entirely new menu,
just create an entirely new menuname.
Refer to DSPMENU CONSTANT and the KALUDSP, DBUDSP, CRDUDSP and
GEAUDSP CONSTANTs to see what menunames have already been established.
-
MENUCALL (optional, defaults to null)
is the name of a prepmort file to be called whenever one goes to this
menu. You will generally not need this.
-
ACTION (optional, defaults to patch)
is usually PATCH.
This means that the new menu buttons will be merged into any other
buttons already established for the given menuname.
If you instead specify action as REPLACE, any previously defined buttons
in the specified menuname will be deleted.
-
NUMLINES (required)
is the number of blocks you are going to provide for this dspumnu bank.
-
LINETEXT (required)
is the text string that will actually be written in the menu.
It can be up to 64 characters.
-
LINENAME (optional, defaults to null)
is a tag by which prepmort routines can locate this particular menu
button.
LINENAME is generally only needed for buttons that are to be toggled
automatically when some other button is toggled.
(By having routines look for this linename rather than a specific bank
and block number, we avoid getting tied to any specific menu order.)
Linename can be up to 8 characters.
Make sure it is different from any other linename in the same menu.
-
LINELOC (optional, defaults to 0., -.022)
is the position of the button relative to the previous button.
Lineloc(1) is the X position. Lineloc(2) is the Y position.
When you want to increase the vertical space between the new button
and the previous button, you increase the magnitude of Lineloc(2).
-.035 usually works well.
-
UGOPTS (optional, defaults to white, steady, medium)
gives the UG drawing options for the button.
It can be up to 20 characters.
You can specify white, black, blue, cyan, yellow, red, magenta, green,
blink, steady, vdim, dim, medium, bright or vbright.
You can specify more than one; just put commas in between.
-
BRANCH (required)
specifies what kind of button this is.
It can be up to 8 characters.
-
If BRANCH is some MENUNAME, then this button will transfer you to
another menu.
For example, when you have written an entirely new menu, you will
probably give the MAIN menu a button which is a branch to your new menu
(this is what the first dspumnu bank does in KALUDSP CONSTANT).
Any menu can contain a branch to any other menu.
-
If BRANCH is $PREV, then this button will transfer you to whatever
menu you were in previously.
-
If BRANCH is $EXIT, then this button will return you to IDA.
-
If BRANCH is $SAME, then this button will make no menu change.
-
If BRANCH is $NOPICK, then this button will be unpickable.
This is often used for headings for subsequent groups of buttons.
-
If BRANCH is $SKIP, then this button will not be drawn in the menu.
This is used to temporarily "comment out" an unwanted button.
-
If BRANCH is $TOGGLE, then this button will act like a toggle switch.
A diamond appearing at the left of the button shows which state the
switch is in. Any piece of code can check the state of this toggle.
All toggles need a LINENAME since it is by this linename that one
tells this toggle apart from other toggles.
-
ROUTINE (optional, defaults to null)
is the name of a prepmort routine that will be called when the button
is picked.
The routine can access the current values of the interactive
valuator dials (by calling the utility DSPRVAL; look at the header
of DSPRVAL PREPMORT for details).
ROUTINE can be up to 8 characters.
-
IDACOM (optional, defaults to null)
is a command string to be sent to IDA.
If it begins with @, it executes an IDA file.
Otherwise, it is a simple IDA command.
It can be up to 64 characters.
-
IDAFIRST (optional, defaults to false)
is used when the button has both a ROUTINE and an IDACOM.
By default, the routine will be called first, and then the idacom
will be executed.
But if you specify IDAFIRST true, the idacom will be executed first
and then the routine will be called.
-
LINEDAT (optional, defaults to null)
is an additional integer variable to be made available to the ROUTINE.
The routine can get this variable from DSPPARM%(LINEDAT).
It is usually not needed.
-
TFLAG (optional, defaults to false)
is used for the branch $TOGGLE.
It controls the initial state of the toggle.
If tflag is specified as true, the toggle will initially be set ON.
-
REDRAW (optional, defaults to false)
determines whether the picture will be redrawn when the button is
picked. The redraw action comes after any specified routine or idacom.
-
HISTROUT (optional, defaults to false)
specifies whether the ROUTINE is to lay a histogram on top of the
display. It makes the interface with handypak work.
-
HISTIDAC (optional, defaults to false)
specifies whether the IDACOM is to lay a histogram on top of the
display. It makes the interface with handypak work.
-
RECATYPE (optional, defaults to null)
can be an object type name (such as RDBCLUS), an asterisk followed
by an object group name (such as *KAL) or * (meaning all).
It specifies what object type or types are to be recalculated,
(similar to issuing a DSP RECALC command for this object type).
-
PICKSKIP (optional, defaults to false)
skip this menu item if running on a 3D device (these devices has a
true pick).
-
LOCASKIP (optional, defaults to false)
skip this menu item if running on a 2D device (these devices use a
locator rather than a true pick).
Pick Buttons
Certain $TOGGLE buttons can control what happens when the user
picks on a piece of data (a track, hit, cluster or so forth).
These toggles are distinguished by having a PICKTYPE.
-
PICKTYPE (optional, defaults to null)
can be an object type name (such as RDBCLUS), an asterisk followed
by an object group name (such as *KAL) or * (meaning all).
It determines what types of physics data this pick button will be
sensitive to.
For example, if PICKTYPE is MCPART, then once this button has been
toggled on, the specified PICKROUT and/or PICKIDAC will be called
whenever the user picks a MCPART.
-
PICKROUT (optional, defaults to null)
is the name of a prepmort routine that will be called when a subsequent
piece of physics data is picked.
The routine can get detailed information about what piece of physics
data was picked.
The object type name, parent bank index and (if any) parent block
index are available in
DSPPARM%(PKTNAM), DSPPARM%(PKBANK) and DSPPARM%(PKBLOCK).
The routine can also access the current values of the interactive
valuator dials (by calling the utility DSPRVAL; look at the header
of DSPRVAL PREPMORT for details).
PICKROUT can be up to 8 characters.
-
PICKIDAC (optional, defaults to null)
is a command string to be sent to IDA when a subsequent
piece of physics data is picked.
If it begins with @, it executes an IDA file.
Otherwise, it is a simple IDA command.
The IDA exec can get detailed information about what piece of physics
data was picked.
The parent bank index and (if any) parent block index are available in
the IDA variables DSPPKBAN and DSPPKBLO.
The object type name cannot be accessed directly since IDA does not
support string or character variables.
Instead, IDA execs can check the object type name via the DSP ISIT
command (see the DSP help file for details).
-
PICKIDAF (optional, defaults to false)
is used when the button has both a PICKROUT and a PICKIDAC.
By default, the routine will be called first, and then the idacom
will be executed.
But if you specify PICKIDAF true, the idacom will be executed first
and then the routine will be called.
-
PICKDATA (optional, defaults to null)
is an additional integer variable to be made available to the PICKROUT.
The routine can get this variable from DSPPARM%(LINEDAT).
It is usually not needed.
HISTROUT, HISTIDAC, RECATYPE and REDRAW mentioned above have slightly
different functions when the toggle has a PICKTYPE.
-
HISTROUT affects the PICKROUT rather than the ROUTINE.
-
HISTIDAC affects the PICKIDAC rather than the IDACOM.
-
RECATYPE and REDRAW take effect when the physics data is picked
rather than when the button is toggled.
More on Histogram Buttons
If your button has HISTROUT or HISTIDAC set true, the display will
do the work necessary to make your histogram appear as an overlay
on top of the display.
The histogram must be a single plot;
you cannot use QUAD, HEX and so forth.
-
If you are using HISTROUT, make sure your routine does not
attempt to do any DPSLCTs.
Your routine should include a DUT1 or DUT1A call.
-
If you are using HISTIDAC, your IDA command or ida file
should include an HOUT.
Adding Menu Buttons On-The-FLY
On-the-fly, during the interactive session, you can add a menu button
to the current menu.
Just hit PF 10 on the interactive device keyboard.
The power of such buttons is limited.
There is no way to add whole new menus on-the-fly.
You get to specify only the LINENAME,
IDACOM (or PICKIDAC for a pick button),
whether the button is to lay a histogram onto the display,
and PICKTYPE.
Still, since the idacom can be any IDA command and can execute any
IDA exec, these buttons can be quite powerful.
Joseph Perl
25 September 1997