Extending GUI Tool Menus


You may add commands to the GUI's Tools menu by making entries in your gui_setups file. You can either modify your site-wide gui_setups file located under $CSIM_ROOT/tools/$CSIM_MTYPE, where your CSIM package is installed, or you can create a local copy, modify your own copy, and set your GUI_SETUP_FILE environment-variable to point at your modified copy. For more information, see also GUI_SETUPS file.

To add commands to your Tools Menu, use the keyword EXTEND_TOOL_MENU in your gui_setups file, as in:
          EXTEND_TOOL_MENU   {label}   {command string}

Where label is the name to be added to the Tool menu, and command-string is the command to be executed when the item is selected.

For example, this is useful to make an easy way to invoke other tools or custom post-processing utilities that are specific to your project, or that you created on your own.
Example:
          EXTEND_TOOL_MENU   Generate_Stats_Plot   mygenplotter -xyz events.data

You can also add sub-menus by using the keyword EXTEND_TOOL_SUBMENU, as in:
          EXTEND_TOOL_SUBMENU {top_menu_label} {label} {command string}

Where top_menu_label is the name to be added to the Tool menu, label is the item that will appear on the sub-menu, and command-string is the command to be executed when the item is selected. You can have multiple items on a sub-menu, but they must be listed sequentially.

All menu items will appear in the same order they are listed in your gui_setups file.

A convenient usage of sub-menus is to list various command options for a given kind of post-processing.

Example:

	EXTEND_TOOL_SUBMENU  Plot_Traffic  Histogram_Plot  traffic_pp -histo Events.data
	EXTEND_TOOL_SUBMENU  Plot_Traffic  Scatter_Plot    traffic_pp -scatter Events.data
	EXTEND_TOOL_SUBMENU  Plot_Traffic  Line_Plot       traffic_pp -lines Events.data

If you wish multiple commands to be invoked by a single click, then combine them in an executable script-file, and point your menu item at that script-file. You an create multiple script-files; one for each distinct task to be performed. This avoids retyping often repeated commands.

Below is an example of a full gui_setups file to which several items and submenus have been added at the bottom:

example_gui_setups:

	window_size_x   = 1125
	window_size_y   = 900
	print_command   = lpr
	grid_size       0.2
	snap_to_grid    yes
	show_grid       yes
	show_node_names  on
	show_node_types  on
	show_node_attr   off
	show_port_names  on
	show_link_attr   off
	background_color = black
	box_display_style = solid-box
	csim_tool       = $CSIM_ROOT/tools/$CSIM_MTYPE/csim
	scheduler_tool  = $CSIM_ROOT/tools/$CSIM_MTYPE/scheduler
	router_tool     = $CSIM_ROOT/tools/$CSIM_MTYPE/router
	simulation_tool = ./sim.exe
	timeline_tool   = $CSIM_ROOT/tools/$CSIM_MTYPE/tlpp_gui EventHist.dat
	postproc_tool   = $CSIM_ROOT/tools/$CSIM_MTYPE/ppgui EventHist.dat
	xgraph_tool     = $CSIM_ROOT/tools/$CSIM_MTYPE/xgraph
	iterator_tool   = $CSIM_ROOT/tools/$CSIM_MTYPE/iterator_gui
	text_editor     = xterm -e vi
	EXTEND_TOOL_MENU  SummaryCheck   CheckSummary -all EventHist.dat
	EXTEND_TOOL_MENU  Plot_Results   xgraph -color red res1.dat -color green res2.dat
	EXTEND_TOOL_SUBMENU GenReport  ShowAll      ReportGenerator -all EventHist.dat
	EXTEND_TOOL_SUBMENU GenReport  TrafficOnly  ReportGenerator -traffic EventHist.dat
	EXTEND_TOOL_SUBMENU GenReport  ProcessOnly  ReportGenerator -tasks EventHist.dat
	EXTEND_TOOL_MENU  SnapShot  	 snapsim.com
	EXTEND_TOOL_MENU  Print_Results  print_script.com