📄 deformadjdoc.cpp
字号:
// DeformAdjDoc.cpp : implementation of the CDeformAdjDoc class
//
#include "stdafx.h"
#include "DeformAdj.h"
#include "DeformAdjDoc.h"
#include "MainFrm.h"
//#include "global.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CString directory;
extern CString projname;
extern CString m_TouygEdit;
extern CString m_JiaEdit;
extern CString m_GuancgEdit;
extern CString m_FangxEdit;
extern CString m_ChicxEdit;
extern CString m_ChengEdit;
extern CString m_CejujEdit;
extern CString m_CejucEdit;
extern int IsSavedProject;
extern int m_projclose;
extern int m_projsave;
extern int m_projnew;
extern int m_projopen,m_projsetup;
extern int m_input;
/////////////////////////////////////////////////////////////////////////////
// CDeformAdjDoc
IMPLEMENT_DYNCREATE(CDeformAdjDoc, CDocument)
BEGIN_MESSAGE_MAP(CDeformAdjDoc, CDocument)
//{{AFX_MSG_MAP(CDeformAdjDoc)
ON_COMMAND(ID_FILE_SAVE, OnFileSave)
ON_COMMAND(ID_APP_EXIT, OnAppExit)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDeformAdjDoc construction/destruction
CDeformAdjDoc::CDeformAdjDoc()
{
// TODO: add one-time construction code here
}
CDeformAdjDoc::~CDeformAdjDoc()
{
}
BOOL CDeformAdjDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CDeformAdjDoc serialization
void CDeformAdjDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CDeformAdjDoc diagnostics
#ifdef _DEBUG
void CDeformAdjDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CDeformAdjDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDeformAdjDoc commands
void CDeformAdjDoc::OnFileSave() //保存工程;
{
// TODO: Add your command handler code here
CFile file;
BOOL IsOk = SetCurrentDirectory( directory );
CString filename;
filename = directory + projname ;
file.Open( filename , CFile::modeCreate | CFile::modeWrite );
CArchive ar ( &file , CArchive::store );
// ar << directory; //项目目录
ar << projname; //项目名称
// ar << IsSavedProject;
ar << m_TouygEdit;
ar << m_JiaEdit;
ar << m_GuancgEdit;
ar << m_FangxEdit;
ar << m_ChicxEdit;
ar << m_ChengEdit;
ar << m_CejujEdit;
ar << m_CejucEdit;
ar.Close();
file.Close();
AfxGetApp()->AddToRecentFileList(filename);
IsSavedProject=1;
}
void CDeformAdjDoc::OnAppExit()
{
// TODO: Add your command handler code here
CMainFrame* pmain;
pmain = (CMainFrame*)(AfxGetMainWnd( ));
pmain->SendMessage(WM_CLOSE);
}
void CDeformAdjDoc::OnFileOpen()
{
// TODO: Add your command handler code here
CString name,title;
int length=0;
int i=0;
static char BASED_CODE szFilter[] = "工程文件 (*.prj)|*.prj|所有文件 (*.*)|*.*||";
CFileDialog fileDlg(TRUE, NULL, NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, NULL );
if(fileDlg.DoModal()==IDOK)
{
name = fileDlg.GetPathName();
length = name.GetLength();
i = name.ReverseFind( '\\' );
directory = name.Left( i+1 );
projname = name.Right( length - i -1 );
title = projname.Left( length - i -5 );
CFile f;
if ( f.Open( name ,CFile::modeRead ) == false )
return;
CArchive ar ( &f , CArchive::load );
ar >> projname;
ar >> m_TouygEdit;
ar >> m_JiaEdit;
ar >> m_GuancgEdit;
ar >> m_FangxEdit;
ar >> m_ChicxEdit;
ar >> m_ChengEdit;
ar >> m_CejujEdit;
ar >> m_CejucEdit;
ar.Close();
f.Close();
AfxGetApp()->AddToRecentFileList(name);
((CFrameWnd*)AfxGetApp() -> m_pMainWnd ) -> SetWindowText( title+" - 变形观测数据处理包" );
m_projsetup=1;m_projopen=0;m_projclose=1;m_projsave=1;m_projnew=0;
m_input=1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -