blob: b7c42b9444139acbb742a1b2842656e25ceeb4f3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#include "stdafx.h"
CFreeDoc::CFreeDoc()
{
m_strTitle = "";
m_strPathName = "";
m_bModified = 0;
m_bCreated = 0;
}
CFreeDoc::~CFreeDoc()
{
if (m_bCreated) OnDestroy();
m_bCreated = 0;
m_bModified = 0;
m_strPathName = "";
m_strTitle = "";
}
BOOL CFreeDoc::Create(void)
{
BOOL createresult;
m_bModified = 0;
m_bCreated = 0;
m_strTitle = "";
m_strPathName = "";
createresult = OnCreate();
m_bCreated = 1;
return(createresult);
}
BOOL CFreeDoc::IsModified(void) const
{
return(m_bModified);
}
void CFreeDoc::SetModifiedFlag(const BOOL modified)
{
m_bModified = modified;
}
void CFreeDoc::SetTitle(const CString &string)
{
m_strTitle = string;
}
void CFreeDoc::SetPathName(const CString &string)
{
m_strPathName = string;
}
UINT CFreeDoc::GetViewCount(void) const
{
return(m_viewList.GetCount());
}
void CFreeDoc::AddView(CFreeView *view)
{
if (view != NULL) {
m_viewList.AddTail((void *)view);
OnChangedViewList(view, 1);
view->m_document = this;
}
}
void CFreeDoc::RemoveView(CFreeView *view)
{
if (view != NULL) {
POSITION pos = m_viewList.Find(view);
if (pos != NULL) {
m_viewList.RemoveAt(pos);
OnChangedViewList(view, 0);
}
view->m_document = NULL;
}
}
POSITION CFreeDoc::GetFirstViewPosition(void) const
{
return(m_viewList.GetHeadPosition());
}
CFreeView *CFreeDoc::GetNextView(POSITION &position) const
{
CFreeView *view = (CFreeView *)m_viewList.GetNext(position);
return(view);
}
void CFreeDoc::UpdateAllViews(void)
{
POSITION pos = m_viewList.GetHeadPosition();
CFreeView *view;
while (pos != NULL) {
view = (CFreeView *)m_viewList.GetNext(pos);
UpdateView(view);
}
}
void CFreeDoc::UpdateView(CFreeView *view)
{
view->OnUpdate(this);
}
void CFreeDoc::OnChangedViewList(CFreeView *view, BOOL added)
{
}
BOOL CFreeDoc::OnCreate(void)
{
return(TRUE);
}
void CFreeDoc::OnDestroy(void)
{
}
|