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
layoutLayoutThe layout to show
projectProjectThe 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
AllowDrag
Always false: objects cannot be dragged out of a layout view.
public bool AllowDrag { get; }
Property Value
AllowDrop
Always false: objects cannot be dropped on a layout view.
public bool AllowDrop { get; }
Property Value
ContextMenu
Implementation of ContextMenu: the default returns null. An entry whose LabelType contains ContextMenu must override it.
public override MenuWithHandler[] ContextMenu { get; }
Property Value
EntryType
Overrides EntryType, returns GroupTitle.
public override ShowPropertyEntryType EntryType { get; }
Property Value
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
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
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
Layout
The Layout shown by this view: the paper size and the patches.
public Layout Layout { get; }
Property Value
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
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
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
propertyTreeViewIPropertyPage
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
dragListGeoObjectListNot evaluated
allDragDropEffectsNot evaluated
Returns
GetInfoProviderIndex(Point)
Remnant of a former tooltip interface of the views, no longer called; always returns 0.
public int GetInfoProviderIndex(Point ScreenCursorPosition)
Parameters
ScreenCursorPositionPointNot 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
IndexintNot evaluated
LevelInfoLevelModeNot 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
IndexintNot evaluated
Returns
- int
0
HScroll(double)
Not implemented: the layout view does not react to scroll bars.
public void HScroll(double Position)
Parameters
PositiondoubleNot evaluated
LabelChanged(string)
Implementation of LabelChanged(string). Override if LabelType is Editable.
public override void LabelChanged(string NewText)
Parameters
NewTextstringthe new text
OnDragDrop(DragEventArgs)
Not implemented: the layout view does not accept dropped data.
public void OnDragDrop(DragEventArgs drgevent)
Parameters
drgeventDragEventArgsNot evaluated
OnDragEnter(DragEventArgs)
Not implemented: the layout view does not accept dropped data.
public void OnDragEnter(DragEventArgs drgevent)
Parameters
drgeventDragEventArgsNot evaluated
OnDragLeave(EventArgs)
Not implemented: the layout view does not accept dropped data.
public void OnDragLeave(EventArgs e)
Parameters
eEventArgsNot evaluated
OnDragOver(DragEventArgs)
Not implemented: the layout view does not accept dropped data.
public void OnDragOver(DragEventArgs drgevent)
Parameters
drgeventDragEventArgsNot evaluated
OnMouseDoubleClick(MouseEventArgs)
Not used: a double click has no effect in the layout view.
public void OnMouseDoubleClick(MouseEventArgs e)
Parameters
eMouseEventArgsNot 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
eMouseEventArgsThe 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
eEventArgsEmpty 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
eEventArgsEmpty 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
eEventArgsEmpty 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
eMouseEventArgsThe 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
eMouseEventArgsThe 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
eMouseEventArgsThe 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
ePaintEventArgsThe 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
oldRectangleRectangleThe 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
pdPrintDocumentThe print document to print to, with the printer and page settings already set
Removed(IPropertyTreeView)
Overrides Removed(IPropertyTreeView)
public override void Removed(IPropertyTreeView propertyTreeView)
Parameters
propertyTreeViewIPropertyTreeViewthe 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
PositiondoubleNot 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
fdoubleFactor 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
factordoubleFactor 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