Adding a Menu Option

<#7144#>
Figure 2.3: An example wrapper routine
#figure7144#

<#7144#> Any algorithm you wrap into the user interface can easily be added to the menu of each graph window. Simply make your own copy the file <#7148#>$LINK_BASE/stklos/graph-menu.stklos<#7148#> and edit it. It will probably not be necessary to learn any Scheme, since you should be able to copy the menu entry of an existing algorithm and change the name. If it becomes necessary to make more interesting changes, see the STk manual and the GUI part of the Link manual. If you put your copy of 12 (and any other interface files you wish to customize) in the current directory, they will be loaded automatically when the application starts. If, however, you wish to keep your customized interface files in a separate directory, modify the STK_LOAD_PATH environment variable to include that directory before $LINK_BASE/stklos. For an example of this customization, consider the menu option for the <#7149#>spring-layout<#7149#> command was created by adding the following line to the ``Layouts'' sublist of the menu string contained in 13: verbatim8 The first element in the list is the text of the menu item, while the second element is the function which is to be called if the user selects this menu item. The comma is used since this line is used to force evaluation of the expression (this line is found within a back-quoted list in the file. See the Scheme standard for an explanation of Scheme quoting).