ImageEn, unit imageenview

TImageEnView.LayerOptions

TImageEnView.LayerOptions


Declaration

property LayerOptions: TIELayerOptions;


Description

Options to control layer behavior:
Value Description
loAllowMultiSelect If included, users can select multiple layers by holding down the Shift key. Moving, resizing, rotation, and other methods will apply to all selected layers
loAutoSelectMask If you have enabled a mask for a layer, then when selecting the layer the mask will also be selected (so that any resizing actions apply to the mask layer too)
loAutoUndoChangesByUser If you have enabled AutoUndo, then changes to layers made by users (using layer interactions or layer TActions) will be saved to the undo stack
loAutoUndoChangesByCode If you have enabled AutoUndo, then programmatic changes to layers will be saved to the undo stack (i.e. changes due to your code). This applies to the methods: LayersAdd, LayersInsert, LayersCreateFromSelection, LayersCreatePolylineFromSelection, LayersCreateFromFile, LayersCreateFromEdge, LayersCreateFromAlpha, LayersRemove, LayersMerge, LayersMergeAll, LayersAlign, LayersArrange, LayersRotateAll, LayersGroup, LayersUngroup, LayersCropBackground
loAutoPromptForImage When setting MouseInteractLayers to mlCreateImageLayers, the user can drag select to create an TIEImageLayer If loAutoPromptForImage is enabled, then the user will be prompted to browse for an image file when after completing the selection. If the user cancels, the image layer is not added
loAutoFixBorders If included, LayersFixBorders will be called prior to rotation to removes any transparency around the edges of the image
loAutoFixRotation If included, LayersFixRotations will be called after rotation to lock in the rotation angle of image layers
loDynamicCanvas If included, ImageEn will align the view to the bounds of all layers (i.e. by LayersRect). You will be able to scroll to access layers that have been pushed beyond the bounds of Layer 0. However this may cause the view to scroll when moving layers around (so is best paired with Center=False). When not enabled, the view is aligned with Layer 0, and any layers pushed outside of the bounds of layer 0 may be inaccessible if they are off-screen
loKeyboardShortcuts Enables shortcuts to manipulate the selected layer(s). See the keyboard shortcut list in the TIELayer Documentation (Also see: loPreventLayerDelete)
loDisableTextEditOnDblClick By default, double-clicking a text layer allow it to be edited. Specify loDisableTextEditOnDblClick to prevent text editing by the user (see also ReadOnly and TextEditorPopupMenu)
loPreventOutOfBounds When enabled, layers cannot be moved outside of the background (layer 0) area
loPropsOnDblClick When double-clicking a layer (other than the background), it will display the Layer Properties Dialog. Note: For TIETextLayer and TIELineLayer, double-click will enable text editing instead. If you always want to display layer properties, also specify loDisableTextEditOnDblClick
loResizeOnRotate When the user rotates a shape or polyline with AspectRatioLocked=True, should the layer be automatically sized to maintain the original size of the shape?
loDragSelection Multiple layers can be selected by clicking the background and dragging (must specify mlMoveLayers, mlResizeLayers or mlRotate layers in MouseInteractLayers)
loProtectBackground If included, the background layer (Layer 0) cannot be deleted or moved position by the user (will also apply to any attached TImageEnLayerMView). It also disables the layer properties shortcut Alt+Enter for layer 0
loSwapBackgroundProps If included, then when the user deletes or moves the background layer (Layer 0), the new background will inherit the Locked and Selectable properties of the old one (and vice versa)
loAutoTextEditing When setting MouseInteractLayers to mlCreateTextLayers, the user can drag select to create a TIETextLayer. If loAutoTextEditing is enabled, then the layer will automatically start in text editing mode after completing the selection
loStampMode When a mlCreate*Layers item is specified for MouseInteractLayers, layers are added by a single click instead of dragging
loShowRichTextToolbar When editing a text layer with formatting enabled, a rich text toolbar is displayed. You can specify the buttons of the layer using RichEditorToolbar
loAllowReturnsInRichText When editing a text layer with formatting enabled, the return key can be used to insert hard returns into text. Otherwise, the return key applies the text changes
loAllowReturnsInPlainText When editing a text layer (that does not have formatting enabled), the return key can be used to insert hard returns into text. Otherwise, the return key applies the text changes
loShowRotationGrip When layer rotation is enabled (MouseInteractLayers includes mlRotateLayers), a large grip is shown at the bottom of layers which can be clicked to rotate the layer. If this option is not included, user can drag rotate anywhere outside of the layer area
loCtrlClickToCopy Holding down the Ctrl key and clicking on a layer will create a clone of it (requires mlMoveLayers specified for MouseInteractLayers)
loPreventLayerDelete Disables the deletion of layers, e.g. by clicking the Delete key if loKeyboardShortcuts is enabled (also disabled Ctrl+X)
loSnapToPos Makes it easier to position and align layers by snapping to a virtual grid (specified by LayersSnapDist)
loEdgeSmoothing When anti-aliasing is enabled, layers may appear with a pale border. This option is reduces the effect (i.e. improves the styling)
loPreventDeselection Specifies what occurs when the user clicks on the background layer (layer 0). If layer 0 is not selectable. If not included (default) the current layer be set to 0 (though the layer remains unselected). If included the selection does not change

Default: [loAllowMultiSelect, loAutoUndoChangesByUser, loAutoPromptForImage, loAutoFixBorders, loKeyboardShortcuts, loResizeOnRotate, loDragSelection, loSwapBackgroundProps, loShowRichTextToolbar, loAllowReturnsInRichText, loShowRotationGrip, loCtrlClickToCopy, loEdgeSmoothing]

Note:
To disable movement of layers by the keyboard, see iesoAllowMoveByKeyboard of SelectionOptions
To hide layers that are beyond the background layer, use LayersCropped


loAllowMultiSelect in use:



loDragSelection in use:




Examples

// Enable automatic mask selection
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loAutoSelectMask ];

// Enable automatic undo for all image changes including layer changes
ImageEnView1.Proc.AutoUndo := True;
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loAutoUndoChangesByUser ];

// Disable multiple selection of layers
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions - [ loAllowMultiSelect ];

// Allow users to create image layers. Prompt for an image file after selection
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loAutoPromptForImage ];
ImageEnView1.MouseInteractLayers := [ mlCreateImageLayers ];

// Display the entire image (including outlying layers) within the view
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loFitToLayersWhenZooming ];
ImageEnView1.Fit( False );

// Disable keyboard shortcuts
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions - [ loKeyboardShortcuts ];

// Allow layers to be double-clicked to edit their properties (even if they are text layers)
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loPropsOnDblClick, loDisableTextEditOnDblClick ];

// Layers cannot be dragged beyond the background layer
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loPreventOutOfBounds ];

// Prevent automatic sizing of layers when user rotates
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions - [ loResizeOnRotate ];

// Prevent the user from changing or deleting the background
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions - [ lpProtectBackground ];

// Do not transfer properties when moving the background layer
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions - [ loSwapBackgroundProps ];

// Ensure selection does not revert to the background layer
ImageEnView1.Layers[0].Selectable := False;
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loPreventDeselection ];

// Allow users to create text layers. Start in text editing mode (user can immediately begin typing text)
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loAutoTextEditing ];
ImageEnView1.MouseInteractLayers := [ mlCreateTextLayers ];

// Add a star every time the layer clicks on the image (use OnNewLayer event to customize size)
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loStampMode ];
IEGlobalSettings().DefaultLayerShape := iesStar5;
ImageEnView1.MouseInteractLayers := mlCreateShapeLayers;

// Hide the rotation grip
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions - [ loShowRotationGrip ];




// Show toolbar with clipboard options when editing rich text of a TIETextLayer
IEGlobalSettings().RichEditorToolbar.Buttons := [irbRichEditClipboard];
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loShowRichTextToolbar ];




// Zoom so layers fill entire view area

// Make IEView consider all layers when calculating image bounds
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [loDynamicCanvas];

// Position layers so origin is 0,0
rect := ImageEnView1.LayersRect(False, True);
ImageEnView1.LayersRepositionAll(-rect.X, - rect.Y);

// Adjust zoom so all layers fill the view area
ImageEnView1.Fit();


// Draw a virtual grid of 20x20 pixels to make it easier to position and align layers
ImageEnView1.LayerOptions    := ImageEnView1.LayerOptions + [ loSnapToPos ];
ImageEnView1.DoubleBuffered  := True;    // Improve draw performance
ImageEnView1.DisplayGridKind := iedgSnapPoints;
ImageEnView1.LayersSnapDist  := 20;
ImageEnView1.Update();


See Also

Layers
LayersCurrent
LayersSelectAll
LayersDeselectAll
Selected
ImageEn Keyboard Properties