📄 gps1view.cpp
字号:
// GPSView.cpp : implementation of the CGPSView class
//
#include "stdafx.h"
#include "GPS.h"
#include "GPSSet.h"
#include "GPSDoc.h"
#include "GPSView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGPSView
IMPLEMENT_DYNCREATE(CGPSView, CView)
BEGIN_MESSAGE_MAP(CGPSView, CView)
//{{AFX_MSG_MAP(CGPSView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGPSView construction/destruction
CGPSView::CGPSView()
: CRecordView(CGPSView::IDD)
{ //{{AFX_DATA_INIT(CGPSView)
m_pSet = NULL;
//}}AFX_DATA_INIT
// TODO: add construction code here
}
CGPSView::~CGPSView()
{
}
void CGPSView::DoDataExchange(CDataExchange* pDX)
{
CRecordView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGPSView)
DDX_Control(pDX, IDC_DBGRID1, m_dbGrid);
DDX_FieldText(pDX, IDC_MAGDEV, m_pSet->m_magDev, m_pSet);
DDX_FieldText(pDX, IDC_POSLAT, m_pSet->m_latitude, m_pSet);
DDX_FieldText(pDX, IDC_POSLONG, m_pSet->m_longitude, m_pSet);
DDX_FieldText(pDX, IDC_SPEED, m_pSet->m_speed, m_pSet);
DDX_FieldText(pDX, IDC_TRUECOURSE, m_pSet->m_trueCourse, m_pSet);
DDX_FieldDateTime(pDX, IDC_TIME,m_pSet->m_time,m_pSet);
DDX_FieldText(pDX, IDC_NID, m_pSet->m_ID, m_pSet);
DDX_Control(pDX, IDC_REMOTEDATACTL1, m_Rdc);
//}}AFX_DATA_MAP
}
BOOL CGPSView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
void CGPSView::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_GPSSet;
CRecordView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
}
/////////////////////////////////////////////////////////////////////////////
// CGPSView printing
BOOL CGPSView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CGPSView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CGPSView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CGPSView diagnostics
#ifdef _DEBUG
void CGPSView::AssertValid() const
{
CRecordView::AssertValid();
}
void CGPSView::Dump(CDumpContext& dc) const
{
CRecordView::Dump(dc);
}
CGPSDoc* CGPSView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGPSDoc)));
return (CGPSDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CGPSView database support
CRecordset* CGPSView::OnGetRecordset()
{
return m_pSet;
}
/////////////////////////////////////////////////////////////////////////////
// CGPSView message handlers
BOOL CGPSView::OnMove(UINT nIDMoveCommand)
{
// TODO: Add your specialized code here and/or call the base class
switch (nIDMoveCommand)
{
case ID_RECORD_PREV:
if (!m_pSet->IsBOF())
{
m_pSet->MovePrev();
}
break;
case ID_RECORD_FIRST:
m_pSet->MoveFirst();
break;
case ID_RECORD_NEXT:
if (!m_pSet->IsEOF())
m_pSet->MoveNext();
break;
if (!m_pSet->CanScroll())
{
// Clear out screen since we're sitting on EOF
m_pSet->SetFieldNull(NULL);
break;
}
case ID_RECORD_LAST:
m_pSet->MoveLast();
break;
default:
// unexpected case value
ASSERT(FALSE);
}
// show results of move operation
UpdateData(FALSE);
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -