## OPI Editor

### Introduction

When you double click an .opi file from the Navigator, the file will be opened by OPI Editor by default. If it's not, you can still open an .opi file with OPI Editor by right clicking the file and choose Open With->OPI Editor.

The OPI Editor is a WYSIWYG (What You See Is What You Get) editor. It has most of the modern editing features which can facilitate your OPI editing:

- Select one or multiple widgets
- Move
- Resize
- Copy
- Paste
- Clone
- Delete
- Undo/Redo
- Align Multiple Widgets
- Snap to grid or other widgets by geometry
- Guide
- Zoom In/Out
- Change Order
- Change Orientaion
- Group

All these features can be easily accessed from the toolbar or context menu.

Tip: In OPI Editor, press F1 key on Windows, Ctrl+F1 on GTK, Help key on Carbon to open the context help view. It will show related help whenever a widget is selected.

### Widgets Palette

The Widgets Palette hosts all the widget entries. Click the widget on the palette and then click or drag a rectangle in the editing area will create a widget on the display.

The Palette can be hidden or drag to another side of the display. When the palette is hidden, you can hover the mouse over the palette sash to temporarily show the palette.

### Editing Widgets

#### Select, Move or Resize Widgets

Simply clicking on a widget in the editor or tree view will select the widget. Press `Ctrl` or `Shift` to select more widgets.Drag widgets to move them. Drag the border of the selected widgets to resize them. Holding `Shift` key while resizing will keep the width/height ratio. Holding `Ctrl` key while resizing will fix the center point of the widgets.

Move and resize widgets with keyboard: Press [.] dot key to move widgets with arrow keys.

#### Change Widget Properties

The Properties of selected widget or the common properties of multiple selected widgets are set from the Property Sheet directly.

#### Clone Widgets

Press `Ctrl` and drag the widgets to clone them.

The other functions such as copy, paste, delete, undo/redo can be easily accessed from the toolbar or context menu.

#### Snap to Grid, Geometry or Guide

When moving widgets, the widgets can snap to grid, geomery or guide if they are enabled. These functions can be enabled either from these buttons on toolbar or from display properties. When grid is visible, snap to grid is automatically enabled. Grid space and color can be set as display properties. If Snap to geometry is enabled, widgets will snap to the geometry position or size of other widgets. When widgets are approaching the same X, Y, Width, Height or middle points of other widgets, a blue line will show up. With this funtion, you can easily create widgets with same geometry parameter, for example, same width or same X coordinate.

##### Using Guide

Guide is useful when you are arranging or moving multiple widgets.

1. Click Show Ruler button on the toolbar to show the ruler in editor.
2. Click anywhere of the ruler will create a guide.
3. Drag the widget close to the guide then the guide line will turn to red which means the widget has been attached to the guide
4. Move the guide will move all the widgets attached to it
5. Click a guide and press delete will delete the guide

#### Arranging Widget

Multiple selected widgets can be arranged in different ways with arranging buttons on toolbar . For example, align multiple widgets horizontally, distribute them evenly. Simply try it out by yourself.

#### Changing Order

Order of widgets can be changed from context menu `Order` or dragging them in tree view.

#### Changing Orientation

It can be accessied from context menu `Orientation`, including `Flip Horizontal`, `Flip Vertical`, `Rotate Right 90` and `Rotate Left 90`.

#### Creating widgets by Dragging and Dropping

If you already has some source of PV names, for example, some text with a list of PV names, you can directly drag them to OPI Editor to create widgets with PV Name properties set as the PV names you have dragged.

### Display Special Properties

- Auto Zoom to Fit All(auto_zoom_to_fit_all)
    Zoom widgets in this display to fit all range of the display.
- Grid Color(grid_color)
    Color of the grid.
- Grid Space(grid_space)
    Space of the grid.
- Show Close Button(show_close_button)
    Show the close button on runtime tab.
- Show Edit Range(show_edit_range)
    Show the range for editing with black dash line according to size of the display.
- Show Grid(show_grid)
    Show the grid lines. If it is enabled, snap to grid while moving widgets will be automatically enabled.
- Show Ruler(show_ruler)
    Show ruler on display top and left.
- Snap to Geometry(snap_to_geometry)
    Snap to other widgets while moving widgets.