14.1 Conceptual Overview of Output Recording

Output recording is an important part of CLIM. It provides the basis for scrolling windows, for formatted output of tables and graphs, for the ability of presentations to retain their semantics, and for incremental redisplay.

The output recording mechanism is enabled by default. Unless you turn it off, all output that occurs on a window is captured and saved by the output recording mechanism. The output is captured in output records. An output record is an object that contains either other output records or an output record element.

Since output records can contain other output records, we can view the organization of output records as a tree structure. The top-level output record, which contains all the output done on that window, is called the history of the window.


Figure 22. The Tree Structure of an Output Record

Each rectangle in Figure 22. is an output record. The top-level record is an output record called a history. Each output record is a leaf of the tree and is called a displayed output record element. The intermediate output records are both output records and output record elements of their immediate superior.

CLIM automatically segments the output into output records. The result of each atomic drawing operation is put into a new output record. Each presentation is put into a new output record. Strings are treated differently; CLIM concatenates strings into one output record until a newline is encountered, which begins a new output record.

One use of an output record is to replay it; that is, to produce the output again. Scrolling is implemented by replaying the appropriate output records. When using the techniques of incremental redisplay, your code determines which portions of the display have changed, whereupon the appropriate output records are updated to the new state and the output records are replayed.

CLIM's table and graph formatters use output records. For example, your code uses formatting-table to format output into rows and cells; this output is sent to a particular stream. Invisibly to you, CLIM temporarily binds this stream to an intermediate stream and runs a constraint engine over the code to determine the layout of the table. The result is a set of output records which contain the table, its rows, and its cells. Finally, CLIM replays these output records to your original stream.

Presentations are a special case of output records that remember the object and the type of object associated with the output.

The concept of the tree structure organization of output records is further illustrated by the organization of the output records of a formatted table. The table itself is stored in an output record; each row has its own output record and each cell has its own output record.

Figure 23. The Output Records of a Formatted Table

CommonLisp Interface Manager 2.0 User's Guide - 18 Mar 2005