📄 ryxgpsdoc.cpp
字号:
// RyxGpsDoc.cpp : implementation of the CRyxGpsDoc class
//
#include "stdafx.h"
#include "RyxGps.h"
#include "RyxGpsDoc.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRyxGpsDoc
IMPLEMENT_DYNCREATE(CRyxGpsDoc, CDocument)
BEGIN_MESSAGE_MAP(CRyxGpsDoc, CDocument)
//{{AFX_MSG_MAP(CRyxGpsDoc)
ON_COMMAND(ID_SV1, OnSv1)
ON_COMMAND(ID_SV2, OnSv2)
ON_UPDATE_COMMAND_UI(ID_SV2, OnUpdateSv2)
ON_UPDATE_COMMAND_UI(ID_SV1, OnUpdateSv1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRyxGpsDoc construction/destruction
CRyxGpsDoc::CRyxGpsDoc()
{
// TODO: add one-time construction code here
}
CRyxGpsDoc::~CRyxGpsDoc()
{
}
BOOL CRyxGpsDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
m_ReveiverID=1;
lstrcpy(m_buffer,"start here!");
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CRyxGpsDoc serialization
void CRyxGpsDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CRyxGpsDoc diagnostics
#ifdef _DEBUG
void CRyxGpsDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CRyxGpsDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRyxGpsDoc commands
int CRyxGpsDoc::GetWordPos(int order) //order is 0 based
{
BOOL bBlank=TRUE;
int i;
int iWordNum=0;
for(i=0;i<lstrlen(m_buffer);i++)
{
if(m_buffer[i]==' '||m_buffer[i]==0x0d||m_buffer[i]==0x0a)
{
bBlank=TRUE;
continue;
}
if(bBlank==TRUE&&!(m_buffer[i]==' '||m_buffer[i]==0x0d||m_buffer[i]==0x0a))
{
iWordNum++;
bBlank=FALSE;
}
if(iWordNum==order)
return i;
}
return -1;
}
void CRyxGpsDoc::GetSubWord(int order,char *pszSubWord) //order is 0 based
{
int iIndex=GetWordPos(order);
int i,j;
j=0;
for(i=iIndex,j=0;m_buffer[i]!=' '&&m_buffer[i]!=0x0d;i++)
{
pszSubWord[j]=m_buffer[i];
j++;
}
pszSubWord[j]='\0';
}
void CRyxGpsDoc::OnSv1()
{
// TODO: Add your command handler code here
m_ReveiverID=1;
CMainFrame *pFrame=(CMainFrame *)AfxGetMainWnd();
pFrame->m_wndStatusBar.SetPaneText(1," 当前的接收机: SV1");
}
void CRyxGpsDoc::OnSv2()
{
// TODO: Add your command handler code here
m_ReveiverID=2;
CMainFrame *pFrame=(CMainFrame *)AfxGetMainWnd();
pFrame->m_wndStatusBar.SetPaneText(1," 当前的接收机: SV2");
}
void CRyxGpsDoc::OnUpdateSv2(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetRadio(m_ReveiverID==2);
}
void CRyxGpsDoc::OnUpdateSv1(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetRadio(m_ReveiverID==1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -