Amulet Example Programs


Amulet interfacing to the ModSAF tactical map database. ModSAF (Modular Semi-Automated Forces) is drawing the map, and Amulet is being used to overlay the graphical objects which show the points and paths, and for the control window, which is displaying the properties of the selected point. The objects are all created using gestures, and other gestures control scrolling and panning the map. Constraints are used to keep the data consistent if the user edits the displayed data by typing or drags a point using the mouse. This is intended to be a front-end to the Exercise Editor from the Soar/IFOR project at the University of Michigan. (ModSAF also has its own user interface to the map, which is not being used.)


This demonstration program was written in Summer, 1996. It only requires about 850 lines of Amulet code to provide all of this functionality: The palette on the left determines what kind of object is created in the main window when the user clicks with the left mouse button. When creating gates, gridding is enforced to make sure the objects line up. To create a wire in line-mode, the user presses down in the source object and releases in the destination object. If the object has two input ports, like the AND and OR gates, then which is used is determined by whether the mouse is near the top or bottom of the object. Wires can only be drawn where semantically meaningful, so that, for example, the program makes sure that two wires cannot be drawn to the same input port. When the top arrow is selected in the palette, then objects can be selected with the left mouse button and the conventional selection handles are shown. Multiple objects can be selected by clicking while the SHIFT keyboard key is down. The selected gates can be moved by dragging them, but growing of the gates is disabled since we want them all to be the same size. When gates are moved, the wires are adjusted so they stay attached. The menu bar at the top contains the operations: new, open, Save, save-as, quit, undo, redo, cut, copy, paste, clear, clear-all, select-all, to-top, and to-bottom. All operations are undoable, and the program supports multiple undo, so all operations can be undone back to the beginning. Undone operations can be redone. When gates are wired to inputs, the program shows the output value of each gate. When a gate has all of its input values defined, it displays its output value in small blue text. The "?" value is output by gates which do not have enough inputs defined. The one-zero buttons can be used as either input or output. When there is no input wire, when the user is in test mode (the second item in the palette), then the user can toggle the value by clicking on the button. However, if the user wires the input port of a button, then it will show the value from the wire and clicking on it will have no effect. Little red numbers are animated along the wires to show the propagation of the values, as shown at the bottom of the figure.

Instead of repeatedly going back to the palette, the user can instead use gestures to create all the kinds of objects using the right mouse button (on the Macintosh, using the Option keyboard key while pressing on the one mouse button). A gesture is when the path of the mouse is important, not just its start and end position. For example, the user can draw an o to make an OR gate, an "A" to make an AND gate, a ">" to make a NOT gate, a line to make wires, etc. The dot gesture means undo, which is useful for correcting errors.

The code for this application can be compiled without change and will work on Unix (as shown above), on Windows NT, Windows 95 or the Macintosh.


This demonstration program was written using Amulet in March, 1995. Constraints are used to keep the lines attached to the ships, to keep the scroll bars and the long-range scan scrolled to the same place, and to grey-out the button labels when they are not available. The demo also shows off the interactors which support creating and moving ships and text editing, integrated Undo and Redo, and the scroll bar and button widgets.

A number of other pictures are included on the page of
Projects Using Amulet.

Back to the Amulet Home Page.

Maintained by:
Brad Myers (last updated 16-Mar-95--BAM)