|  |  | 8.2 Views

## 8.2 Views

When making a PDF presentation for a PDF Viewer or for IpePresenter, one would often like to present a page incrementally. For instance, I would first like to show a polygon, then add its triangulation, and finally color the vertices. Views make it possible to do this nicely.

An Ipe document consists of several pages, each of which can consist of an arbitrary number of views. When saving as PDF, each view generates a separate PDF page (if you only look at the result in a PDF viewer, you cannot tell whether two pages are actually two views of the same Ipe page or two different Ipe pages).

An Ipe page consists of a number of objects, a number of layers, and a number of views. Each object belongs to exactly one layer. A layer can be shown by any number of views—a view is really just a list of layers to be presented. In addition, a view keeps a record of the current active layer—this makes it easy to move around your views and edit them.

Views can also give a different meaning to symbolic attributes, so that objects that appear in blue on one view will be red on the next one. One can also change the dash pattern and pen width, and can even replace one symbol by a different one.

As a somewhat experimental feature, views can transform individual layers of the page. This allows you to move around or rotate objects from view to view, without having to make copies of the objects.

Finally, views can specify a graphic effect to be used by the PDF viewer when proceeding to the following PDF page.

### 8.2.1 Example

To return to our polygon triangulation example, let's create an empty page. We draw a polygon into the default layer "alpha." Now use the New layer, new view function (in the Views menu), and draw the triangulation into the new layer "beta." Note that the function not only created a new layer, but also a second view showing both "alpha" and "beta". Try moving back and forth between the two views (using the PageUp and PageDown keys). You'll see changes in the layer list on the left: in view 1, layer "alpha" is selected and active, in view 2, both layers are selected and "beta" is active. Create a third layer and view, and mark the vertices.

Save in PDF format, and voila, you have a lovely little presentation. The result is available here.

### 8.2.2 Text boxes

In presentations, one often has slides with mostly text. The textbox object is convenient for this, as one doesn't need to use the mouse to create it. To create a slide where several text items appear one by one, one only needs to press F10 to create a textbox, then Shift+Ctrl+I to make a new view, F10 again for the next textbox, and so on. Finally, one moves the textboxes vertically for the most pleasing effect (Shift+Alt+Left Mouse does a constrained vertical translation, or Shift+Left Mouse in Translate mode).

### 8.2.3 Changing symbolic values inside a view

Imagine you have an object that is shown in dark orange on your current page, but on one specific view you want to highlight the object in purple.

To achieve this, go to the view, and open Edit view from the Views menu. In the attribute map field, write this line:

    color:darkorange=purple;

You will notice that all objects on the page that had the `darkorange` color now show in purple.

You can similarly map other attribute values, for instance:

    color:navy=red;
    color:darkorange=purple;
    symbolsize:large=tiny;
    pen:ultrafat=normal;
    dashstyle:dotted=dashed;
    symbol:mark/disk(sx)=mark/box(sx);

The attribute kinds you are allowed to modify are "pen", "symbolsize", "arrowsize", "opacity", "color", "dashstyle", and "symbol". Both the original and the new attribute must by symbolic attributes defined in your style sheet.

It's probably not a good idea to remap common attributes in your document—this may quickly become confusing. A better approach would be to create dedicated attribute values like `emphasis`, that map to some standard value in the stylesheet, and which you can then redefine in the views where you want to emphasize the object.

### 8.2.4 Transforming objects inside a view

The second large text field inside the Edit view dialog allows you to specify transformations for each layer of the page. For instance, you could write these definitions:

    alpha=[1 0 0 1 20 100];
    beta=[1 0 0 0.8 0 0];

This will translate all objects in layer alpha by the vector (20, 100) (that is, 20 units to the right and 100 units upwards), while all objects in layer beta are scaled in the y-direction by factor 0.8.

This is somewhat experimental—there is no good UI to figure out the right transformation matrices (you may want to draw a helper object, apply the transformation, and then use Edit as XML to look at the object's matrix field).

Also, Ipe still considers the objects to be at their original place, it just displays them elsewhere. For instance, to modify an object you have to select it by clicking at its original location. (So, to modify an object, it is best is to go back to the original view where you made the object.)

Currently, the layer transformation is not taken into account when computing the bounding box of a page, so make sure you have other objects creating a suitable bounding box.

### 8.2.5 Controlling the PDF bounding box of a view

Note that all views of a page receive the same bounding box, containing all objects visible on some view, plus all objects in a layer named "BBOX" (even if that layer is not visible). This can be used to force a larger bounding box without adding a white rectangle or the like.

If you need independent bounding boxes for each view, create a layer named "VIEWBBOX". Any view in which this layer is visible will receive a bounding box computed for the objects visible in this view only.