Next: , Previous: , Up: Reference for Common Language Elements   [Contents]


8.10 Defining Shapes

This section describes how you can define new shapes that can be used in entity headings of signalling charts or as block shapes in block diagrams. Note that shapes are not (yet) available in graphs.

To define a new shape use the defshape command.

defshape shape_name {
   defining lines;
   ...
};

The shape_name is the name of the shape to define. You can use letters, numbers, underscores and dots; and you must start with a letter. Each defining line shall start with a capital letter, one of the list below. After this letter comes a space delimited list of arguments, terminated by a semicolon. Comments can start with a hashmark ‘#’ as usual and empty lines are also permitted.

S

Starts a new section in the new file. Each shape may contain three optional sections. You shall include the number of the section after the S separated by a space. Sections contain paths, which describe the shape. Anything that comes after this line will belong to this section all the way until the next S or the end of the shape definition.

0

Section 0 specifies the background of the shape. This shall be a (set of) closed path(s), which will be filled by Msc-generator using the value of fill.color attribute.

1

Section 1 specifies the foreground of the shape. This shall be a (set of) closed path(s), which will be filled by Msc-generator using the value of the line.color attribute.

2

Section 2 specifies an alternative, additional way to specify the foreground. It shall be a set of potentially open paths, which will be drawn (stroked) using the value of the line.color attribute. Contrary to section 1, other line attributes will also be applied, such as line.width and line.type. You can specify both Section 1 and 2, in this case both will be drawn.

M

This command is used within the specification of a path, and moves the (imaginary) cursor to a given point. Two space-separated numbers after the M specifies the x and y coordinates. Note that you can use floating-point numbers and any scaling or position—Msc-generator will normalize the size of each shape based on their height.

L

This command is used within the specification of a path, and draws a straight line from the current position of the (imaginary) cursor to a given point. Two space-separated numbers after the L specifies the x and y coordinates.

C

This command is used within the specification of a path, and draws a curved line from the current position of the (imaginary) cursor to a given point. Six space-separated numbers after the C specifies the x and y coordinates of the target point and two control points, respectively. The curved line is computed as a cubic bezier curve.

E

This command is used within the specification of a path, and closes a path. It takes no arguments.

T

This optional item specifies where the entity label shall be drawn if the shape is used in a signalling chart entity heading. This place will also be used if the shape is applied to a block diagram block, which has content. It takes two points (four numbers) as arguments specifying the opposing corners of a rectangle. If this line is omitted, the label will be displayed below the shape. This line can be specified before, inside, between or after sections.

H

This optional item specifies which portion of the shape shall be shown in the hints popup box on Windows in the internal editor (see Typing Hints and Autocompletion). This also takes 4 numbers specifying a rectangle as above. If omitted the whole shape is shown (on a miniature scale). This line can be specified before, inside, between or after sections.

P

This optional item can be used to define a port. Ports are currently used by Block Diagrams, but we plan to extend support to Graphs, as well. After the letter you need to specify an X and an Y coordinate and a name (containing letters, numbers, underscores and dots). Optionally a direction can also be associated with a port by adding a number at the end. This number signifies at what angle arrows leave or arrive at the port. It is interpreted in degrees clockwise from the north (top) direction. So east is 90, left is 270.

See Design Library to see where to find and put your own files defining Shapes.


Next: Procedures, Previous: Chart Designs, Up: Reference for Common Language Elements   [Contents]