Internal
Much of this information is internal documentation. Care has not been made to make links work and make the documentation conprehensible for outsiders.

Callback Messages

Simulation state changed (command = 1)

In this case some part of the simulation state has changed. Information about the new state, e.g. markings and enablings, is provided.

Extra call parameters:
  blist= trans1-is-enabled,...,transn-is-enabled
  ilist= delay,#trans,#places,trans1-inst,...,transn-inst,
         place1-inst,place1-marking-size,...,placem-inst,placem-marking-size
  slist= stepstr,timestr,trans1-id,...transn-id,
         place1-id,place1-marking,...,placem-id,placem-marking
Return value:
  blist= nil
  ilist= cmd=1
  slist= nil

The delay value specifies the amount of time in milliseconds the controller should delay before showing the next update to the simulation feedback. This is similar to the Delay option in the Play tool.

Currently there is no requirement regarding how many place and transition instances must be represented in the message. In other words, the message may contain information about the current status of none, some, or all node instances in the model. Generally, the message will probably contain information either about all of the node instances in the net, or about the node instances that have changed.

Create canvas (command = 2)

Create a canvas for drawing. The canvas has the given name and is marked for saving along with the model or not. The canvas can be opened and shown to the user or just created. The returned canvas id can be used in subsequent drawing commands.

Extra call parameters:
  blist= saved, raise
  ilist= nil
  slist= name
Return value:
  blist= nil
  ilist= cmd=1
  slist= canvas id

Draw element (command = 3)

Create an element. The canvas id must be as returned from a create canvas command.

Extra call parameters:
  blist= filled
  ilist= type=1 (box), x, y, width, height, curvature
  slist= canvas id
Extra call parameters:
  blist= filled
  ilist= type=2 (ellipse), x, y, width, height
  slist= canvas id
Extra call parameters:
  blist= nil
  ilist= type=3 (text), x, y
  slist= canvas id, text
Extra call parameters:
  blist= filled
  ilist= type=4 (line), #points, x1, y1, ..., xn, yn, curvature, linestyle
  slist= canvas id
Extra call parameters:
  blist= nil
  ilist= type=11 (horizontal guideline), y
  slist= canvas id
Extra call parameters:
  blist= nil
  ilist= type=12 (vertical guideline), x
  slist= canvas id
Return value:
  blist= nil
  ilist= cmd=1
  slist= element id (only for type <= 10)

TODO: Create net elements (cmd 21-30)? hierarchy elements (port/socket, port/socket assignment, subpage assignment, etc)?

Style element (command = 4)

Style an element. The element id must be as returned from a create element command.

Extra call parameters:
  blist= filled
  ilist= r1, g1, b1, r2, g2, b2, thickness, curvature, linestyle
  slist= element id
Return value:
  blist= nil
  ilist= cmd=1
  slist= nil

(r, g, b for foreground color (1) and background (2); values 0-255; any value < 0 is ignored; most combinations will lead to some sort of brown, just like when mixing colors in real life)

Move element (command = 5)

Move an element. The element id must be as returned from a create element command.

Extra call parameters:
  blist= nil
  ilist= x, y, width, height (any value that is not applicable is ignored but must be present)
  slist= element id
Return value:
  blist= nil
  ilist= cmd=1
  slist= nil

Delete element (command = 6)

Delete an element. The element id must be as returned from a create element command. If the erase boolean is false, the element is not deleted, just prevented from being updated via a callback (and events are no longer reported).

Extra call parameters:
  blist= erase
  ilist= nil
  slist= element id
Return value:
  blist= nil
  ilist= cmd=1
  slist= nil

Get element updates (command = 7)

Subscribe to updates from an element. The element id must be as returned from a create element command. If trace is true, events are sent during dragging.

Extra call parameters:
  blist= trace
  ilist= nil
  slist= element id
Return value:
  blist= nil
  ilist= cmd=1
  slist= nil

Scrape canvas (command = 8)

Get information about all elements on a canvas. The boolean uses id indicates whether the canvas id is as returned from create canvas or is a canvas name (page name).

Extra call parameters:
  blist= uses id
  ilist= nil
  slist= canvas
Return value:
  blist= TODO
  ilist= cmd=1, TODO
  slist= TODO
Return value on error:
  blist= nil
  ilist= cmd=-1
  slist= nil

Zoom canvas to fit (command = 9)

Center canvas in view. If the zoom boolean is true, the canvas is also zoomed to fit the contents.

Extra call parameters:
  blist= zoom, raise
  ilist= nil
  slist= canvas id
Return value:
  blist= nil
  ilist= cmd=1
  slist= nil

Add label (command = 10)

Add a label to any page element. Can be aux graphics as created above or any other element (place/transition/…)

Extra call parameters:
  blist= nil
  ilist= #elements, alignment1, ..., alignmentn
  slist= id1, label1, ..., idn, labeln
Return value:
  blist= success1, ..., successn
  ilist= cmd=1, #elements
  slist= labelid1/error1, ..., labelidn/errorn

For each element a boolean is returned whether adding was successful; if the boolean is true, adding was successful and the id is returned; otherwise an error is returned.

Remove label (command = 11)

Remove a label created using command 10. If the label is non-existing (or deleted due to the parent element getting deleted) it is silently ignored – anyway, you wanted to get rid of it and it's gone so shut up and be happy.

Extra call parameters:
  blist= nil
  ilist= #elements
  slist= labelid1, ..., labelidn
Return value:
  blist= nil
  ilist= cmd=1
  slist= nil