AVS Modules Application_Menu NAME ApplMenu - Read a menu description file and control the menu described there in. SUMMARY Name Application_Menu Availability Type input Inputs none Outputs none Parameters MenuFile "string" "browser" MenuChoice "string" "none" DESCRIPTION The ApplMenu module reads a menu description file and creates an AVS menu that conforms to this description. It also controls this menu and issues the appropriate CLI commands when various menu choices are made by a user. PARAMETERS MenuFile (string - filename) The Menu File is the file name of the menu description file to be used by ApplMenu. The menu may be reloaded at any time, old menu items will be removed and the new menu will be created. MenuChoice (string - no widget) The Menu Choice is a hidden parameter used to recieve the menu pick number. Users never need to worry about this parameter. MENU DESCRIPTION FILE SYNTAX A Menu File has a simple format. All lines are either blank, a comment (any line that begins with a #), or a command. All command lines have the same syntax: Command_Name : Command_Action There are only 5 Command_Name's that are recognized in a menu file: Init : cli command Menu : Pulldown menu name Action : Menu item name (initially enabled). ActionD: Menu item name (initially disabled). Cmd : cli command The colons are mandatory to seperate the Command_Name and the Command_Action. However, spacing and indenting makes no difference. The Init command will cause the CLI command following to be executed once when the menu is loaded for the Menu File. The Menu command will cause a new pulldown menu to be created with the name given as the Command_Action. All Action commands following a Menu will be part of that pulldown (until the next Menu command). The Action command will cause a new menu entry to be added to the current pulldown Menu. All Cmd commands following an Action will be part of that Action. The Cmd command will cause the CLI command following to be executed when the associated Action is selected from the menu. For simple actions, the Cmd may just be a single CLI command, but usually, there will be a script of CLI commands which will be sourced when the menu button is choosen. These may be any commands recognized by the AVS CLI interpreter. Often, commands will come in pairs, one to take some action and one to undo that action. In this case there will also be commands to disable the current option and to enable it's partner option. Currently, ApplMenu has the following limitations: Max. number of menu items (Action's) = 50 seperate menu buttons Max. length of a Menu or Action name = 30 characters Max. total size for all CLI Cmd's for 1 Action = 400 characters. Note: The above are simply constants that may be changed in the source. EXAMPLE The following is an example menu file. If the MenuFile parameter is set to read this file, a menu will be created with all of the pulldowns and actions described... ------------------------------------------------------------------------------ ### ### Menu file for 2D_Viewer application. ### # Initialize environment variables for this menu. Init : var_set NetDir -env AVSNET Init : var_set ScriptDir $NetDir/2Dscripts # Control menu selections. Menu : Control Action : Data Selection Cmd : present SelectPage Action : Viewer Cmd : present ViewerPage Action : Quit Cmd : net_clear # Viewer menu selections. Menu : Viewers Action : Disable Main Viewer Cmd : menu Viewers -disable "Disable Main Viewer" Cmd : module MainImageViewer -off Cmd : menu Viewers -enable "Enable Main Viewer" ActionD: Enable Main Viewer Cmd : menu Viewers -disable "Enable Main Viewer" Cmd : module MainImageViewer -on Cmd : menu Viewers -enable "Disable Main Viewer" Action : Disable Main ColorMap Cmd : menu Viewers -disable "Disable Main ColorMap" Cmd : net_read $ScriptDir/Remove_color.scr Cmd : menu Viewers -enable "Enable Main ColorMap" ActionD: Enable Main ColorMap Cmd : menu Viewers -disable "Enable Main ColorMap" Cmd : net_read $ScriptDir/Add_color.scr Cmd : menu Viewers -enable "Disable Main ColorMap" Action : Add Extra Viewer Cmd : net_read $ScriptDir/Add_viewer.scr # RGB menu selections. Menu : RGB Action : View RGB Cmd : menu RGB -disable "View RGB" Cmd : net_read $ScriptDir/Add_rgb.scr Cmd : menu RGB -enable "Remove RGB" ActionD: Remove RGB Cmd : menu RGB -disable "Remove RGB" Cmd : net_read $ScriptDir/Remove_rgb.scr Cmd : menu RGB -enable "View RGB" # Vectors menu selections. Menu : Vectors Action : Add Vectors Cmd : menu Vectors -disable "Add Vectors" Cmd : net_read $ScriptDir/Add_vectors.scr Cmd : menu Vectors -enable "Remove Vectors" ActionD: Remove Vectors Cmd : menu Vectors -disable "Remove Vectors" Cmd : net_read $ScriptDir/Remove_vectors.scr Cmd : menu Vectors -enable "Add Vectors" # Options menu selections. Menu : Options Action : Distance Measure Cmd : menu Options -disable "Distance Measure" Cmd : net_read $ScriptDir/Add_measure.scr Cmd : menu Options -enable "Remove Measure" ActionD: Remove Measure Cmd : menu Options -disable "Remove Measure" Cmd : net_read $ScriptDir/Remove_measure.scr Cmd : menu Options -enable "Distance Measure" Action : Profile Cmd : menu Options -disable "Profile" Cmd : net_read $ScriptDir/Add_profile.scr Cmd : menu Options -enable "Remove Profile" ActionD: Remove Profile Cmd : menu Options -disable "Remove Profile" Cmd : net_read $ScriptDir/Remove_profile.scr Cmd : menu Options -enable "Profile" # Output menu selections. Menu : Output Action : Add Postscript Cmd : menu Output -disable "Add Postscript" Cmd : net_read $ScriptDir/Add_ps.scr Cmd : menu Output -enable "Remove Postscript" ActionD: Remove Postscript Cmd : menu Output -disable "Remove Postscript" Cmd : net_read $ScriptDir/Remove_ps.scr Cmd : menu Output -enable "Add Postscript"