Pigi
automatically generates icons for stars and galaxies, respectively, when you invoke the make-star or make-schem-icon command from the Extend menu. Pigi
puts the new icon in a user-specified palette, which by default is user.pal in the directory in which you started pigi
. More or less any vem
manipulations can be performed on this icon, but some guidelines should be followed. These icons have a generic symbol, shown in figure
2-2 on page 2-5. To change it, place the cursor over the icon and execute the edit-icon ("I") command in the pigi
menu.1 A new window containing the icon facet will appear.
Recall from section
2.6 on page 2-21 that icons are stored in interface facets and that the icons that appear in contents facets are really instances of icons. These instances merely refer to the actual icon facet. The edit-icon command opens a window into the actual icon. Any changes made in this window will affect the appearance of all instances referring to the icon.
Recall also that icon facets store a different kind of data from other facets. Icon facets contain information that tells vem
how to draw objects. Hence, a different set of commands must be used to edit icons. Whenever you edit an icon, vem
switches to a different mode called "physical editing style." In this mode, we create objects such as lines, boxes, and polygons. This is in contrast to "schematic editing style" which we used before to create instances and connect them together with wires. Physical editing style shares many commands with schematic editing style. For example, select-objects is active in both modes. A list of useful physical editing style commands and their key bindings is given in table
2-7.
The commands that create geometry expect a layer argument. The layer of an object determines its color and its fill pattern. To specify a layer, place the cursor over an object attached to the desired layer before executing a command. You can open a palette of layers with the palette ("P") command. The palette is shown in figure
2-8.
The layer palette contains several columns of solid and outline colors, with the name of the color at the top of the column. Colors at the top of each icon will be layered on top of colors below them in the columns. A set of special layers are arranged at the bottom of the palette. The layers for icon stems are explained below. The layers for icon bodies define the icon background and optional icon shadow.
A few simple notes will help greatly. First note that when the icon window is opened, the snap is automatically set to 5 "oct
units". This is because the default snap for schematic windows, normally 25 units, is far too coarse for most icon editing functions. A reasonable compromise is 5 units, unless you are going to try to create a very elaborate icon, in which case 1 unit is probably what you want. The vem
Options:window-options command allows you to change the snap.
When editing an icon, the vem
menu is slightly different than when you are editing a schematic. In vem
terminology, this is because you are working with the physical view of a facet. The commands are shown in table
2-7. Most icons can be created by experimenting with the following operations:
- Select the default symbol within the icon that Ptolemy created when it created the icon (a star, galaxy, cluster of galaxies, or palette symbol, as shown in figure
2-2 on page 2-5). You can do this by drawing a box (drag the left mouse button) and typing "s" (or using Selection:select-objects in the menu). You can unselect with "u" or control-u. An alternative selection method is to place a point and type "s". This usually provokes a dialog box to resolve ambiguities. Delete whatever parts of the icon you don't want using "D" or Selection:delete-objects. WARNING: Do not delete terminals! If you accidentally delete a terminal, the easiest action is begin again from scratch, asking
pigi
to create a new icon.
- Bring up the
vem
color palette by typing "P" (or System:palette in the menu). You will get the window shown in figure
2-8.
- Draw a line by clicking the left button to place a point, and pushing and dragging the mouse button from the same point. Then move the mouse to desired color in the color palette and type "c" (or Edit:create-geometry from the menu). A line may consist of multiple line segments by just repeatedly pushing and dragging the mouse button.
- To create filled polygons, place points at the vertices, then type "c" on the appropriate solid color in the palette.
- To create a circle, place a point at the center, a point on periphery, and type "C" on the appropriate color. To create a filled circle, use a line segment instead of a pair of points.
- Objects can be moved by selecting them, dragging the mouse (using the right button) to produce an image of the object in the desired place, and typing "m".
- You may change (or delete) the label that
pigi
automatically puts at the bottom of the icon. To change it, select it and type "E" (Edit:edit-label in the menu). The resulting dialog box is self explanatory. The standard Emacs-like editing commands apply.
- BE SURE TO SAVE YOUR ICON. This can be done by typing "S" (System:save-window in the
vem
menu). You can close your window with control-d. Note that vem
buffers the data in the window. You can close it and reopen it without saving it, as long as the session has not been interrupted.
By convention, the data types supported by a terminal are indicated by the color of the stem that connects the terminal to the body of the icon. The following colors are currently in use:
ANYTYPE: red
FLOAT: blue
INT: brown
FIX: purple
COMPLEX: white
PACKET: green
FILE: yellow
STRING: black
The color is currently set automatically by the icon generator by using layers defined specifically for this purpose, called anytypeColor
, floatColor
, intColor
, fixColor
, complexColor
, packetColor
, stringColor
and fileColor
. These colors are shown at the bottom of the color palette in figure
2-8.
You can change the color of an object manually, if you wish. To do this, select the object, type ""xxxx"", where xxxx is replaced by the color name (the quotation marks are necessary), and then type the single character "l" (an el - or Edit:change-layer in the menu). Be sure not to change the color of a terminal! Again, be sure to save the window.
One final editing operation is a little trickier: moving terminals. Pigi
places terminals rather arbitrarily, since it knows nothing of their function. You may wish to have a smaller icon than the default, in which case you have to move the input terminals closer to the output terminals. Or may wish to change the order of the terminals, or you may want to have terminals on the top or bottom of the icon rather than right or left. All of these can be done, but the following cautions must be observed:
- Do not move terminals of icons that have already been used in applications. Unfortunately, if you do this, the block will become disconnected in all applications where it is used. If you are tempted to move terminals in a commonly used block, consider the tedium of finding all applications (belonging to all users) and reconnecting the block. ONLY MOVE TERMINALS ON BRAND NEW ICONS.
- You must respect the default snap of 25 for schematic windows, and move terminals to a point that falls on a multiple of 25 units. Otherwise, connecting to the terminal will be very difficult. Normally, when the icon window opens, the grid lines are 10 units apart. So you can place terminals any multiple of 2.5 grid lines away from the center.
- To orient terminals so they are aiming up or down, select the terminal, type "t" (or Selection:transform in the menu), then type "m" to move it. Repeatedly typing "t" will continue to transform (rotate) the terminal.
A little more detail on the oct
internals may be useful if you explore the files that are created by these operations. For make-schem-icon, if the schematic is called xxx, then the icon itself is stored in "xxx/schematic/interface;". The semicolon is part of the filename (this creates some interesting challenges when manipulating this file in Unix, since the Unix shell interprets the semicolon as a command delimiter). The standard stars that are normally part of the Ptolemy distribution are stored in "$PTOLEMY/src/domains/
dom", where dom is the domain name such as sdf
or de
. The icons for the stars are stored in a subdirectory called icons
, the icons for demo systems in a subdirectory called demo
, and the source code for the stars are stored in a subdirectory called stars
. Feel free to explore these directories.
Whenever the contents of a galaxy are changed so that the new definition has different I/O ports, the icon must be updated as well. You can do this by calling make-schem-icon again to replace the old icon with a new one. Vem
will not allow you to overwrite the old icon if you have instances of the old icon in any open window (regardless of whether the window is iconified). Hence, you must either close those windows with "control-d" or delete the offending icon before replacing it with a new icon. Note that changing number of terminals will also change their layout, so that connections in existing schematics may no longer be valid.
1
You must have write permission on the facet to change the icon.
Copyright © 1990-1997, University of California. All rights
reserved.