114 lines
2.6 KiB
C++
114 lines
2.6 KiB
C++
// GridDocument.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "resource.h"
|
|
#include "GridDocument.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
static const TCHAR *sMsgPrompt[]={
|
|
#include "GridDocument.hpp"
|
|
};
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGridDocument
|
|
|
|
IMPLEMENT_DYNCREATE(CGridDocument, CDocument)
|
|
|
|
CGridDocument::CGridDocument()
|
|
{
|
|
}
|
|
|
|
BOOL CGridDocument::OnNewDocument()
|
|
{
|
|
if (!CDocument::OnNewDocument())
|
|
return FALSE;
|
|
return TRUE;
|
|
}
|
|
|
|
CGridDocument::~CGridDocument()
|
|
{
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CGridDocument, CDocument)
|
|
//{{AFX_MSG_MAP(CGridDocument)
|
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGridDocument diagnostics
|
|
|
|
#ifdef _DEBUG
|
|
void CGridDocument::AssertValid() const
|
|
{
|
|
CDocument::AssertValid();
|
|
}
|
|
|
|
void CGridDocument::Dump(CDumpContext& dc) const
|
|
{
|
|
CDocument::Dump(dc);
|
|
}
|
|
#endif //_DEBUG
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGridDocument serialization
|
|
|
|
void CGridDocument::Serialize(CArchive& ar)
|
|
{
|
|
if (ar.IsStoring())
|
|
{
|
|
// TODO: add storing code here
|
|
}
|
|
else
|
|
{
|
|
// TODO: add loading code here
|
|
}
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGridDocument commands
|
|
|
|
BOOL CGridDocument::OnOpenDocument(LPCTSTR lpszPathName)
|
|
{
|
|
//if (!CDocument::OnOpenDocument(lpszPathName))
|
|
// return FALSE;
|
|
|
|
// TODO: Add your specialized creation code here
|
|
SetPathName(lpszPathName, FALSE);
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CGridDocument::GetDbfTableKey(XString &sTableKey)
|
|
{
|
|
TCHAR drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]=_T("");
|
|
_tsplitpath(GetPathName(), drive, dir, fname, ext);
|
|
if (_tcsicmp(ext, _T(".sp"))==0) {
|
|
sTableKey=_T("space");
|
|
XString sTitle(256);
|
|
sTitle << fname << /*UMSG*/ _T("-房间数据");
|
|
SetTitle(sTitle);
|
|
} else if (_tcsicmp(ext, _T(".op"))==0) {
|
|
sTableKey=_T("opening");
|
|
XString sTitle(256);
|
|
sTitle << fname << /*UMSG*/ _T("-门窗表");
|
|
SetTitle(sTitle);
|
|
} else if (_tcsicmp(ext, _T(".flr"))==0) {
|
|
sTableKey=_T("floor");
|
|
XString sTitle(256);
|
|
sTitle << fname << /*UMSG*/ _T("-楼层数据");
|
|
SetTitle(sTitle);
|
|
} else if (_tcsicmp(ext, _T(".exb"))==0) {
|
|
sTableKey=_T("extblock");
|
|
XString sTitle(256);
|
|
sTitle << fname << /*UMSG*/ _T("-扩展图块");
|
|
SetTitle(sTitle);
|
|
} else return FALSE;
|
|
return TRUE;
|
|
} |