Click here to Skip to main content
15,897,371 members
Articles / Desktop Programming / MFC

UMLEditor - revisiting the vector editor

Rate me:
Please Sign up or sign in to vote.
4.99/5 (156 votes)
5 Jul 2006Public Domain8 min read 378.3K   37.1K   326  
An UML editor with code-generation capabilities derived from CDiagramEditor.
<html>
<head>
<style>
body{font-size: 10pt;color: black;font-family: Verdana, Helvetica, Arial, sans-serif;background-color: #ffffff}
p{font-size: 10pt;color: black;font-family: Verdana, Helvetica, Arial, sans-serif;}
h2{font-size: 13pt;color: #ff9900;font-family: Verdana, Helvetica, Arial, sans-serif;font-weight: bold;}
h3{color: #ff9900;font-weight: bold;font-size: 11pt;font-family: Arial, sans-serif;}
table{background-color:#f0f0ff;}
td{font-size: 10pt;color: black;font-family: Verdana, Helvetica, Arial, sans-serif;padding:4px;}
pre{padding-right: 7pt;padding-left: 7pt;padding-bottom: 7pt;font: 9pt 'Courier New', Courier, mono;width: 100%;padding-top: 7pt;white-space: pre;background-color: #fbedbb}
code{color: #990000;font-family: 'Courier New', Courier, mono;}
A:link{text-decoration: none}
A:visited{text-decoration: none}
A:active{text-decoration: underline}
A:hover{text-decoration: underline}
A.top:link{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
A.top:visited{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
A.top:active{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
A.top:hoover{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
</style>
</head>
<body>
<h2>CDiagramEntityContainer</h2><h3>Overview</h3>
<blockquote>
<b>Purpose</b><br>
<code>CDiagramEntityContainer</code> contains the data for a <code>CDiagramEditor</code>. It manages mass operations such as copying, pasting and undo. It is completely separated from <code>CDiagramEditor</code> to allow the package to be used in a doc/view app. This is also the reason why some functionality is accessible in both this class and �n <code>CDiagramEditor</code>.<br>
<p><b>Description</b><br>
The class contains a <code>CObArray</code> with the instances of <code>CDiagramEntity</code>-derived classes that is the current data for an editor. It also contains a pointer to a <code>CDiagramClipboardHandler</code>-instance that works as the 'clipboard' for an editor. Furthermore, It contains an <code>CObArray</code> of <code>CObArray</code>s that is the undo stack. The Undo-functionality is implemented as a simple FILO-stack of <code>CObArray</code> pointers. Before any change that should be undoable, <code>Snapshot</code> is called to add new entries to the Undo-stack. This is normally managed by the editor, and need only be done manually for added functionality. Note that the <code>CDiagramEntityContainer</code> should normally not call <code>Snapshot</code> itself - in the case of, for example, additions to <code>m_objs</code>, the container can not and should not know if it is an undoable operation.<br>
<p><b>Usage</b><br>
Normally, this class need not be derived from. A <code>CDiagramEditor</code> needs an instance of <code>CDiagramEntityContainer</code> to hold the object data. This instance can either be external, as for a doc/view app where the container belongs to the document, or internal, as for a dialog application where the editor will manage all of the data. In the first case, a <code>CDiagramEntityContainer</code> member should be declared in the document class, and a pointer to it submitted to the <code>Create</code>-call of the <code>CDiagramEditor</code> (or by calling <code>CDiagramEditor::SetCDiagramEntityContainer</code>). In the second case, nothing special need to be done - the <code>CDiagramEntityContainer</code> will be created during the <code>CDiagramEditor::Create</code> call automatically if no pointer is submitted. The container is not using the Windows clipboard (because of instantiation questions on derived entities), but rather an external clipboard handler derived from <code>CDiagramClipboardHandler</code>. This handler is set calling <code>SetClipboardHandler</code>, and several containers can share the same handler. If no clipboard handler is set, a default internal one will be used. <code>CDiagramEntityContainer</code> manages all data internally, all internal objects are deleted in the class <code>dtor</code>.
<p><a class='top' href='index.html'>[back to the index page]</a>
</blockquote>
<a name='contents'></a><h3>Contents</h3>
<b>- A -</b><br>
<a href='#AddCDiagramEntityobj'>Add( CDiagramEntity* obj )</a><br>
<p>
<b>- B -</b><br>
<a href='#BottomCDiagramEntityobj'>Bottom( CDiagramEntity* obj )</a><br>
<p>
<b>- C -</b><br>
<a href='#CDiagramEntityContainerCDiagramClipboardHandlerclip'>CDiagramEntityContainer( CDiagramClipboardHandler* clip )</a><br>
<a href='#Clear'>Clear()</a><br>
<a href='#ClearPaste'>ClearPaste()</a><br>
<a href='#ClearUndo'>ClearUndo()</a><br>
<a href='#CopyCDiagramEntityobj'>Copy( CDiagramEntity* obj )</a><br>
<a href='#CopyAllSelected'>CopyAllSelected()</a><br>
<a href='#CutCDiagramEntityobj'>Cut( CDiagramEntity* obj )</a><br>
<p>
<b>- D -</b><br>
<a href='#DownCDiagramEntityobj'>Down( CDiagramEntity* obj )</a><br>
<a href='#DuplicateCDiagramEntityobj'>Duplicate( CDiagramEntity* obj )</a><br>
<p>
<b>- E -</b><br>
<a href='#ExportCStringArraystraUINTformatconst'>Export( CStringArray& stra, UINT format ) const</a><br>
<p>
<b>- F -</b><br>
<a href='#FindCDiagramEntitytestobj'>Find( CDiagramEntity* testobj )</a><br>
<a href='#FromStringconstCStringstr'>FromString( const CString& str )</a><br>
<a href='#FrontCDiagramEntityobj'>Front( CDiagramEntity* obj )</a><br>
<p>
<b>- G -</b><br>
<a href='#GetAtintindexconst'>GetAt( int index ) const</a><br>
<a href='#GetClipboardHandler'>GetClipboardHandler()</a><br>
<a href='#GetData'>GetData()</a><br>
<a href='#GetPaste'>GetPaste()</a><br>
<a href='#GetSelectCountconst'>GetSelectCount() const</a><br>
<a href='#GetSizeconst'>GetSize() const</a><br>
<a href='#GetStartPoint'>GetStartPoint()</a><br>
<a href='#GetStringconst'>GetString() const</a><br>
<a href='#GetTotalSize'>GetTotalSize()</a><br>
<a href='#GetUndo'>GetUndo()</a><br>
<a href='#GetUndoStackSizeconst'>GetUndoStackSize() const</a><br>
<a href='#GetVirtualSizeconst'>GetVirtualSize() const</a><br>
<a href='#Group'>Group()</a><br>
<p>
<b>- I -</b><br>
<a href='#IsModifiedconst'>IsModified() const</a><br>
<a href='#IsUndoPossible'>IsUndoPossible()</a><br>
<p>
<b>- O -</b><br>
<a href='#ObjectsInPaste'>ObjectsInPaste()</a><br>
<p>
<b>- P -</b><br>
<a href='#Paste'>Paste()</a><br>
<p>
<b>- R -</b><br>
<a href='#RemoveCDiagramEntityobj'>Remove( CDiagramEntity* obj )</a><br>
<a href='#RemoveAll'>RemoveAll()</a><br>
<a href='#RemoveAllSelected'>RemoveAllSelected()</a><br>
<a href='#RemoveAtintindex'>RemoveAt( int index )</a><br>
<p>
<b>- S -</b><br>
<a href='#SendMessageToObjectsintcommandBOOLselectedCDiagramEntitysenderCWndfrom'>SendMessageToObjects( int command, BOOL selected, CDiagramEntity* sender, CWnd* from )</a><br>
<a href='#SetAtintindexCDiagramEntityobj'>SetAt( int index, CDiagramEntity* obj )</a><br>
<a href='#SetClipboardHandlerCDiagramClipboardHandlerclip'>SetClipboardHandler( CDiagramClipboardHandler* clip )</a><br>
<a href='#SetModifiedBOOLdirty'>SetModified( BOOL dirty )</a><br>
<a href='#SetUndoStackSizeintmaxstacksize'>SetUndoStackSize( int maxstacksize )</a><br>
<a href='#SetVirtualSizeCSizesize'>SetVirtualSize( CSize size )</a><br>
<a href='#Snapshot'>Snapshot()</a><br>
<a href='#Swapintindex1intindex2'>Swap( int index1, int index2 )</a><br>
<p>
<b>- U -</b><br>
<a href='#Undo'>Undo()</a><br>
<a href='#Ungroup'>Ungroup()</a><br>
<a href='#UpCDiagramEntityobj'>Up( CDiagramEntity* obj )</a><br>
<p>
<b>- ~ -</b><br>
<a href='#~CDiagramEntityContainer'>~CDiagramEntityContainer()</a><br>
<p><h3>Functions</h3><hr>
<code><b><a name='AddCDiagramEntityobj'></a>void Add( CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Add an object to the data.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* obj </code> -  The object to add.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to add a new object to the container.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='BottomCDiagramEntityobj'></a>void Bottom( CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Moves <code>obj</code> to the bottom of the z-order.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* obj </code> -  The object to move.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to move <code>obj</code> in the z-order.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='CDiagramEntityContainerCDiagramClipboardHandlerclip'></a>CDiagramEntityContainer( CDiagramClipboardHandler* clip )</b></code>
<blockquote>
<b>Description</b><br>
Constructor
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
-<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='Clear'></a>void Clear()</b></code>
<blockquote>
<b>Description</b><br>
Removes all data from the data and undo.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to remove data from the container. The Paste-array will be kept.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='ClearPaste'></a>void ClearPaste()</b></code>
<blockquote>
<b>Description</b><br>
Clears the paste-array.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to clear the clipboard. All memory is released.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='ClearUndo'></a>void ClearUndo()</b></code>
<blockquote>
<b>Description</b><br>
Remove all undo arrays from the undo stack
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to clear the undo-stack. All memory will be deleted.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='CopyCDiagramEntityobj'></a>void Copy( CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Copies the object to the 'clipboard'.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* obj </code> -  The object to copy.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call in response to a Copy-command. Note that obj will only be copied to the clipboard, not the screen. See also the functions for copy/paste below.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='CopyAllSelected'></a>void CopyAllSelected()</b></code>
<blockquote>
<b>Description</b><br>
Clones all selected object to the paste array.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to copy all selected objects to the clipboard. <code>Paste</code> will put them on screen.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='CutCDiagramEntityobj'></a>void Cut( CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Cuts out the object and puts it into the 'clipboard'
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* obj </code> -  The object to cut.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call in response to a Cut-command. See also the functions for copy/paste below.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='DownCDiagramEntityobj'></a>void Down( CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Moves the object one step down in the z- order.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* obj </code> -  The object to move.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to move <code>obj</code> in the z-order.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='DuplicateCDiagramEntityobj'></a>void Duplicate( CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Duplicates the object and adds the new one 10 pixels offset down and right.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* obj </code> -  The object to duplicate.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to create a copy of the selected element.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='ExportCStringArraystraUINTformatconst'></a>void Export( CStringArray& stra, UINT format ) const</b></code>
<blockquote>
<b>Description</b><br>
Exports all objects to format format.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CStringArray& stra </code> -  <code>CStingArray</code> that will be filled with data on return.<br><code>UINT format   </code> -  Format to save to.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to export the contents of the container to a <code>CStringArray</code>. <code>Export</code> will - of course - have to be defined for the derived objects.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='FindCDiagramEntitytestobj'></a>int Find( CDiagramEntity* testobj )</b></code>
<blockquote>
<b>Description</b><br>
Finds the index of object <code>testobj</code> in the data array.
<br><b>Access</b><br>
Protected
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* testobj </code> -  Object to find.<br>
<b>Returns</b><br>
<code>int      </code> -  Index of the object or -1 if not found.
<br><br><b>Usage</b><br>
Internal function.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='FromStringconstCStringstr'></a>BOOL FromString( const CString& str )</b></code>
<blockquote>
<b>Description</b><br>
Sets the virtual paper size from a string.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>const CString& str </code> -  The string representation.<br>
<b>Returns</b><br>
<code>BOOL    </code> -  <code>TRUE</code> if the string represented a paper.
<br><br><b>Usage</b><br>
Call to set the paper size of the container from a string. The format is <code>paper:x,y;</code> where <code>x</code> and <code>y</code> are the horisontal and vertical sizes.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='FrontCDiagramEntityobj'></a>void Front( CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Moves <code>obj</code> to the top of the z-order.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* obj </code> -  The object to move.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to move <code>obj</code> in the z-order.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetAtintindexconst'></a>CDiagramEntity* GetAt( int index ) const</b></code>
<blockquote>
<b>Description</b><br>
Gets the object at position <code>index</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int index  </code> -  The index to get data from<br>
<b>Returns</b><br>
<code>CDiagramEntity* </code> -  The object or <code>NULL</code> if out of range.
<br><br><b>Usage</b><br>
Call to get a specific object from the container.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetClipboardHandler'></a>CDiagramClipboardHandler* GetClipboardHandler()</b></code>
<blockquote>
<b>Description</b><br>
Returns a pointer to the current clipboard handler.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CDiagramClipboardHandler* </code> -  Current handler.
<br><br><b>Usage</b><br>
Call to get a pointer to the current handler.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetData'></a>CObArray* GetData()</b></code>
<blockquote>
<b>Description</b><br>
Accessor for the internal data array
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CObArray* </code> -  A pointer to the internal data array.
<br><br><b>Usage</b><br>
Call to access the internal data array. To be used in derived classes.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetPaste'></a>CObArray* GetPaste()</b></code>
<blockquote>
<b>Description</b><br>
Accessor for the internal paste array
<br><b>Access</b><br>
Protected
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CObArray* </code> -  A pointer to the paste array
<br><br><b>Usage</b><br>
Call to access the internal paste array. To be used in derived classes.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetSelectCountconst'></a>int GetSelectCount() const</b></code>
<blockquote>
<b>Description</b><br>
Gets the number of currently selected objects in the container.
<br><b>Access</b><br>

<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>int  </code> -  Currently selected objects.
<br><br><b>Usage</b><br>
Call to get the number of selected objects.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetSizeconst'></a>int GetSize() const</b></code>
<blockquote>
<b>Description</b><br>
Returns the number of objects in the data container.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>int  </code> -  The number of objects.
<br><br><b>Usage</b><br>
Call to get the number of objects currently in the data array of the container.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetStartPoint'></a>CPoint GetStartPoint()</b></code>
<blockquote>
<b>Description</b><br>
Gets the starting screen position of the objects in the container (normally the top-left corner of the top-left object).
<br><b>Access</b><br>

<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CPoint </code> -  Top-left position of the objects.
<br><br><b>Usage</b><br>
Call to get the starting point on screen of the objects.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetStringconst'></a>CString GetString() const</b></code>
<blockquote>
<b>Description</b><br>
Returns a string representation of the virtual paper size
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CString </code> -  Resulting string
<br><br><b>Usage</b><br>
Call to get a string representing the paper size of the container. The format is <code>paper:x,y;</code> where <code>x</code> and <code>y</code> are the horisontal and vertical sizes.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetTotalSize'></a>CSize GetTotalSize()</b></code>
<blockquote>
<b>Description</b><br>
Gets the minimum bounding size for the objects in the container.
<br><b>Access</b><br>

<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CSize </code> -  Minimum bounding size
<br><br><b>Usage</b><br>
Call to get the screen size of the objects in the container.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetUndo'></a>CObArray* GetUndo()</b></code>
<blockquote>
<b>Description</b><br>
Accessor for the internal undo array
<br><b>Access</b><br>
Protected
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CObArray* </code> -  A pointer to the undo array
<br><br><b>Usage</b><br>
Call to access the internal undo array. To be used in derived classes.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetUndoStackSizeconst'></a>int GetUndoStackSize() const</b></code>
<blockquote>
<b>Description</b><br>
Returns the size of the undo-stack
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>int </code> -  Current size
<br><br><b>Usage</b><br>
Call to get the max undo stack size.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetVirtualSizeconst'></a>CSize GetVirtualSize() const</b></code>
<blockquote>
<b>Description</b><br>
Gets the virtual paper size.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CSize </code> -  The current size
<br><br><b>Usage</b><br>
Call to get the current paper size.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='Group'></a>void Group()</b></code>
<blockquote>
<b>Description</b><br>
Groups the currently selected objects into the same group.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to group all selected items into the same group. Grouped objects can be moved as a single entity. Technically, when one object in a group is selected, all other objects are also selected automatically.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='IsModifiedconst'></a>BOOL IsModified() const</b></code>
<blockquote>
<b>Description</b><br>
Returns the state of the modified-flag.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>BOOL </code> -  <code>TRUE</code> if data is changed
<br><br><b>Usage</b><br>
Call to see if data is modified.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='IsUndoPossible'></a>BOOL IsUndoPossible()</b></code>
<blockquote>
<b>Description</b><br>
Check if it is possible to undo.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>BOOL </code> -  <code>TRUE</code> if undo is possible.
<br><br><b>Usage</b><br>
Use this call for command enabling<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='ObjectsInPaste'></a>int ObjectsInPaste()</b></code>
<blockquote>
<b>Description</b><br>
Returns the number of objects in the paste array.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>int  </code> -  The number of objects.
<br><br><b>Usage</b><br>
Call to get the number of objects in the clipboard.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='Paste'></a>void Paste()</b></code>
<blockquote>
<b>Description</b><br>
Clones the contents of the paste array into the container data array.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to paste the contents of the clipboard to screen.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='RemoveCDiagramEntityobj'></a>void Remove( CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Removes the object.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* obj </code> -  The object to remove.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to remove <code>obj</code> - if it exists - from the container. Allocated memory is released.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='RemoveAll'></a>void RemoveAll()</b></code>
<blockquote>
<b>Description</b><br>
Removes all data objects
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to remove all data objects in the container. Undo- and paste arrays are not emptied. Allocated memory is released. Undo and paste not deleted.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='RemoveAllSelected'></a>void RemoveAllSelected()</b></code>
<blockquote>
<b>Description</b><br>
Removes all selected objects
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to remove all selected objects from the container. Releases allocated data<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='RemoveAtintindex'></a>void RemoveAt( int index )</b></code>
<blockquote>
<b>Description</b><br>
Removes the object at index.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int index </code> -  The index of the object to remove.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to remove a specific object. Memory is freed.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SendMessageToObjectsintcommandBOOLselectedCDiagramEntitysenderCWndfrom'></a>void SendMessageToObjects( int command, BOOL selected, CDiagramEntity* sender, CWnd* from )</b></code>
<blockquote>
<b>Description</b><br>
Sends <code>command</code> to objects.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int command    </code> -  The command to send.<br><code>BOOL selected   </code> -  If <code>TRUE</code>, the command will only be sent to selected objects, otherwise, it will be sent to all objects.<br><code>CDiagramEntity* sender </code> -  Original sender or <code>NULL</code> if not an object.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call this member to send messages to (selected) objects in the range <code>CMD_START</code> to <code>CMD_END</code> inclusively (defined in DiagramEntity.h). Calls the object <code>DoCommand</code>.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetAtintindexCDiagramEntityobj'></a>void SetAt( int index, CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Sets an object at position <code>index</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int index   </code> -  Index to set data at.<br><code>CDiagramEntity* obj </code> -  Object to set.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Internal function. Used by <code>Swap</code>.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetClipboardHandlerCDiagramClipboardHandlerclip'></a>void SetClipboardHandler( CDiagramClipboardHandler* clip )</b></code>
<blockquote>
<b>Description</b><br>
Sets the container clipboard class.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramClipboardHandler* clip </code> -  A pointer to the class<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to set the clipboard handler for this container. The same clipboard handler instance can be used for several containers to allow several editors (in an MDI- application) to share the same clipboard.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetModifiedBOOLdirty'></a>void SetModified( BOOL dirty )</b></code>
<blockquote>
<b>Description</b><br>
Sets the state of the modified flag
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>BOOL dirty </code> -  <code>TRUE</code> if data is changed.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to mark the data as modified.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetUndoStackSizeintmaxstacksize'></a>void SetUndoStackSize( int maxstacksize )</b></code>
<blockquote>
<b>Description</b><br>
Sets the size of the undo stack.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int maxstacksize </code> -  New size. -1 means no limit, 0 no undo.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to set the max undo stack size.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetVirtualSizeCSizesize'></a>void SetVirtualSize( CSize size )</b></code>
<blockquote>
<b>Description</b><br>
Sets the current virtual paper size.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CSize size </code> -  The size to set<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to set the paper size. Note that <code>SetModified( TRUE )</code> might have to be called as well.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='Snapshot'></a>void Snapshot()</b></code>
<blockquote>
<b>Description</b><br>
Copies the current state of the data to the undo-stack.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to add the current state to the undo-stack. If the undo stack has a maximum size and the stack will grow above the stack limit, the first undo array will be removed.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='Swapintindex1intindex2'></a>void Swap( int index1, int index2 )</b></code>
<blockquote>
<b>Description</b><br>
Swaps the elements at <code>index1</code> and <code>index2</code>.
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
<code>int index1 </code> -  First object to swap<br><code>int index2 </code> -  Second object to swap<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Internal function. Used to move objects up or down in the z-order.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='Undo'></a>void Undo()</b></code>
<blockquote>
<b>Description</b><br>
Sets the container data to the last entry in the undo stack.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to undo the last operation<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='Ungroup'></a>void Ungroup()</b></code>
<blockquote>
<b>Description</b><br>
Ungroups the currently selected objects.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to ungroup all selected items. Grouped objects can be moved as a single entity. Technically, when one object in a group is selected, all other objects are also selected automatically.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='UpCDiagramEntityobj'></a>void Up( CDiagramEntity* obj )</b></code>
<blockquote>
<b>Description</b><br>
Moves the object one step up in the z- order.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDiagramEntity* obj </code> -  The object to move.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to move <code>obj</code> in the z-order.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='~CDiagramEntityContainer'></a>~CDiagramEntityContainer()</b></code>
<blockquote>
<b>Description</b><br>
Destructor
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
-<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<b><small>Copyright 2004 Johan Rosengren Abstrakt Mekanik AB</small></b>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Software Developer (Senior) Abstrakt Mekanik AB
Sweden Sweden
45 years old, married, three kids.

Started with computers more than 20 years ago on a CBM-64.

Read Theoretical Philosophy at the University of Lund.

Working as a C++ consultant developer.

Science-fiction freak. Enjoy vintage punkrock.

Comments and Discussions