]> icculus.org git repositories - taylor/freespace2.git/blob - src/helped/helpeddoc.cpp
fix compiling issues with lang changes
[taylor/freespace2.git] / src / helped / helpeddoc.cpp
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
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
6  * the source.
7  */
8
9 // HelpEdDoc.cpp : implementation of the CHelpEdDoc class
10 //
11
12 #include "stdafx.h"
13 #include "helped.h"
14
15 #include "helpeddoc.h"
16
17 #ifdef _DEBUG
18 #define new DEBUG_NEW
19 #undef THIS_FILE
20 static char THIS_FILE[] = __FILE__;
21 #endif
22
23 /////////////////////////////////////////////////////////////////////////////
24 // CHelpEdDoc
25
26 IMPLEMENT_DYNCREATE(CHelpEdDoc, CDocument)
27
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!
32         //}}AFX_MSG_MAP
33 END_MESSAGE_MAP()
34
35 /////////////////////////////////////////////////////////////////////////////
36 // CHelpEdDoc construction/destruction
37
38 CHelpEdDoc::CHelpEdDoc()
39 {
40         // TODO: add one-time construction code here
41
42 }
43
44 CHelpEdDoc::~CHelpEdDoc()
45 {
46 }
47
48 BOOL CHelpEdDoc::OnNewDocument()
49 {
50         if (!CDocument::OnNewDocument())
51                 return FALSE;
52
53         // TODO: add reinitialization code here
54         // (SDI documents will reuse this document)
55
56         return TRUE;
57 }
58
59
60
61 /////////////////////////////////////////////////////////////////////////////
62 // CHelpEdDoc serialization
63
64 void CHelpEdDoc::Serialize(CArchive& ar)
65 {
66         if (ar.IsStoring())
67         {
68                 // TODO: add storing code here
69         }
70         else
71         {
72                 // TODO: add loading code here
73         }
74 }
75
76 /////////////////////////////////////////////////////////////////////////////
77 // CHelpEdDoc diagnostics
78
79 #ifdef _DEBUG
80 void CHelpEdDoc::AssertValid() const
81 {
82         CDocument::AssertValid();
83 }
84
85 void CHelpEdDoc::Dump(CDumpContext& dc) const
86 {
87         CDocument::Dump(dc);
88 }
89 #endif //_DEBUG
90
91 /////////////////////////////////////////////////////////////////////////////
92 // CHelpEdDoc commands
93
94 HelpEdLine * CHelpEdDoc::AddLine(CPoint pointFrom, CPoint pointTo)
95 {
96         // create a new line
97         HelpEdLine *newline = new HelpEdLine(pointFrom, pointTo);
98         try {
99                 // add this line to object array
100                 line_array.Add(newline);
101                 // mark document dirty
102                 SetModifiedFlag();
103         }
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
109                 if (newline) {
110                         delete newline;
111                         newline = NULL;
112                 }
113                 // delete the error message
114                 addlineerror->Delete();
115         }
116         return newline;
117 }
118
119 int CHelpEdDoc::get_line_count()
120 {
121         // return line_array size
122         return line_array.GetSize();
123 }
124