00001 
00002 
00003 
00004 
#include "stdafx.h"
00005 
#include "GUIEditor.h"
00006 
00007 
#include "GUIEditorDoc.h"
00008 
#include ".\guieditordoc.h"
00009 
00010 
#ifdef _DEBUG
00011 
#define new DEBUG_NEW
00012 
#endif
00013 
00014 
00015 
00016 
00017 IMPLEMENT_DYNCREATE(CGUIEditorDoc, CDocument)
00018 
00019 BEGIN_MESSAGE_MAP(CGUIEditorDoc, CDocument)
00020         ON_COMMAND(ID_FILE_SAVE_EX, OnFileSave)
00021 END_MESSAGE_MAP()
00022 
00023 
00024 
00025 
00026 CGUIEditorDoc::CGUIEditorDoc()
00027 {
00028         m_pGUI = NULL;  
00029 }
00030 
00031 CGUIEditorDoc::~CGUIEditorDoc()
00032 {
00033         
00034 }
00035 
00036 BOOL CGUIEditorDoc::OnNewDocument()
00037 {
00038         
if (!CDocument::OnNewDocument())
00039                 
return FALSE;
00040 
00041         
m_pGUI = 
new CGUI;
00042         
m_pGUI->
Create();
00043         
00044         
00045 
00046         
return TRUE;
00047 }
00048 
00049 
00050 BOOL CGUIEditorDoc::OnOpenDocument(LPCTSTR lpszPathName) 
00051 {
00052         
if(
m_pGUI == NULL)
00053         {
00054                 
m_pGUI = 
new CGUI;
00055                 
m_pGUI->
Create();
00056         }
00057         
else
00058                 
m_pGUI->
Destroy();
00059 
00060         
return m_pGUI->
LoadXML(NULL, lpszPathName);
00061 }
00062 
00063 
void CGUIEditorDoc::OnCloseDocument()
00064 {
00065         SAFEDEL(m_pGUI)
00066         CDocument::OnCloseDocument();
00067 }
00068 
00069 
00070 
00071 
00072 
void CGUIEditorDoc::Serialize(CArchive& ar)
00073 {
00074         
if (ar.IsStoring())
00075         {
00076                 
00077         }
00078         
else
00079         {
00080                 
00081         }
00082 }
00083 
00084 
00085 
00086 
00087 
#ifdef _DEBUG
00088 
void CGUIEditorDoc::AssertValid()
 const
00089 
{
00090         CDocument::AssertValid();
00091 }
00092 
00093 
void CGUIEditorDoc::Dump(CDumpContext& dc)
 const
00094 
{
00095         CDocument::Dump(dc);
00096 }
00097 
#endif //_DEBUG
00098 
00099 
00100 
00101 
00102 BOOL CGUIEditorDoc::OnSaveDocument(LPCTSTR lpszPathName)
00103 {
00104         
if(
m_pGUI !=NULL)
00105                 
return m_pGUI->
SaveXML(NULL, lpszPathName);
00106 }
00107 
00108 
void CGUIEditorDoc::OnFileSave()
00109 {
00110         
if(
m_pGUI !=NULL)
00111                 
m_pGUI->
SaveXML(NULL, this->GetPathName());
00112 }