-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path6502Doc.cpp
More file actions
151 lines (114 loc) · 3.39 KB
/
6502Doc.cpp
File metadata and controls
151 lines (114 loc) · 3.39 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*-----------------------------------------------------------------------------
6502 Macroassembler and Simulator
Copyright (C) 1995-2003 Michal Kowalski
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-----------------------------------------------------------------------------*/
// 6502Doc.cpp : implementation of the CSrc6502Doc class
//
#include "stdafx.h"
//#include "6502.h"
#include "6502Doc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSrc6502Doc
IMPLEMENT_DYNCREATE(CSrc6502Doc, CDocument)
BEGIN_MESSAGE_MAP(CSrc6502Doc, CDocument)
//{{AFX_MSG_MAP(CSrc6502Doc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSrc6502Doc construction/destruction
CSrc6502Doc::CSrc6502Doc()
{
m_TextBuffer.m_pOwnerDoc = this;
}
CSrc6502Doc::~CSrc6502Doc()
{
#ifdef USE_CRYSTAL_EDIT
// m_TextBuffer.FreeAll();
#endif
}
BOOL CSrc6502Doc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
#ifdef USE_CRYSTAL_EDIT
m_TextBuffer.InitNew();
#endif
static UINT no= 1;
CString name;
name.Format(_T("NewFile %u"),no++);
SetPathName(name,false);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CSrc6502Doc serialization
void CSrc6502Doc::Serialize(CArchive& ar)
{
#ifdef USE_CRYSTAL_EDIT
//no-op
#else
// CEditView contains an edit control which handles all serialization
((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);
#endif
}
/////////////////////////////////////////////////////////////////////////////
// CSrc6502Doc diagnostics
#ifdef _DEBUG
void CSrc6502Doc::AssertValid() const
{
CDocument::AssertValid();
}
void CSrc6502Doc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
#ifdef USE_CRYSTAL_EDIT
void CSrc6502Doc::DeleteContents()
{
CDocument::DeleteContents();
m_TextBuffer.FreeAll();
}
BOOL CSrc6502Doc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
return m_TextBuffer.LoadFromFile(lpszPathName);
}
BOOL CSrc6502Doc::OnSaveDocument(LPCTSTR lpszPathName)
{
m_TextBuffer.SaveToFile(lpszPathName);
return true;
}
#else
void CSrc6502Doc::DeleteContents()
{
CDocument::DeleteContents();
}
BOOL CSrc6502Doc::OnOpenDocument(LPCTSTR lpszPathName)
{
return CDocument::OnOpenDocument(lpszPathName);
}
BOOL CSrc6502Doc::OnSaveDocument(LPCTSTR lpszPathName)
{
return CDocument::OnSaveDocument(lpszPathName);
}
#endif