4.1.6 Viewing and formatting
Hiding and showing objects and
relationships
The View function allows you to concentrate on different
aspects of diagrams by hiding or showing selected object or relationship types.
The menu selection
View | Selected... opens a selection dialog, as in
Figure 4–19, allowing you to choose
the object and relationship types to be shown.
To select object or relationship types to be viewed mark
them with a tick ‘✓’. For example, according to the selection
dialog below all components of the WatchApplication diagram are shown.

Figure 4–19. A dialog for selecting object and relationship types to be shown.
Relationships
involving hidden objects are only shown if they also involve at least one object
that is not hidden.
Figure 4–20
shows the result of hiding State objects in a Watch Application Diagram. Note
that this example is intended to highlight how the hide functionality works:
more sensible choices of objects to hide here would be the black Action and
Variable objects.

Figure 4–20. An example of hiding objects.
Similarly,
View | All shows every object and relationship of a diagram. Hence, this
command automatically selects every object and relationship type in the
selection dialog (
Figure
4–19).
 | Deselecting
an abstract type will also hide all instances of its
subtypes. |
Zooming
The use of large diagrams necessitates that they can be
displayed at different scales. In Diagram Editor there are several ways to set
and alter the scale factor. To set the zoom to a fixed percentage:
1) | Open
the Zoom Dialog (Figure 4–21) by
selecting View | Zoom.... |

Figure 4–21. Selecting the zoom level.
2) | Select
a predefined zoom level, default or fit zoom or set the zoom level into the
Percent
field. |
3) | Press
OK. The diagram will be shown scaled to the selected
level |
Alternatively, you can select a
predefined zoom factor, fit or default zoom from the zoom pull-down list located
at the lower-right corner of the Diagram Editor window. You can also enter a new
zoom value if needed. Pressing the + and – buttons on the
either side of the pull-down list will increase or decrease the zoom factor by
one unit. Default and fit zoom can be also set by pressing the respective
toolbar buttons.
It is also possible to zoom freely on the defined area. In
order to do this:
1) | Select
the Zoom tool from the toolbar (a magnifier glass cursor will be shown when the
zoom tool is
active). |
2) | Move
the cursor on the drawing area, press and hold down the left mouse button and
drag the mouse over the area you want to zoom
to. |
 | During
the area zoom, hold down the Ctrl-key to zoom out instead of zooming in.
The zoom out factor will be calculated as the relation between the selected area
and the whole drawing area. |
You can
also zoom in and out directly in the drawing area by holding down Alt and using
the mouse scroll wheel. The current zoom level is shown in the status bar at the
bottom of the Diagram Editor.
Scrolling
In addition to the usual scroll bars to position the editor
view, the Diagram Editor also provides a Scroll Tool for more arbitrary
scrolling of the editor view. To enable the Scroll Tool press the hand-shaped
Scroll button in the toolbar. When the Scroll Tool is on, the normal
mouse cursor will be replaced by the hand cursor. To scroll the editor view,
press down the left mouse button and move the cursor around freely – the
editor view will follow the cursor, as if you were dragging the diagram around
on a piece of paper. To turn the Scroll Tool off, simply click right mouse
button or deselect it from the toolbar.
Grid size, visibility and snapping
To help make your diagrams look neater, MetaEdit+ can show a
grid over the diagram, to help you align objects with it. The size of the grid
is controlled through the View | Choose Grid... dialog. The command
View | Show Grid or toggling the Show checkbox on the status bar
at the bottom of the window allows you to show or hide the grid in the diagram.
Merely showing the grid does not affect object placement.
You can force the use of the grid when elements are created or moved by
selecting View | Snap to Grid or checking the Snap checkbox at the
bottom of the window. The default target point of individual elements and role
break points will be aligned to the grid in all operations. If multiple elements
are selected and moved, they will maintain their relative positions to each
other, and the whole area will maintain its relative offset to the grid. Thus
elements that were previously aligned with the grid will still be aligned after
the move.
As with zooming you can also access the grid setting
through a pop-up menu by pressing the right mouse button when nothing is
selected in the diagram.
Aligning elements
The command
Align | Align to Grid
aligns
the selected object and relationship default
target points and role break points according to the selected grid. If there is
no selection, all elements are affected.
Align to Grid is also available
as a button in the toolbar.
The other commands on the
Align menu expect a
multiple selection. They take the first selected element as their base and align
the other selected elements to it. For instance,
Align | Align Left will
move the other selected elements horizontally so that their left edge is aligned
vertically with the left edge of the first selected element.
Align Target
X and
Align Target Y work on the basis of the default target point,
like most MetaEdit+ operations, whereas
Align Center and
Align
Middle work on the geometric center of the
elements.
Refreshing the editor window
With its tidy drawing operations, forced refreshing of the
Diagram Editor window is not needed very often. However, refreshing the display
is needed when changes made to the conceptual graph by some other editor need to
be propagated to the currently open diagram. Similarly, changes made to the
underlying metamodel also require forced refreshing. The display can be
refreshed by choosing
View | Refresh or pressing
F5.
Scaling objects and relationships
You can scale an object or relationship symbol by selecting it
and dragging any of the selection handles at its corners or the midpoints of its
sides. Holding Shift down will maintain the aspect ratio of the symbol.
Holding control down will scale the symbol keeping the point opposite the
dragged selection handle in the same place. Without control the centre of the
object is maintained in the same place, as this best maintains the layout of the
diagram – keeping the object on its grid point and keeping role lines at
the same angle. Holding down the Alt key will enforce the grid while
resizing.
To set a particular scale, or scale several elements with
the same scale factor, choose
Format... from the element’s pop-up
menu or from the
Format menu (or press
Alt+Enter) to open the
Format dialog for the selected element(s). The Format dialog consists of two
pages, as shown in
Figure 4–22
and
Figure 4–23.

Figure 4–22. Diagram element format dialog page for position and size.
On
the Position and Size page (
Figure
4–22) you can edit diagram elements’ position and size values.
Position is defined as X and Y coordinates from the top-left corner of the
drawing area to the target point of the element (generally its center). Size can
be defined either as horizontal and vertical scale percentage from
symbol’s default size or as absolute height and width in pixels. Checking
Lock aspect ratio will ensure that the element will retain its previous
geometry while editing its size. The original default size can be restored by
pressing the
Default values button.

Figure 4–23. Diagram element format dialog page for edges.
The
Edges page (
Figure 4–23) shows
the position of the left, right, top and bottom edges of the element. Changing
any of these will affect the respective edge.
 | Please
note that changes in either Position and Size or Edges page will automatically
propagate to the other (i.e. changing an edge value will affect both position
and size
values). |
 | The
language designer can choose to make some symbols partially or totally
non-scalable. The limited scalability is visualized by omitting the
nonfunctional handles when the element is selected on the drawing area and by
inactivating the respective input fields in the element’s Format
dialog. |
Ordering objects
The diagram elements appear on Diagram Editor in the following
order: roles are displayed over relationships, which are displayed over objects.
Whilst ordering amongst roles and relationships is automatic, the order of the
objects is user definable. To re-order objects:
1) | Select
the objects to
move. |
2) | Select
an ordering command (Bring to Front, Send to Back, Bring
Forward, Send Backward) from the Format menu or the Order
submenu of the pop-up menu. You can also use the following keyboard
short-cuts: |
Ctrl+F
|
Bring to Front
|
Ctrl+B
|
Send to Back
|
Ctrl+Shift+F
|
Bring Forward
|
Ctrl+Shift+B
|
Send Backward
|
Note that
Bring to Front will only make this the
uppermost object: it will still be below all relationships and
roles.