161 lines
3.7 KiB
C++
161 lines
3.7 KiB
C++
// GridFrameWnd.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "resource.h"
|
|
#include "GridFrameWnd.h"
|
|
#include "GridView.h"
|
|
#include "GridFormView.h"
|
|
#include "GridDocument.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGridFrameWnd
|
|
|
|
IMPLEMENT_DYNCREATE(CGridFrameWnd, CMDIChildWnd)
|
|
|
|
|
|
|
|
|
|
|
|
CGridFrameWnd::CGridFrameWnd()
|
|
{
|
|
}
|
|
|
|
CGridFrameWnd::~CGridFrameWnd()
|
|
{
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CGridFrameWnd, CMDIChildWnd)
|
|
//{{AFX_MSG_MAP(CGridFrameWnd)
|
|
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CGridFrameWnd message handlers
|
|
|
|
#define SendAcadCommand acedPostCommand
|
|
|
|
void CGridFrameWnd::OnFileOpen()
|
|
{
|
|
// TODO: Add your command handler code here
|
|
SendAcadCommand(_T("OpenEx\n"));
|
|
}
|
|
|
|
|
|
|
|
static CMultiDocTemplate *g_pSpaceGridTemplate=NULL;
|
|
|
|
|
|
|
|
void ReleaseGridTemplate()
|
|
{
|
|
if (g_pSpaceGridTemplate) {
|
|
g_pSpaceGridTemplate->CloseAllDocuments(FALSE);
|
|
delete g_pSpaceGridTemplate;
|
|
g_pSpaceGridTemplate=NULL;
|
|
}
|
|
}
|
|
|
|
|
|
int GridFrame(const TCHAR *pExt)
|
|
{
|
|
XString sDocFile;
|
|
MakeFullPath(pExt, sDocFile);
|
|
|
|
if (!g_pSpaceGridTemplate)
|
|
{
|
|
CAcModuleResourceOverride vTemp;
|
|
|
|
// modify by xlc on 090902 消除tg5lib影响
|
|
//#if ADS<18
|
|
#if 0
|
|
g_pSpaceGridTemplate = new CMultiDocTemplate(
|
|
IDR_SPACEGRID,
|
|
RUNTIME_CLASS(CGridDocument), //pDoc->GetRuntimeClass(),
|
|
RUNTIME_CLASS(CGridFrameWnd), // custom MDI child frame
|
|
RUNTIME_CLASS(CGridFormView));
|
|
#else
|
|
AfxMessageBox(_T("此处有问题,GridFrame"));
|
|
return RTNORM;
|
|
#endif
|
|
|
|
g_pSpaceGridTemplate->OpenDocumentFile(sDocFile);
|
|
}
|
|
else
|
|
{
|
|
POSITION pos=g_pSpaceGridTemplate->GetFirstDocPosition();
|
|
while(pos!=NULL) {
|
|
CDocument *pDoc=g_pSpaceGridTemplate->GetNextDoc(pos);
|
|
if (!pDoc) break;
|
|
CString csPath=pDoc->GetPathName();
|
|
if (_tcsicmp(csPath, sDocFile)==0) {
|
|
pDoc->UpdateAllViews(NULL);
|
|
POSITION pos = pDoc->GetFirstViewPosition();
|
|
if (pos) {
|
|
CView* pView = pDoc->GetNextView(pos);
|
|
pView->GetParentFrame()->ActivateFrame();
|
|
}
|
|
return RTNORM;
|
|
}
|
|
}
|
|
CAcModuleResourceOverride vTemp;
|
|
g_pSpaceGridTemplate->OpenDocumentFile(sDocFile);
|
|
}
|
|
return RTNORM;
|
|
}
|
|
|
|
int DbfGridFrame(const TCHAR *pszFile)
|
|
{
|
|
XString sDocFile=pszFile;
|
|
if (!g_pSpaceGridTemplate)
|
|
{
|
|
CAcModuleResourceOverride vTemp;
|
|
|
|
// modify by xlc on 090902 消除tg5lib影响
|
|
// #if ADS<18
|
|
#if 0
|
|
g_pSpaceGridTemplate = new CMultiDocTemplate(
|
|
IDR_SPACEGRID,
|
|
RUNTIME_CLASS(CGridDocument), //pDoc->GetRuntimeClass(),
|
|
RUNTIME_CLASS(CGridFrameWnd), // custom MDI child frame
|
|
RUNTIME_CLASS(CGridFormView));
|
|
#else
|
|
AfxMessageBox(_T("此处有问题,DbfGridFrame"));
|
|
return RTNORM;
|
|
#endif
|
|
|
|
g_pSpaceGridTemplate->OpenDocumentFile(sDocFile);
|
|
}
|
|
else
|
|
{
|
|
POSITION pos=g_pSpaceGridTemplate->GetFirstDocPosition();
|
|
while(pos!=NULL) {
|
|
CDocument *pDoc=g_pSpaceGridTemplate->GetNextDoc(pos);
|
|
if (!pDoc) break;
|
|
CString csPath=pDoc->GetPathName();
|
|
if (_tcsicmp(csPath, sDocFile)==0) {
|
|
pDoc->UpdateAllViews(NULL);
|
|
POSITION pos = pDoc->GetFirstViewPosition();
|
|
if (pos) {
|
|
CView* pView = pDoc->GetNextView(pos);
|
|
pView->GetParentFrame()->ActivateFrame();
|
|
}
|
|
return RTNORM;
|
|
}
|
|
}
|
|
CAcModuleResourceOverride vTemp;
|
|
g_pSpaceGridTemplate->OpenDocumentFile(sDocFile);
|
|
}
|
|
return RTNORM;
|
|
}
|
|
|
|
|