You can program the editor by writing scripts using the Rigi Command Library (RCL) to automate tasks, customize features, and integrate capabilities. There is an RCL command corresponding to each menu command. These commands (and others) can be assembled into procedures.
Return to the Children window with the ListADT, ElementADT, and Control subsystem nodes.
For scripting experiments, make a test window of leaf nodes by performing a projection of the subsystems with infinite depth:
A Projection window appears, containing the lowest level nodes in the subsystem hierarchy; the structure of the hierarchy is not modified after producing a projection.
You can produce custom layouts. To enter an RCL command:
Press the enter key after typing each script command.
The rcl_select_type command selects nodes by their type (here, it is Module).
The rcl_cursor_set command moves a cursor to location (x,y) = (100,10) on the canvas. This is equivalent to clicking the mouse at that location (usually as a prelude for arrangement operations).
The rcl_group_vertically command corresponds to choosing Vertical from the Layout menu; the selected nodes are arranged in a vertical line along the left side of the canvas.
Note: RCL is case sensitive.
As each command is entered, it is put into a scrollable command history list located below the menubar.
Clicking on a command in the list automatically places it into the command entry field. Double-clicking on a command in the list runs it right away (and appends this command to the bottom of the list).
Now, using the current commands in the command history list, retrieve and edit them as appropriate to lay out the two remaining Data nodes in a vertical line to the right of the Module nodes.
Using a separate text editor, you can write script files
that can be loaded into rigiedit.
For example, type the following into a file called
myscript.rcl in your home directory:
proc columns {} {
rcl_select_all
foreach nodeID [rcl_select_get_list] {
set nodeTypes([rcl_get_node_type $nodeID]) 1
}
set numNodeTypes [array size nodeTypes]
if {$numNodeTypes == 0} {
return
}
set xDelta [expr [rcl_win_canvas_width] / $numNodeTypes]
set xPos [expr $xDelta / 2]
foreach nodeType [array names nodeTypes] {
rcl_select_type $nodeType
rcl_cursor_set $xPos 0
rcl_group_vertically
incr xPos $xDelta
}
rcl_scale_to_window
rcl_select_none
}
This script arranges the nodes in the active window into
columns by their node type.
To load the myscript.rcl into rigiedit and run the layout algorithm:
To use script commands to access external tools such as graph layout programs:
These two commands hide the data arcs in the active window (the Projection window).
The call arcs of the graph in the current window are presented in a layered, tree-like form using the Sugiyama directed graph layout algorithm. The sugiyama command takes an arc type as the first parameter and a window number as the second parameter (zero meaning the current window). The window number is shown in the title bar of a window, following the type.
Tip: This technique is a quick way of producing call graphs for a program.