📄 selectpointdlg.cpp
字号:
// SelectPointDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "SelectPointDlg.h"
#include "GpsNavView.h"
#include "WptDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// SelectPointDlg dialog
SelectPointDlg::SelectPointDlg(int n,CWnd* pParent /*=NULL*/)
: CDialog(SelectPointDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(SelectPointDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
nFT=n;
POSITION po=AfxGetApp()->GetFirstDocTemplatePosition();
CDocTemplate *pDocTem=AfxGetApp()->GetNextDocTemplate(po);
po=pDocTem->GetFirstDocPosition();
pDoc=(CGpsNavDoc *)pDocTem->GetNextDoc(po);
}
void SelectPointDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SelectPointDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(SelectPointDlg, CDialog)
//{{AFX_MSG_MAP(SelectPointDlg)
ON_BN_CLICKED(IDC_WPTSET2, OnWptset2)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// SelectPointDlg message handlers
BOOL SelectPointDlg::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE;
}
void SelectPointDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
CListBox *pWptList=(CListBox *)GetDlgItem(IDC_LIST);
if(pWptList->GetCurSel()==LB_ERR)
{
CDialog::OnOK();
}
if(nFT==0)
{
pDoc->m_Way.SetFPoint(pWptList->GetCurSel());
}
else
{
pDoc->m_Way.SetTPoint(pWptList->GetCurSel());
}
CDialog::OnOK();
}
void SelectPointDlg::OnWptset2()
{
CWptDlg dlg;
dlg.DoModal();
SendMessage(WM_PAINT);
}
void SelectPointDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
if(nFT==0)
{
GetDlgItem(IDC_SELECT)->SetWindowText(_T("Select FromWaypoint"));
}
else
{
GetDlgItem(IDC_SELECT)->SetWindowText(_T("Select ToWaypoint"));
}
CListBox *pWptList=(CListBox *)GetDlgItem(IDC_LIST);
CArray<CWayPoint,CWayPoint> &wps=pDoc->m_Way.GetWpts();
int num=pDoc->m_Way.GetWptNum();
CString str="";
unsigned short lpStr[20];
if(num>0)
{
pWptList->ResetContent();
for(int i=0;i<num;i++)
{
wps[i].GetPointName(lpStr);
str.Format(_T("%d.%s"),i+1,lpStr);
pWptList->AddString(str);
}
}
if(nFT==0)
{
pWptList->SetCurSel(pDoc->m_Way.GetFPoint());
}
else
{
pWptList->SetCurSel(pDoc->m_Way.GetTPoint());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -