2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
9 // HelpEdDoc.cpp : implementation of the CHelpEdDoc class
15 #include "helpeddoc.h"
20 static char THIS_FILE[] = __FILE__;
23 /////////////////////////////////////////////////////////////////////////////
26 IMPLEMENT_DYNCREATE(CHelpEdDoc, CDocument)
28 BEGIN_MESSAGE_MAP(CHelpEdDoc, CDocument)
29 //{{AFX_MSG_MAP(CHelpEdDoc)
30 // NOTE - the ClassWizard will add and remove mapping macros here.
31 // DO NOT EDIT what you see in these blocks of generated code!
35 /////////////////////////////////////////////////////////////////////////////
36 // CHelpEdDoc construction/destruction
38 CHelpEdDoc::CHelpEdDoc()
40 // TODO: add one-time construction code here
44 CHelpEdDoc::~CHelpEdDoc()
48 BOOL CHelpEdDoc::OnNewDocument()
50 if (!CDocument::OnNewDocument())
53 // TODO: add reinitialization code here
54 // (SDI documents will reuse this document)
61 /////////////////////////////////////////////////////////////////////////////
62 // CHelpEdDoc serialization
64 void CHelpEdDoc::Serialize(CArchive& ar)
68 // TODO: add storing code here
72 // TODO: add loading code here
76 /////////////////////////////////////////////////////////////////////////////
77 // CHelpEdDoc diagnostics
80 void CHelpEdDoc::AssertValid() const
82 CDocument::AssertValid();
85 void CHelpEdDoc::Dump(CDumpContext& dc) const
91 /////////////////////////////////////////////////////////////////////////////
92 // CHelpEdDoc commands
94 HelpEdLine * CHelpEdDoc::AddLine(CPoint pointFrom, CPoint pointTo)
97 HelpEdLine *newline = new HelpEdLine(pointFrom, pointTo);
99 // add this line to object array
100 line_array.Add(newline);
101 // mark document dirty
104 // check for memory exception
105 catch (CMemoryException* addlineerror) {
106 // display error message in pop box
107 AfxMessageBox("Out of memory", MB_ICONSTOP | MB_OK);
108 // if we created a HelpEdLine object, we should delete it
113 // delete the error message
114 addlineerror->Delete();
119 int CHelpEdDoc::get_line_count()
121 // return line_array size
122 return line_array.GetSize();