Table of Contents

Class LayoutView

Namespace
CADability
Assembly
CADability.dll

A view that shows a Layout, i.e. the arrangement of one or more patches (projections of a model) on a sheet of paper, as it will be printed. The paper can be zoomed and scrolled; the paper size and the patches are shown as properties in the property page, and the context menu allows to add patches, to rename or remove the layout and to print it with the print settings of the project.

public class LayoutView : IShowPropertyImpl, IShowProperty, IPropertyEntry, IView, ICommandHandler
Inheritance
LayoutView
Implements
Inherited Members

Constructors

LayoutView(Layout, Project)

Creates a view on the provided layout. The print settings of the view are taken from the page settings stored in the layout, otherwise from the print document of the project; if there is none, only the orientation (landscape or portrait) is derived from the paper size of the layout. The frame creates one layout view per layout of the project.

public LayoutView(Layout layout, Project project)

Parameters

layout Layout

The layout to show

project Project

The project that contains the layout, its models and the print settings

Properties

AllowContextMenu

Always true: a right click in the layout view opens the context menu of the current action.

public bool AllowContextMenu { get; }

Property Value

bool

AllowDrag

Always false: objects cannot be dragged out of a layout view.

public bool AllowDrag { get; }

Property Value

bool

AllowDrop

Always false: objects cannot be dropped on a layout view.

public bool AllowDrop { get; }

Property Value

bool

ContextMenu

Implementation of ContextMenu: the default returns null. An entry whose LabelType contains ContextMenu must override it.

public override MenuWithHandler[] ContextMenu { get; }

Property Value

MenuWithHandler[]

EntryType

Overrides EntryType, returns GroupTitle.

public override ShowPropertyEntryType EntryType { get; }

Property Value

ShowPropertyEntryType

IsInitialized

True once the mapping from the layout (paper coordinates in mm) to the screen has been set up, i.e. after the view has been zoomed or painted for the first time. Before that, the first paint calls ZoomTotal(double) itself.

public bool IsInitialized { get; }

Property Value

bool

LabelText

Implementation of LabelText, returns either labelTextInternal (if not null) or GetString(string)(resourceId+".Label") Whe set, labelTextInternal is set.

public override string LabelText { get; set; }

Property Value

string

LabelType

How the label of this entry behaves (see ShowPropertyLabelFlags): whether it can be selected or edited, is bold or has a context menu. The default implementation returns Selectable.

public override ShowPropertyLabelFlags LabelType { get; }

Property Value

ShowPropertyLabelFlags

Layout

The Layout shown by this view: the paper size and the patches.

public Layout Layout { get; }

Property Value

Layout

SubEntries

The sub entries shown below this entry when it is opened in the property page. The default implementation has none and returns an empty array.

public override IShowProperty[] SubEntries { get; }

Property Value

IShowProperty[]

SubEntriesCount

The number of SubEntries, 0 for an entry that cannot be opened. The default implementation returns 0.

public override int SubEntriesCount { get; }

Property Value

int

Methods

Added(IPropertyPage)

Implementation of Added(IPropertyPage): memorizes the property page in propertyPage. Unlike Added(IPropertyTreeView) it does not raise the state changed event. Override it to subscribe to events while the entry is displayed, and call the base implementation.

public override void Added(IPropertyPage propertyTreeView)

Parameters

propertyTreeView IPropertyPage

DoDragDrop(GeoObjectList, DragDropEffects)

Dragging from a layout view is not supported: returns None without starting a drag and drop operation.

public DragDropEffects DoDragDrop(GeoObjectList dragList, DragDropEffects all)

Parameters

dragList GeoObjectList

Not evaluated

all DragDropEffects

Not evaluated

Returns

DragDropEffects

None

GetInfoProviderIndex(Point)

Remnant of a former tooltip interface of the views, no longer called; always returns 0.

public int GetInfoProviderIndex(Point ScreenCursorPosition)

Parameters

ScreenCursorPosition Point

Not evaluated

Returns

int

0

GetInfoProviderText(int, InfoLevelMode)

Remnant of a former tooltip interface of the views, no longer called; always returns null.

public string GetInfoProviderText(int Index, InfoLevelMode Level)

Parameters

Index int

Not evaluated

Level InfoLevelMode

Not evaluated

Returns

string

null

GetInfoProviderVerticalPosition(int)

Remnant of a former tooltip interface of the views, no longer called; always returns 0.

public int GetInfoProviderVerticalPosition(int Index)

Parameters

Index int

Not evaluated

Returns

int

0

HScroll(double)

Not implemented: the layout view does not react to scroll bars.

public void HScroll(double Position)

Parameters

Position double

Not evaluated

LabelChanged(string)

Implementation of LabelChanged(string). Override if LabelType is Editable.

public override void LabelChanged(string NewText)

Parameters

NewText string

the new text

OnDragDrop(DragEventArgs)

Not implemented: the layout view does not accept dropped data.

public void OnDragDrop(DragEventArgs drgevent)

Parameters

drgevent DragEventArgs

Not evaluated

OnDragEnter(DragEventArgs)

Not implemented: the layout view does not accept dropped data.

public void OnDragEnter(DragEventArgs drgevent)

Parameters

drgevent DragEventArgs

Not evaluated

OnDragLeave(EventArgs)

Not implemented: the layout view does not accept dropped data.

public void OnDragLeave(EventArgs e)

Parameters

e EventArgs

Not evaluated

OnDragOver(DragEventArgs)

Not implemented: the layout view does not accept dropped data.

public void OnDragOver(DragEventArgs drgevent)

Parameters

drgevent DragEventArgs

Not evaluated

OnMouseDoubleClick(MouseEventArgs)

Not used: a double click has no effect in the layout view.

public void OnMouseDoubleClick(MouseEventArgs e)

Parameters

e MouseEventArgs

Not evaluated

OnMouseDown(MouseEventArgs)

Called by the canvas on a mouse down message. The view makes itself the ActiveView, prepares panning (middle button or Ctrl+left button) and forwards the message to the ActionStack of the frame, which hands it to the current action.

public void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

The mouse event, position in client coordinates of the canvas

OnMouseEnter(EventArgs)

Called by the canvas when the mouse enters its client area. The message is forwarded to the ActionStack of the frame.

public void OnMouseEnter(EventArgs e)

Parameters

e EventArgs

Empty event arguments

OnMouseHover(EventArgs)

Called by the canvas when the mouse rests on it for a moment. The message is forwarded to the ActionStack of the frame.

public void OnMouseHover(EventArgs e)

Parameters

e EventArgs

Empty event arguments

OnMouseLeave(EventArgs)

Called by the canvas when the mouse leaves its client area. The message is forwarded to the ActionStack of the frame.

public void OnMouseLeave(EventArgs e)

Parameters

e EventArgs

Empty event arguments

OnMouseMove(MouseEventArgs)

Called by the canvas on a mouse move message. With the middle button pressed the view pans (with Ctrl: rotates the view direction), otherwise the message is forwarded to the ActionStack of the frame, which hands it to the current action.

public void OnMouseMove(MouseEventArgs e)

Parameters

e MouseEventArgs

The mouse event, position in client coordinates of the canvas

OnMouseUp(MouseEventArgs)

Called by the canvas on a mouse up message. The message is forwarded to the ActionStack of the frame. The ModelView and the AnimatedView additionally set the fix point of the view rotation when Ctrl+Shift and the middle button are used, and the ModelView recalculates its display lists after a rotation.

public void OnMouseUp(MouseEventArgs e)

Parameters

e MouseEventArgs

The mouse event, position in client coordinates of the canvas

OnMouseWheel(MouseEventArgs)

Zooms in or out by the factor 1.1 around the mouse position and repaints.

public void OnMouseWheel(MouseEventArgs e)

Parameters

e MouseEventArgs

The mouse event with the wheel delta

OnPaint(PaintEventArgs)

Paints the view: the area outside the paper in black, the paper in white, then (after RepaintActionEvent) each patch of the layout with its own projection, clipped to its area. The first call sets up the mapping to the screen with ZoomTotal(double).

public void OnPaint(PaintEventArgs e)

Parameters

e PaintEventArgs

The paint event with the clip rectangle

OnSizeChanged(Rectangle)

Repaints the view after the canvas has been resized; the zoom and scroll position are not adapted.

public void OnSizeChanged(Rectangle oldRectangle)

Parameters

oldRectangle Rectangle

The client rectangle of the canvas before the change (not evaluated)

Print(PrintDocument)

Prints the layout on a single page with the provided print document. Depending on the global setting "Printing.PrintingMode" the patches are either output as vector graphics via PrintToGDI (mode 1, with hidden line removal and shading) or each patch is rendered into a bitmap at the printer resolution which is placed on the page. The paper size of the layout is assumed to be in mm. Exceptions of the printing system are swallowed.

public void Print(PrintDocument pd)

Parameters

pd PrintDocument

The print document to print to, with the printer and page settings already set

Removed(IPropertyTreeView)

public override void Removed(IPropertyTreeView propertyTreeView)

Parameters

propertyTreeView IPropertyTreeView

the IPropertyTreeView from which it was removed

VScroll(double)

Not implemented: the layout view does not react to scroll bars.

public void VScroll(double Position)

Parameters

Position double

Not evaluated

ZoomDelta(double)

Zooms by the provided factor around the center of the display rectangle: factors smaller than 1.0 zoom in, factors greater than 1.0 zoom out. The frame calls it for the zoom in and zoom out menu commands.

public void ZoomDelta(double f)

Parameters

f double

Factor by which the visible area is scaled

ZoomTotal(double)

Zooms so that the whole paper is visible on the canvas.

public void ZoomTotal(double factor)

Parameters

factor double

Factor by which the paper rectangle is enlarged before it is fitted into the canvas; 1.1 leaves a small margin, 1.0 fits exactly

Events

RepaintActionEvent

Raised during each paint cycle after the paper has been painted and before the patches are drawn. Actions on the layout view (e.g. positioning a patch) can draw their feedback here.

public event LayoutView.RepaintActionDelegate RepaintActionEvent

Event Type

LayoutView.RepaintActionDelegate