The Form Editor

Source: Adele Goldberg, "Smalltalk-80 The Interactive Programming Environment"

The basic idea of the Form Editor is to provide a canvas, an area of the screen in which drawings can be created, and a set of tools for placing paint on the canvas. All or part of the drawings can be saved on an external file and retrieved at later times. Figure 1 shows a canvas of the Form Editor on which some drawing has be done, and the menu of editing commands. The items in this menu are graphical images rather than text; as such, the menu is called an iconic menu.

Fig.1 The Form Editor

Fig. 1 The Form Editor

Five tool functions comprise the basic graphical form vocabulary. These are:

Each of these tools can be modified in its use by four variables that modify its effect on the screen: form source, color tone, grid spacing and painting mode. The functions are represented in the iconic menu.

To choose any tool or variable in the Form Editor, either move the cursor over the icon representing the desired action and click the red button, or type a corresponding key on the keyboard. You can press the red button and move the cursor over the icons; the corresponding selection is highlighted by displaying a gray box within the icon. Releasing the red button chooses the current selection.

The Form Editor is in a standard system view so that the standard blue button menu is available. However, the size of the viewing area can not be changed. A full screen editor can be created as well.

Create a Form Editor by evaluating an expression of the form:

(Form extent: 400 @ 300 depth: Display depth)
        fillWhite;
        edit

or

FormEditor openFullScreenForm

To edit a part of the display screen, evaluate this expression:

Form fromUser edit

The message edit can be sent to any instance of Form. Note that the numbers you choose should not exceed the width and height of your display screen. Moreover, in determining the heigt of the entire viewing area, you should allow for at least 112 pixels for the height of the menu.

The menu accessed by pressing the yellow button while you are in a Form Editor has two commands: accept and cancel. As in text editing, the picture beeing created does not modify the original Form unless the accept command is choosen. If at some stage of drawing you wish to experiment with different changes to a Form and you do not want to save versions on an external file, you can choose the accept command to store the current version, make some changes, and then choose the cancel command to restore the image to the earlier accepted version.

The iconic menu appears at the bottom of the Font Editor. A labelled image of the menu is shown in Figure 2. The corresponding keys on the keyboard are shown in Figure 3. Notice that the keyboard arrangement lines up with the icon positions.

Fig.2 The Iconic Menu

Fig. 2 The Iconic Menu

Fig.3 The Keyboard

Fig. 3 The Keyboard

A description of each icon follows. You can try each one.

Color tones are set by choosing one of the five colors; each is shown in the menu as an icon that is a square of the tone:

The form source is copied to the display screen according to one of the four modes that can be set. These are:

The painting area has a grid associated with it in both the x and < directions. You can set the size of the gridding. When gridding is not used, the brush can place paint anywhere in the canvas. The horizontal and vertival gridding can be used separately or together. When gridding is used, the paint is aligned on the grid boundaries. That is, the x (when horizontal gridding is used) or y (when vertical grtidding is used), or both x and y (if both horizontal and vertical gridding are used) positioning of the source shape upper left corner is forced to align with the grid boundaries. hree icons represent the gridding controls. They are:

The image in the entire painting area is not saved on an external file. Rather, the current form source is saved. To save everything, select everything as the form source. When a Form is retrieved from an external file, it becomes the current form source.