CODController Class

class CODController: public MvcController

The controller handles user interaction and keeps track of UI state information. Messages are forwarded to the controller from the viewport. The controller inherits message map processing from CWnd, but it does not actually have its own window handle. Instead, the controller is plugged into the window that contains the viewport so that it can process messages for the viewport.

The controller changes state and updates the viewport as it receives events. When a user interaction task is complete, the controller typically generates a command object and passes it to the model. A set of virtual Execute methods take care of command creation and execution.

The controller keeps track of the currently selected set of components. Many of the tasks that are performed by the controller act upon the current selection. The OnSelectionChange is called whenever the current selection changes.

The controller contains a CODDropTarget object that is used to implement OLE drag and drop. The CreateDropTarget method creates the drop target object and registers the viewport with it.

Defined in: OdController.h

Class Members

Constructor/Destructor

VIEWS_API CODController(CODViewport* pViewport = NULL)

Constructor.

VIEWS_API virtual ~CODController()

Destructor.

VIEWS_API virtual BOOL Create(CWnd* pWnd, sfl::MvcVisualComponent* pComp)

Create the controller on the specified visual component.

General Attributes

int m_state

The current state of the controller.

BOOL m_bEditVertices

TRUE if in edit vertices mode.

CODViewport* m_pViewport

The viewport associated with this controller.

VIEWS_API int GetState() const

Gets the current state of the controller

VIEWS_API void SetState(const int nState)

Sets the current state of the controller

VIEWS_API CODModel* GetCanvasModel() const

Gets the model being controlled.

VIEWS_API CODViewport* GetCanvasVp() const

Gets the viewport on the model.

VIEWS_API void SetCanvasVp(CODViewport* pVp)

Sets the viewport on the model.

VIEWS_API CODViewport* GetVp() const

Gets the viewport on the model.

VIEWS_API void SetVp(CODViewport* pVp)

Sets the viewport on the model.

General Operations

VIEWS_API virtual void EqualOffset(LPPOINT lpDev)

Causes an operation to have an equal offest in the horizontal and vertical directions.

VIEWS_API virtual void Manhattan(LPPOINT lpReference, LPPOINT lpTarget)

Causes lines to form 90 degree angles.

VIEWS_API virtual void AlignWithGrid(CODComponent* pComp, OD_CONTROL_POINT nAlignPoint = OD_TOP_LEFT)

Aligns a component with the grid.

VIEWS_API virtual void SetWithinBoundaries(CODComponent* pComp)

Adjusts component so it falls within diagram boundaries.

VIEWS_API virtual void SetComponentDefaults(CODComponent* pComp)

Sets the current viewport defaults to a component.

VIEWS_API virtual void CancelAction(UINT nFlags, CPoint ptDev)

Cancels common actions.

VIEWS_API void UseComponentDefaults(BOOL bUseCompDefaults=TRUE)

Set to TRUE if the component should be initialized using default properties contained in the viewport.

VIEWS_API BOOL IsUsingComponentDefaults() const

TRUE indicates the component is being initialized using default properties contained in the viewport.

VIEWS_API virtual void AddCustomPages(CPropertySheet* pSheet)

Add Customized Pages to the property sheet

BOOL m_bUseCompDefaults

TRUE indicates components should be intialized using properties contained in the viewport.

Viewport coordinate conversions

VIEWS_API void VpDPtoLP(LPPOINT lpPoints, int nCount = 1)

Converts points from device coordinates to logical coordinates using the viewport's device context.

VIEWS_API void VpDPtoLP(CODPointArray* pPointArray)

Converts points from device coordinates to logical coordinates using the viewport's device context.

VIEWS_API void VpLPtoDP(LPPOINT lpPoints, int nCount = 1)

Converts points from logical coordinates to device coordinates using the viewport's device context.

VIEWS_API void VpLPtoDP(CODPointArray* pPointArray)

Converts points from logical coordinates to device coordinates using the viewport's device context.

Context Menus

CMenu* m_pContextMenu

A pointer to a menu from which the context menu can be

VIEWS_API virtual CMenu* CreateContextMenu()

Creates and initializes the pop up context menu.

VIEWS_API virtual void AddVerbsToMenu(HMENU hmenu, CODComponent* pSelection)

Adds control verbs to the context menu

Hit Testing

CPoint m_ptOrigDev

The original point clicked in device coordinates.

CPoint m_ptOrigLog

The original point clicked in logical coordinates.

CPoint m_ptLastMouseMove

The last point sent to the OnMouseMove handler.

CODComponent* m_pCompHit

A pointer to the component hit by a mouse click.

VIEWS_API virtual void Rollover(UINT nFlags, CPoint ptDev)

Checks if the mouse has rolled over a part of a component.

VIEWS_API virtual BOOL RolloverHandles(UINT nFlags, CPoint ptLog)

Checks if the mouse has rolled over a handle of a component.

VIEWS_API virtual BOOL RolloverEdges(UINT nFlags, CPoint ptLog)

Checks if the mouse has rolled over an edge of component.

VIEWS_API virtual BOOL RolloverComponents(UINT nFlags, CPoint ptLog)

Checks if the mouse has rolled over a component.

VIEWS_API virtual void Hit(UINT nFlags, CPoint ptDev, int nButton = VK_LBUTTON)

Checks if a part of a component has been clicked.

VIEWS_API virtual BOOL HitHandle(UINT nFlags, CPoint ptLog, int nButton = VK_LBUTTON)

Checks if a handle of a component has been clicked.

VIEWS_API virtual BOOL HitEdge(UINT nFlags, CPoint ptLog, int nButton = VK_LBUTTON)

Checks if an edge of a component has been clicked.

VIEWS_API virtual BOOL HitComponent(UINT nFlags, CPoint ptLog, int nButton = VK_LBUTTON)

Checks if a component has been clicked.

VIEWS_API virtual void DblHit(UINT nFlags, CPoint ptDev, int nButton = VK_LBUTTON)

Checks if component has been double-clicked.

Selection

CODComponentSet m_setSelection

The currently selected components.

BOOL m_bResetSelection

Non-zero if the selection needs to be reset.

BOOL m_bNoStretchScaling

Non-zero if a no-stretch scaling operation is being performed.

VIEWS_API void GetRotateComponents(const CODComponentSet& setComponents, CODComponentSet& setRotate)

Finds the components which allow rotation in a set.

VIEWS_API void GetMoveComponents(const CODComponentSet& setComponents, CODComponentSet& setMove)

Finds the components which allow moves in a set.

VIEWS_API void GetScaleComponents(const CODComponentSet& setComponents, CODComponentSet& setScale)

Finds the components which allow scaling in a set.

VIEWS_API CODComponentSet* GetSelection()

Returns a pointer to the set of selected components.

VIEWS_API void ClearSelection()

Clear selection list.

VIEWS_API CODComponent* GetAnchor()

Gets the anchor component in the selection.

VIEWS_API virtual void OnSelectionChange(CODComponentSet* pChangedSet)

Called whenever the selection changes.

VIEWS_API virtual void OnSelectionDo(CODCommand* pCmd)

Used to update the set of selected components when the given command is executed.

VIEWS_API virtual void OnSelectionUndo(CODCommand* pCmd)

Used to update the set of selected components when the given command is reversed.

VIEWS_API void SelectAll()

Used to select all components in the diagram. This method can be called from a menu message handler. It is not part of the default edit menu.

VIEWS_API int Deselect(CODComponentSet* pCompSet)

Removes the given components from the selection set.

VIEWS_API BOOL SelectComponent(CODComponent *pCompSel, BOOL bSelect = TRUE, BOOL bDeselectOthers = FALSE)

Used to select and deselect a single component in the diagram based on a boolean parameter.
This method also has the option of deselecting all other components in the diagram or adding a new component to the existing selection.
This method can be called from a menu message handler. It is not part of the default edit menu.

Cursors

HCURSOR m_hCursor

The current cursor being used.

VIEWS_API void SetCustomCursor(UINT nCursor = 0)

Sets a cursor from the resources as current.

VIEWS_API void SetStandardCursor(LPCTSTR lpszCursor)

Sets one of the standard Windows cursors as current.

Movement

int m_nLastMoveX

The last horizontal movement offset of the component.

int m_nLastMoveY

The last vertical movement offset of the component.

VIEWS_API virtual void StartMoving(UINT nFlags, CPoint ptDev)

Called when components begin to move.

VIEWS_API virtual void Moving(UINT nFlags, CPoint ptDev)

Called while the components are moving.

VIEWS_API virtual void EndMoving(UINT nFlags, CPoint ptDev)

Called when the components stop moving.

OLE Drag and Drop

CLIPFORMAT NEAR m_cfCanvas

The clipboard format of the diagram.

CODDropTarget* m_pDropTarget

The drop target used for OLE drag and drop.

BOOL m_bClipboardText

Indicates if text is supported for clipboard operations.

BOOL m_bClipboardEnhMetafile

Indicates if enhanced metafile format is supported for clipboard operations.

VIEWS_API CLIPFORMAT GetClipFormat() const

Returns the clipboard format used in this controller.

VIEWS_API BOOL ClipboardTextEnabled() const

Indicates if text is supported for clipboard operations.

VIEWS_API void EnableClipboardText(const BOOL bFlag)

Sets a flag that indicates if text is accepted from the clipboard.

VIEWS_API BOOL ClipboardEnhMetafileEnabled() const

Indicates if enhanced metafile format is supported for clipboard operations.

VIEWS_API void EnableClipboardEnhMetafiles(const BOOL bFlag)

Determines if enhanced metafile format is supported for clipboard operations.

VIEWS_API virtual BOOL IsOleInitialized()

Returns TRUE if the OLE libraries have been initialized.

VIEWS_API virtual void CopyToClipboard(CODComponentSet* pCompSet)

Copies a set of components to the clipboard.

VIEWS_API virtual void CopyFromClipboard(CODComponentSet* pCompSet)

Copies a set of component from the clipboard.

VIEWS_API void LoadComponents(CArchive& ar, CODComponentSet& setPrimary, CODComponentSet& setDependents)

Retrieve a set of components and their dependents from an archive.

VIEWS_API void StoreComponents(CArchive& ar, const CODComponentSet& setComponents)

Store a set of components and their dependents to an archive.

VIEWS_API virtual void DoOleDragAndDrop()

Performs the OLE version of drag and drop.

VIEWS_API virtual void CreateDropTarget()

Creates a drop target.

VIEWS_API virtual CODDropSource* CreateDropSource()

Creates a drop source.

Rotation

int m_nOrigAngle

The original angle the component was at, in tenths of a degree.

int m_nLastAngle

The last angle the component was at, in tenths of a degree.

CPoint m_ptCenterLog

Center point of a component in logical coordinates.

VIEWS_API virtual void StartRotating(UINT nFlags, CPoint ptDev)

Called when components begin to rotate.

VIEWS_API virtual void Rotating(UINT nFlags, CPoint ptDev)

Called while components are rotating.

VIEWS_API virtual void EndRotating(UINT nFlags, CPoint ptDev)

Called when the components stop rotating.

Scaling

int m_nHandleHit

The index of the control handle hit.

int m_nOrigWidth

The height of the component being scaled.

int m_nOrigHeight

The width of the component being scaled.

float m_fLastScaleX

The last horizontal scaling factor.

float m_fLastScaleY

The last vertical scaling factor.

int m_nHandleIndex

Index of the handle being manipulated.

OD_CONTROL_POINT m_nLastCenter

The last control point used for the origin of an operation

VIEWS_API virtual void StartScaling(UINT nFlags, CPoint ptDev)

Called when components being scaling.

VIEWS_API virtual void Scaling(UINT nFlags, CPoint ptDev)

Called while the components are scaling.

VIEWS_API virtual void EndScaling(UINT nFlags, CPoint ptDev)

Called when the components finish scaling.

Vertex editing

VIEWS_API virtual BOOL IsEditingVertices()

Returns TRUE if in edit vertex mode.

VIEWS_API virtual BOOL CanEditVertices(CODComponent* pComp)

Returns TRUE if the vertices of the component can be edited.

VIEWS_API virtual BOOL CanAlwaysEditVertices(CODComponent* pComp)

Returns TRUE if the vertices of the component can always be edited.

VIEWS_API virtual BOOL IsVertexEditAllowed(CODComponent* pComp)

Returns TRUE if a vertex editing operation is currently allowed on the component.

VIEWS_API virtual void StartMovingVertex(UINT nFlags, CPoint ptDev)

Called when a vertex of a component begins to move.

VIEWS_API virtual void MovingVertex(UINT nFlags, CPoint ptDev)

Called while a vertex of a component is moving.

VIEWS_API virtual void EndMovingVertex(UINT nFlags, CPoint ptDev)

Called when a vertex of a component stop moving.

VIEWS_API virtual void StartMovingPort(UINT nFlags, CPoint ptDev)

Called when a port begins to move.

VIEWS_API virtual void MovingPort(UINT nFlags, CPoint ptDev)

Called while a port is moving.

VIEWS_API virtual void EndMovingPort(UINT nFlags, CPoint ptDev)

Called when a port stops moving.

VIEWS_API virtual void CancelMovingPort(UINT nFlags, CPoint ptDev)

Called to cancel the moving of a port.

CODPortComponent* m_pMovingPort

Pointer to port that is moving.

CODConnection* m_pMovingConnection

Pointer to connection that affected by moving port.

Text editing

CODTextComponent* m_pTextEdit

Pointer to text component being edited.

VIEWS_API virtual BOOL StartTextEdit(UINT nFlags, CPoint ptDev)

Begin editing the text component at the given point.

VIEWS_API virtual void EndTextEdit(UINT nFlags, CPoint ptDev)

Finish text component editing.

VIEWS_API virtual void UpdateTextEdit()

Synchronize active text component.

Line creation

VIEWS_API void TrackLine(CPoint ptTrackDev)

Tracks a line on the screen.

VIEWS_API virtual void LineReady(UINT nFlags, CPoint ptDev)

Called when the user is ready to draw a line.

VIEWS_API virtual void StartLine(UINT nFlags, CPoint ptDev)

Called when the line starts to be drawn.

VIEWS_API virtual void DrawingLine(UINT nFlags, CPoint ptDev)

Called while the line is being drawn.

VIEWS_API virtual void EndLine(UINT nFlags, CPoint ptDev)

Called when the line has beem completed.

VIEWS_API virtual void CancelLine(UINT nFlags, CPoint ptDev)

Called to cancel the drawing of the line.

Polyline creation

VIEWS_API void TrackPolyline(CPoint ptTrackDev)

Tracks a multi-segmented line.

VIEWS_API virtual void PolylineReady(UINT nFlags, CPoint ptDev)

Called when the user is ready to draw a multi-segmented line.

VIEWS_API virtual void StartPolyline(UINT nFlags, CPoint ptDev)

Called when the polyline is started.

VIEWS_API virtual void GrowPolyline(UINT nFlags, CPoint ptDev)

Called when a new segment is added to the line.

VIEWS_API virtual void DrawingPolyline(UINT nFlags, CPoint ptDev)

Called while the multi-segmented line is being drawn.

VIEWS_API virtual void EndPolyline(UINT nFlags, CPoint ptDev)

Called when the multi-segmented line is complete.

VIEWS_API virtual void CancelPolyline(UINT nFlags, CPoint ptDev)

Called to cancel the drawing of the multi-segmented line.

Polygon creation

VIEWS_API void TrackPolygon(CPoint ptTrackDev)

Tracks a polygon.

VIEWS_API virtual void PolygonReady(UINT nFlags, CPoint ptDev)

Called when the user is ready to draw a polygon.

VIEWS_API virtual void StartPolygon(UINT nFlags, CPoint ptDev)

Called when a polygon is started.

VIEWS_API virtual void GrowPolygon(UINT nFlags, CPoint ptDev)

Called when a segment is added to the polygon.

VIEWS_API virtual void DrawingPolygon(UINT nFlags, CPoint ptDev)

Called as the polygon is being drawn.

VIEWS_API virtual void EndPolygon(UINT nFlags, CPoint ptDev)

Called when the polygon is complete.

VIEWS_API virtual void CancelPolygon(UINT nFlags, CPoint ptDev)

Called to cancel the drawing of the polygon.

Curve creation

VIEWS_API void TrackPolyCurve(CPoint ptTrackDev)

Tracks the creation of a polycurve shape on the screen.

VIEWS_API virtual void PolyCurveReady(UINT nFlags, CPoint ptDev)

Called when the user is ready to start drawing an polycurve.

VIEWS_API virtual void StartPolyCurve(UINT nFlags, CPoint ptDev)

Called when the curve starts to be drawn.

VIEWS_API virtual void GrowPolyCurve(UINT nFlags, CPoint ptDev)

Called when a new segment is added to the current spline.

VIEWS_API virtual void DrawingPolyCurve(UINT nFlags, CPoint ptDev)

Called while the curve is being drawn.

VIEWS_API virtual void EndPolyCurve(UINT nFlags, CPoint ptDev)

Called when the curve is complete.

VIEWS_API virtual void CancelPolyCurve(UINT nFlags, CPoint ptDev)

Called to cancel the drawing of the curve.

Closed Curve creation

VIEWS_API void TrackClosedCurve(CPoint ptTrackDev)

Tracks the creation of a curve shape on the screen.

VIEWS_API virtual void ClosedCurveReady(UINT nFlags, CPoint ptDev)

Called when the user is ready to start drawing an curve.

VIEWS_API virtual void StartClosedCurve(UINT nFlags, CPoint ptDev)

Called when the curve starts to be drawn.

VIEWS_API virtual void GrowClosedCurve(UINT nFlags, CPoint ptDev)

Called when a new segment is added to the current spline.

VIEWS_API virtual void DrawingClosedCurve(UINT nFlags, CPoint ptDev)

Called while the curve is being drawn.

VIEWS_API virtual void EndClosedCurve(UINT nFlags, CPoint ptDev)

Called when the curve is complete.

VIEWS_API virtual void CancelClosedCurve(UINT nFlags, CPoint ptDev)

Called to cancel the drawing of the curve.

Rectangle creation

VIEWS_API void TrackRect(CPoint ptTrackDev)

Tracks a rectangle on the screen.

VIEWS_API virtual void RectReady(UINT nFlags, CPoint ptDev)

Called when the user is ready to start drawing a rectangle.

VIEWS_API virtual void StartRect(UINT nFlags, CPoint ptDev)

Called when the rectangle starts to be drawn.

VIEWS_API virtual void DrawingRect(UINT nFlags, CPoint ptDev)

Called while the rectangle is being drawn.

VIEWS_API virtual void EndRect(UINT nFlags, CPoint ptDev)

Called when the rectangle is complete.

VIEWS_API virtual void CancelRect(UINT nFlags, CPoint ptDev)

Called to cancel the drawing of the rectangle.

Ellipse creation

VIEWS_API void TrackEllipse(CPoint ptTrackDev)

Tracks an ellipse shape on the screen.

VIEWS_API virtual void EllipseReady(UINT nFlags, CPoint ptDev)

Called when the user is ready to start drawing an ellipse.

VIEWS_API virtual void StartEllipse(UINT nFlags, CPoint ptDev)

Called when the ellipse starts to be drawn.

VIEWS_API virtual void DrawingEllipse(UINT nFlags, CPoint ptDev)

Called while the ellipse is being drawn.

VIEWS_API virtual void EndEllipse(UINT nFlags, CPoint ptDev)

Called when the ellipse is complete.

VIEWS_API virtual CODComponent* CreateEllipse(const CRect& rcCreate)

Called by the framework to create an ellipse component.

VIEWS_API virtual void CancelEllipse(UINT nFlags, CPoint ptDev)

Called to cancel the drawing of the ellipse.

Image insertion

VIEWS_API virtual void InsertImage(UINT nFlags, CPoint ptDev)

Called when the user is ready to insert an image.

VIEWS_API virtual void CancelImage(UINT nFlags, CPoint ptDev)

Called to cancel the image insertion.

Text creation

VIEWS_API virtual void InsertText(UINT nFlags, CPoint ptDev)

Called when the user is ready to insert text.

VIEWS_API virtual void CancelText(UINT nFlags, CPoint ptDev)

Called to cancel the text insertion.

Port creation

VIEWS_API virtual void InsertPort(UINT nFlags, CPoint ptDev)

Called when the user is ready to insert a port.

VIEWS_API virtual void CancelPort(UINT nFlags, CPoint ptDev)

Called to cancel the port insertion.

Symbol insertion

CODComponent* m_pInsert

The component being inserted into the diagram.

CODPointArray m_arPointsLog

A list of gathered points, in logical coordinates.

VIEWS_API virtual void OnInsertSymbol(CODComponent* pSymbolInsert)

Called when the user is ready to insert a symbol.

VIEWS_API virtual void OnDrawSymbol(CODComponent* pSymbolInsert)

Called when the user is ready to draw a symbol.

VIEWS_API virtual void SymbolReady(UINT nFlags, CPoint ptDev)

Called when a left mouse button down event is received to begin drawing the tracking rectangle for a new symbol.

VIEWS_API virtual void StartSymbol(UINT nFlags, CPoint ptDev)

Called when the user begins to draw the new symbol.

VIEWS_API virtual void DrawingSymbol(UINT nFlags, CPoint ptDev)

Called when the user is in the process of drawing the new symbol.

VIEWS_API virtual void EndSymbol(UINT nFlags, CPoint ptDev)

Called when the user finishes drawing the new symbol.

VIEWS_API virtual void InsertSymbol(UINT nFlags, CPoint ptDev)

Called to insert a symbol.

VIEWS_API virtual void CancelSymbol(UINT nFlags, CPoint ptDev)

Called to cancel the symbol insertion.

Tracking

CPoint m_ptTrackDev

Tracking point, in device coordinates.

CODComponentSetTracker m_compSetTracker

The components which are being tracked.

CODComponentSet m_setTracking

The set of components begin tracked.

CODComponentSet m_setCmdTracking

The set of editable components to which tracking changes will be applied.

CODComponentSet m_setTrackingDep

The set of components which are dependant on the components being tracked.

VIEWS_API virtual void SetCapture()

Sets mouse capture, handling associated MVC implementation details.

VIEWS_API virtual void ReleaseCapture()

Releases mouse capture, handling associated MVC implementation details.

VIEWS_API virtual void BeginTracking(const CODComponentSet& setTracking)

Begins tracking the manipluation of components.

VIEWS_API virtual void EraseTracking()

Erases tracking in viewport.

VIEWS_API virtual void DrawTracking()

Draws tracking in viewport.

VIEWS_API virtual void EndTracking()

Ends the tracking of components.

Linking

CODPortComponent* m_pSourcePort

The source port of a link operation.

CODPortComponent* m_pTargetPort

The target port of a link operation.

int m_nPortHitTestSlop

Size of slop value in device units for port hit testing.

VIEWS_API virtual void OnInsertLink(CODLinkComponent* pLinkInsert)

Called when the user is ready to insert a link.

VIEWS_API virtual void LinkReady(UINT nFlags, CPoint ptDev)

Called when the user is ready to create a link.

VIEWS_API virtual void GrowLink(UINT nFlags, CPoint ptDev)

Called when a segment is added to the link.

VIEWS_API virtual void DrawingLink(UINT nFlags, CPoint ptDev)

Called while the link is being drawn.

VIEWS_API virtual void EndLink(UINT nFlags, CPoint ptDev)

Called when the link is complete.

VIEWS_API virtual void CancelLink(UINT nFlags, CPoint ptDev)

Called to cancel the link.

VIEWS_API void SetPortHitTestSlop(const int nPortHitTestSlop)

Sets the slop value for port hit testing.

Zooming

VIEWS_API virtual void ZoomIn(UINT nFlags, CPoint ptDev)

Zooms in on the diagram.

VIEWS_API virtual void ZoomOut(UINT nFlags, CPoint ptDev)

Zooms out from the diagram.

VIEWS_API virtual void ZoomReady(UINT nFlags, CPoint ptDev)

Called when the controller is ready to start a zoom operation.

VIEWS_API virtual void StartZoomRect(UINT nFlags, CPoint ptDev)

Called when the controller starts tracking a zoom rectangle.

VIEWS_API virtual void ZoomRect(UINT nFlags, CPoint ptDev)

Called while the zoom rectangle is being drawn.

VIEWS_API virtual void EndZoomRect(UINT nFlags, CPoint ptDev)

Called when the zoom rectangle is complete.

Panning

VIEWS_API virtual void PanReady(UINT nFlags, CPoint ptDev)

Called when the controller is ready to start panning.

VIEWS_API virtual void Panning(UINT nFlags, CPoint ptDev)

Called as the controller is panning the viewport.

VIEWS_API virtual void EndPanning(UINT nFlags, CPoint ptDev)

Called when panning is complete.

VIEWS_API virtual void StartSelecting(UINT nFlags, CPoint ptDev)

Called when the selection rectangle is started.

VIEWS_API virtual void Selecting(UINT nFlags, CPoint ptDev)

Called while the selection rectangle is being drawn.

VIEWS_API virtual void EndSelecting(UINT nFlags, CPoint ptDev)

Called when the selection rectangle has been completed.

Drag Scrolling

int m_nDragScrollMargin

Margin for drag scrolling in device units.

int m_nDragScrollIncrement

Number of logical to units to scroll when drag scrolling.

SEC_UINT m_nDragScrollTimerID

Event ID for drag scroll timer.

UINT m_nDragScrollTimerElapse

Time-out value for drag scroll timer.

VIEWS_API void SetDragScrolling(const int nMargin, const int nIncrement = 10, const UINT nTimerElapse = 100, const UINT nTimerID = 1001)

Enables or disables drag scrolling and initializes drag scroll parameters.

VIEWS_API BOOL StartDragScroll()

Sets the timer for drag scrolling.

VIEWS_API BOOL StopDragScroll()

Kills the timer for drag scrolling.

VIEWS_API BOOL DragScrollHitTest(const CPoint& ptDrag)

Determine if the given point falls within the drag scroll margin.

VIEWS_API virtual BOOL DoDragScroll(const CPoint& ptDrag, CSize& szScroll)

Scrolls the viewport if the point is within the drag scroll margin.

VIEWS_API virtual void OnDragScroll()

Called by the framework when the drag scroll timer fires.

Grouping

VIEWS_API virtual CODComponent* CreateGroupComponent(const CODComponentSet& setGroup)

Factory method for creating component for group operation.

Input focus

VIEWS_API virtual CODComponent* SetFocusNext()

Change input focus to next component in tab order.

VIEWS_API virtual CODComponent* SetFocusPrev()

Change input focus to previous component in tab order.

File Export

VIEWS_API virtual BOOL FileExportPrompt(CString& strFileName, DWORD* pFilterIdx = NULL, UINT nTitleID = IDS_OD_EXPORT_TITLE, UINT nFilterID = IDS_OD_EXPORT_FILTER)

Prompts the user for a filename and format to export diagram into.

VIEWS_API virtual BOOL SaveDib(LPCTSTR lpszFileName)

Saves contents of the viewport to a Windows bitmap.

VIEWS_API virtual BOOL SaveMetafile(LPCTSTR lpszFileName)

Saves the contents of the viewport to an enhanced metafile.

CSize m_szMag

The current magnification of the viewport.

Command Creation

VIEWS_API virtual CODInsertCommand* ExecuteInsertCommand(CODComponent* pComp, const BOOL bAllowDuplicates = TRUE)

Creates and executes an insert command for a single component.

VIEWS_API virtual CODInsertCommand* ExecuteInsertCommand(CODComponentSet* pCompSet, const BOOL bAllowDuplicates = TRUE)

Creates and executes an insert command for a set of components.

VIEWS_API virtual CODDeleteCommand* ExecuteDeleteCommand(CODComponentSet* pCompSet)

Creates and executes a delete command.

VIEWS_API virtual void RemoveImage(CODComponentSet* pCompSet)

Removes deleted image component

VIEWS_API virtual CODGroupCommand* ExecuteGroupCommand(CODComponentSet* pCompSet)

Creates and executes a group command.

VIEWS_API virtual CODUngroupCommand* ExecuteUngroupCommand(CODComponentSet* pCompSet)

Creates and executes an ungroup command.

VIEWS_API virtual CODLinkCommand* ExecuteLinkCommand(const CODPointArray& pointArray, CODPortComponent* pSourcePort, CODPortComponent* pTargetPort, CODEndpoint* pSourceEndpoint = NULL, CODEndpoint* pTargetEndpoint = NULL)

Creates and executes a link command.

VIEWS_API virtual CODLinkCommand* ExecuteLinkCommand(CODLinkComponent* pLinkComp, const CODPointArray& pointArray, CODPortComponent* pSourcePort, CODPortComponent* pTargetPort)

Creates and executes a link command.

VIEWS_API virtual CODLinkCommand* ExecuteLinkCommand(CODLinkComponent* pLinkComp, CODPortComponent* pSourcePort, CODPortComponent* pTargetPort)

Creates and executes a link command.

VIEWS_API virtual CODOrderCommand* ExecuteOrderCommand(CODComponentSet* pCompSet, OD_ORDER nOrderType)

Creates and executes an order command.

VIEWS_API virtual CODMoveCommand* ExecuteMoveCommand(CODComponentSet* pCompSet, int nOffsetX, int nOffsetY)

Creates and executes a move command.

VIEWS_API virtual CODRotateCommand* ExecuteRotateCommand(CODComponentSet* pCompSet, int nAngle)

Creates and executes a rotate command.

VIEWS_API virtual CODScaleCommand* ExecuteScaleCommand(CODComponentSet* pCompSet, float fScaleX, float fScaleY, OD_CONTROL_POINT nControlPoint)

Creates and executes a scale command.

VIEWS_API virtual CODInsertVertexCommand* ExecuteInsertVertexCommand(CODComponent* pComp, int nVertexIndex, CPoint ptVertex)

Creates and executes an insert vertex command.

VIEWS_API virtual CODDeleteVertexCommand* ExecuteDeleteVertexCommand(CODComponent* pComp, int nVertexIndex)

Creates and executes a delete vertex command.

VIEWS_API virtual CODMoveVertexCommand* ExecuteMoveVertexCommand(CODComponent* pComp, int nVertexIndex, int nOffsetX, int nOffsetY)

Creates and executes a move vertex command.

VIEWS_API virtual CODMovePortCommand* ExecuteMovePortCommand(CODPortComponent* pPort, int nOffsetX, int nOffsetY, CODPortComponent* pPortConnect = NULL)

Creates and executes a move port command.

VIEWS_API virtual CODTextCommand* ExecuteTextCommand(CODComponentSet* pCompSet, const LPCTSTR lpszText)

Creates and executes a text command.

VIEWS_API virtual CODAlignCommand* ExecuteAlignCommand(CODComponentSet* pCompSet, OD_ALIGNMENT nAlignment)

Creates and executes an align command.

VIEWS_API virtual CODSpacingCommand* ExecuteSpaceAcrossCommand(CODComponentSet* pCompSet)

Creates and executes a spacing command to evenly space components across the canvas.

VIEWS_API virtual CODSpacingCommand* ExecuteSpaceDownCommand(CODComponentSet* pCompSet)

Creates and executes a spacing command to evenly space components down the canvas.

VIEWS_API virtual CODSizeCommand* ExecuteSetWidthCommand(CODComponentSet* pCompSet, const int nWidth)

Creates and executes a size command to set the width of the components.

VIEWS_API virtual CODSizeCommand* ExecuteSetHeightCommand(CODComponentSet* pCompSet, const int nHeight)

Creates and executes a size command to set the height of the components.

VIEWS_API virtual CODSizeCommand* ExecuteSetSizeCommand(CODComponentSet* pCompSet, const CSize& szBounds)

Creates and executes a size command to set the size of the components.

Generated message map functions

VIEWS_API afx_msg void OnEditCut()

Called to move the components currently selected to the clipboard.

VIEWS_API afx_msg void OnEditCopy()

Called to copy the components currently selected to the clipboard.

VIEWS_API afx_msg void OnEditPaste()

Called to paste the components currently on the clipboard to the diagram.

VIEWS_API afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI)

Updates a user interface object associated with pasting.

VIEWS_API afx_msg void OnEditUndo()

Called to undo the last action.

VIEWS_API afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI)

Updates a user interface object associated with undo.

VIEWS_API afx_msg void OnEditRedo()

Called to redo the last action undone.

VIEWS_API afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI)

Updates a user interface object associated with redo.

VIEWS_API afx_msg void OnEditClear()

Called to delete the components currently selected.

VIEWS_API afx_msg void OnVerb( UINT nID )

Called to invoke a verb from the context menu.

VIEWS_API afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)

Called when a nonsystem key is pressed.

VIEWS_API afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)

Called when a nonsystem key is released.

VIEWS_API afx_msg void OnLButtonDown(UINT nFlags, CPoint point)

Called when the left mouse button is pressed.

VIEWS_API afx_msg void OnLButtonUp(UINT nFlags, CPoint point)

Called when the left mouse button is released.

VIEWS_API afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point)

Called when the left mouse button is double-clicked.

VIEWS_API afx_msg void OnRButtonDown(UINT nFlags, CPoint point)

Called when the right mouse button is pressed.

VIEWS_API afx_msg void OnRButtonUp(UINT nFlags, CPoint point)

Called when the right mouse button is released.

VIEWS_API afx_msg void OnMouseMove(UINT nFlags, CPoint point)

Called when the mouse cursor is moved.

VIEWS_API afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)

Called to set the current cursor.

VIEWS_API afx_msg void OnViewComponents()

Called when the user wants to view a list of components currently in the diagram.

VIEWS_API afx_msg void OnViewGrid()

Toggles the visibility of the background grid.

VIEWS_API afx_msg void OnUpdateViewGrid(CCmdUI* pCmdUI)

Updates a user interface object associated with grid visibility.

VIEWS_API afx_msg void OnViewPageBounds()

Toggles the visibility of the page bounds.

VIEWS_API afx_msg void OnUpdateViewPageBounds(CCmdUI* pCmdUI)

Updates a user interface object associated with page bounds visibility.

VIEWS_API afx_msg void OnSnapToGrid()

Toggles the snap to grid setting.

VIEWS_API afx_msg void OnUpdateSnapToGrid(CCmdUI* pCmdUI)

Updates a user interface object associated with snap to grid.

VIEWS_API afx_msg void OnAngleSnap()

Toggles the angle snap setting.

VIEWS_API afx_msg void OnUpdateAngleSnap(CCmdUI* pCmdUI)

Updates a user interface object associated with angle snap.

VIEWS_API afx_msg void OnPageSetup()

Called when the user wants to view or edit the page settings.

VIEWS_API afx_msg void OnProperties()

Called when the user wishes to view or edit the properties associated with the components in the current selection.

VIEWS_API afx_msg void OnGridProperties()

Called when the user wants to view or edit the grid properties.

VIEWS_API afx_msg void OnDefaultProperties()

Called when the user wants to view or edit the default properites for all new components.

VIEWS_API afx_msg void OnGroup()

Called to group the currently selected components into one composite component.

VIEWS_API afx_msg void OnUngroup()

Called to split up the currently selected components into their individual subcomponents, if possible.

VIEWS_API afx_msg void OnUpdateUngroup(CCmdUI* pCmdUI)

Updates a user interface object associated with ungrouping.

VIEWS_API afx_msg void OnDrawSelect()

Called when the controller is put into selection mode.

VIEWS_API afx_msg void OnUpdateDrawSelect(CCmdUI* pCmdUI)

Updates a user interface object associated with selection.

VIEWS_API afx_msg void OnRotate()

Called when the controller is put into rotation mode.

VIEWS_API afx_msg void OnUpdateRotate(CCmdUI* pCmdUI)

Updates a user interface object associated with rotation.

VIEWS_API afx_msg void OnRotateLeft()

Called to rotate the currently selected components 90 degrees counter clockwise.

VIEWS_API afx_msg void OnRotateRight()

Called to rotate the currently selected components 90 degrees clockwise.

VIEWS_API afx_msg void OnDrawRect()

Called to start the creation process of a new rectangle component.

VIEWS_API afx_msg void OnUpdateDrawRect(CCmdUI* pCmdUI)

Updates a user interface object associated with drawing a rectangle.

VIEWS_API afx_msg void OnDrawPolyCurve()

Called to start the creation process of a new polycurve component.

VIEWS_API afx_msg void OnUpdateDrawPolyCurve(CCmdUI* pCmdUI)

Updates a user interface object associated with drawing a polycurve.

VIEWS_API afx_msg void OnDrawClosedCurve()

Called to start the creation process of a new closed curve component.

VIEWS_API afx_msg void OnUpdateDrawClosedCurve(CCmdUI* pCmdUI)

Updates a user interface object associated with drawing a closed curve.

VIEWS_API afx_msg void OnDrawEllipse()

Called to start the creation process of a new ellipse component.

VIEWS_API afx_msg void OnUpdateDrawEllipse(CCmdUI* pCmdUI)

Updates a user interface object associated with drawing an ellipse.

VIEWS_API afx_msg void OnDrawLine()

Called to start the creation process of a new line component.

VIEWS_API afx_msg void OnUpdateDrawLine(CCmdUI* pCmdUI)

Updates a user interface object associated with drawing a line.

VIEWS_API afx_msg void OnDrawPolyline()

Called to start the creation process of a new polyline component.

VIEWS_API afx_msg void OnUpdateDrawPolyline(CCmdUI* pCmdUI)

Updates a user interface object associated with drawing a polyline.

VIEWS_API afx_msg void OnDrawPolygon()

Called to start the creation process of a new polygon component.

VIEWS_API afx_msg void OnUpdateDrawPolygon(CCmdUI* pCmdUI)

Updates a user interface object associated with drawing a polygon.

VIEWS_API afx_msg void OnDrawText()

Called to start the creation process of a new text component.

VIEWS_API afx_msg void OnUpdateDrawText(CCmdUI* pCmdUI)

Updates a user interface object associated with creating a text component.

VIEWS_API afx_msg void OnDrawImage()

Called to start the creation process of a new image component.

VIEWS_API afx_msg void OnUpdateDrawImage(CCmdUI* pCmdUI)

Updates the user interface object associated with creating an image component.

VIEWS_API afx_msg void OnDrawPort()

Called to start the creation process of a new port component.

VIEWS_API afx_msg void OnUpdateDrawPort(CCmdUI* pCmdUI)

Updates a user interface object associated with creating a port component.

VIEWS_API afx_msg void OnLinkSymbols()

Called to start the creation process of a new link component.

VIEWS_API afx_msg void OnUpdateLinkSymbols(CCmdUI* pCmdUI)

Updates a user interface object associated with creating a link.

VIEWS_API afx_msg void OnFlipHorizontal()

Called to flip the currently selected components about the y axis.

VIEWS_API afx_msg void OnFlipVertical()

Called to flip the currently selected components about the x axis.

VIEWS_API afx_msg void OnNudgeUp()

Called to move the currently selected components up slightly.

VIEWS_API afx_msg void OnNudgeDown()

Called to move the currently selected components down slightly.

VIEWS_API afx_msg void OnNudgeLeft()

Called to move the currently selected components to the left slightly.

VIEWS_API afx_msg void OnNudgeRight()

Called to move the currently selected components to the right slightly.

VIEWS_API afx_msg void OnSetFocusNext()

Set focus to next component in tab order.

VIEWS_API afx_msg void OnSetFocusPrev()

Set focus to previous component in tab order.

VIEWS_API afx_msg void OnAlignMiddle()

Called to align the vertical centers of the currently selected components.

VIEWS_API afx_msg void OnAlignBottom()

Called to align the bottoms of the currently selected components.

VIEWS_API afx_msg void OnAlignLeft()

Called to align the left sides of the currently selected components.

VIEWS_API afx_msg void OnAlignCenter()

Called to align the horizontal centers of the currently selected components.

VIEWS_API afx_msg void OnAlignRight()

Called to align the right sides of the currently selected components.

VIEWS_API afx_msg void OnSpaceAcross()

Called to space components evenly across the canvas.

VIEWS_API afx_msg void OnSpaceDown()

Called to space components evenly down the canvas.

VIEWS_API afx_msg void OnSameWidth()

Called to make selected components the same width.

VIEWS_API afx_msg void OnSameHeight()

Called to make selected components the same height.

VIEWS_API afx_msg void OnSameSize()

Called to make selected components the same size.

VIEWS_API afx_msg void OnFront()

Called to move the currently selected components to the front.

VIEWS_API afx_msg void OnBack()

Called to move the currently selected components to the back.

VIEWS_API afx_msg void OnForward()

Called to move the currently selected components forward one.

VIEWS_API afx_msg void OnBackward()

Called to move the currently selected components backward one.

VIEWS_API afx_msg void OnEditVertices()

Called to turn edit vertices mode on or off.

VIEWS_API afx_msg void OnUpdateEditVertices(CCmdUI* pCmdUI)

Updates a user interface object associated with setting the edit vertices mode.

VIEWS_API afx_msg void OnUpdateSelected(CCmdUI* pCmdUI)

Updates a user interface object that depends on at least one component being selected.

VIEWS_API afx_msg void OnUpdateMultipleSelected(CCmdUI* pCmdUI)

Updates a user interface object that depends on more than one component being selected.

VIEWS_API afx_msg void OnUpdateMoveSelected(CCmdUI* pCmdUI)

Updates the user interface object associated with edit components and depends on at least one movable component being selected.

VIEWS_API afx_msg void OnUpdateMoveMultipleSelected(CCmdUI* pCmdUI)

Updates the user interface object associated with edit components and depends on at least two components (one moveable) being selected.

VIEWS_API afx_msg void OnUpdateRotateSelected(CCmdUI* pCmdUI)

Updates the user interface object associated with edit components and depends on at least one rotatable component being selected.

VIEWS_API afx_msg void OnUpdateScaleSelected(CCmdUI* pCmdUI)

Updates the user interface object associated with edit components and depends on at least one scalable component being selected.

VIEWS_API afx_msg void OnUpdatePropEditSelected(CCmdUI* pCmdUI)

Updates the user interface object associated with edit components and depends on at least one component with editable properties being selected.

VIEWS_API afx_msg void OnUpdateEditSelected(CCmdUI* pCmdUI)

Updates the user interface object associated with edit components and depends on one or more components being selected.

VIEWS_API afx_msg void OnUpdateEditMultipleSelected(CCmdUI* pCmdUI)

Updates the user interface object associated with edit components and depends on more than one component being selected.

VIEWS_API afx_msg void OnMeasurements()

Opens a dialog for changing the canvas size and units of measure.

VIEWS_API afx_msg void OnZoom()

Called when the user indicates they want to begin a zoom operation.

VIEWS_API afx_msg void OnUpdateZoom(CCmdUI* pCmdUI)

Updates a user interface object associated with zooming.

VIEWS_API afx_msg void OnZoomNormal()

Sets the diagram back to its original zoom factor of 100%.

VIEWS_API afx_msg void OnUpdateZoomNormal(CCmdUI* pCmdUI)

Updates a user interface object associated with zooming to normal size.

VIEWS_API afx_msg void OnZoomCustom()

Zooms to a custom percentage.

VIEWS_API afx_msg void OnUpdateZoomCustom(CCmdUI* pCmdUI)

Updates a user interface object associated with custom zoom.

VIEWS_API afx_msg void OnZoomFit()

Zooms so all of the components in the model are shown in the viewport.

VIEWS_API afx_msg void OnUpdateZoomFit(CCmdUI* pCmdUI)

Updates a user interface object associated with zoom to fit.

VIEWS_API afx_msg void OnZoomSelection()

Zooms so all of the currently selected components are show in the viewport.

VIEWS_API afx_msg void OnZoom50Pct()

Zooms so the diagram is 50% of its original size.

VIEWS_API afx_msg void OnUpdateZoom50Pct(CCmdUI* pCmdUI)

Updates a user interface object associated with 50% zoom.

VIEWS_API afx_msg void OnZoom75Pct()

Zooms so the diagram is 75% of its original size.

VIEWS_API afx_msg void OnUpdateZoom75Pct(CCmdUI* pCmdUI)

Updates a user interface object associated with 75% zoom.

VIEWS_API afx_msg void OnZoom100Pct()

Zooms so the diagram is 100% of its original size.

VIEWS_API afx_msg void OnUpdateZoom100Pct(CCmdUI* pCmdUI)

Updates a user interface object associated with 100% zoom.

VIEWS_API afx_msg void OnZoom200Pct()

Zooms so the diagram is 200% of its original size.

VIEWS_API afx_msg void OnUpdateZoom200Pct(CCmdUI* pCmdUI)

Updates a user interface object associated with 200% zoom.

VIEWS_API afx_msg void OnPan()

Called when the user indicates they want to begin a panning operation.

VIEWS_API afx_msg void OnUpdatePan(CCmdUI* pCmdUI)

Updates a user interface object associated with panning.

VIEWS_API afx_msg void OnChangeTextEdit()

Called as the user is typing new characters for a text component.

VIEWS_API afx_msg void OnReturnNotifyTextEdit(NMHDR* pNMHDR, LRESULT* pResult)

Called when the user presses the enter key in the text component (edit-mode).

VIEWS_API afx_msg void OnDebugDraw()

Toggles debug drawing mode.

VIEWS_API afx_msg void OnContextMenu(CWnd* pWnd, CPoint point)

Pops up a context menu in response to the menu key.

VIEWS_API afx_msg void OnFileExport()

Exports the viewport to a selected file format.

VIEWS_API afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)

Called when a control needs a brush for painting itself.

VIEWS_API afx_msg void OnTimer(SEC_UINT nIDEvent)

Called when a timer event is fired.