Extending VisEd
VisEd can be extended by using Tcl/Tk and Graphscript. Details
of using Graphscript can be found in the Graphscript programmers
manual on the Graphlet
web site.
To add your own functionality, follow the following steps:
First, plan and create a top-level menu item and use
Graphscript to enter it into the menubar. For instance, if you
want a toplevel menu named MyNewMenu you would follow the
following steps:
- Create a tcl file for your code (i.e. MyNewCode.tcl
)
- Open the file morale.init.tcl and add the line source
MyNewCode.tcl in the upper portion of the file
(labelled Place all Morale source imports here) with the
other source statements.
- Go to the bottom of the file (labelled Global startup
commands go here).
- In this section there are several subsections.
- Save this file, but keep it handy for reference.
You will need to match your call-back names to
proc names in your other file.
- Now start on your file MyNewCode.tcl. For each
menu item you will need to create a couple of procs (need
to match the signatures:
- First hook up your menu call-back to the menu
item. The important thing is to make sure your
action names stay consistent. The graphscript
manual contains a discussion of action tables if
you need more info
proc GT_create_someProcedureName1 {editor menu} {
global GT
set GT(action,some_actionName1) GT_action_someActionName1
GT::add_menu_command $editor $menu {
"My Menu Item1 ..." someactionName1
}
}
- Now you simply need to write the action code with
a proc like:
proc GT_action_someActionName1 {editor} {
global GT
set graph GT($editor,graph)
#more action stuff here
}
- Some useful globals:
- MessageTypes(x)
where x is an all caps name from messages.h.
Useful for sending messages to an ACME Server
- SystemNames($editor)
where $editor represents the current editor ID.
Gives you the ACME system name of the system
being drawn in this window.
- IsConnected is true
if the app is connected to an ACME Server.
- Parents($editor)
where $editor represents the current editor ID.
Provides the name of the parent system of the
ACME representation in the current editor window.
This is NULL if you are in the top-level display.
- GT(X,Y) provides a
wealth of access to nodes, graphs, editors, etc,
See the graphscript manual for more details.