⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bufferdlg.cpp

📁 mapx嵌入式插件
💻 CPP
字号:
// BufferDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "BufferDlg.h"
#include "MapX.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


// TODO: This should really be some sort of
// translatable table, but since we don't translate
// the idl file now anyway, this will have to do
struct unit
{
	long m_nUnit;
	TCHAR *m_szDescription;
};

#define MAX_UNITS 17
static struct unit unitlist[MAX_UNITS] = 
{
	miUnitMile , _T("Mile"),
	miUnitKilometer, _T("Kilometer"),
	miUnitInch, _T("Inch"),
	miUnitFoot, _T("Foot"),
	miUnitYard, _T("Yard"),
	miUnitMillimeter, _T("Millimeter"),
	miUnitCentimeter, _T("Centimeter"),
	miUnitMeter, _T("Meter"),
	miUnitSurveyFoot, _T("SurveyFoot"),
	miUnitNauticalMile, _T("NauticalMile"),
	miUnitTwip, _T("Twip"),
	miUnitPoint, _T("Point"),
	miUnitPica,  _T("Pica"),
	miUnitDegree, _T("Degree"),
	miUnitLink, _T("Link"),
	miUnitChain, _T("Chain"),
	miUnitRod, _T("Rod")
};

/////////////////////////////////////////////////////////////////////////////
// CBufferDlg dialog


CBufferDlg::CBufferDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CBufferDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CBufferDlg)
	m_dDistance = 0.0;
	//}}AFX_DATA_INIT
	m_nType=0;
	m_nUnit=1;
}


void CBufferDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CBufferDlg)
	DDX_Control(pDX, IDC_UNIT, m_cmbUnit);
	DDX_Text(pDX, IDC_DISTANCE, m_dDistance);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CBufferDlg, CDialog)
	//{{AFX_MSG_MAP(CBufferDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBufferDlg message handlers

void CBufferDlg::OnOK() 
{

	if (!UpdateData(TRUE)) return;
	
	if (IsDlgButtonChecked(IDC_BUFFEREACH)) {
		m_nType=0;
	}
	else {
		m_nType=1;
	}

	int n = m_cmbUnit.GetCurSel();
	if (n != -1) {
		m_nUnit = m_cmbUnit.GetItemData(n);
	}

	CDialog::OnOK();
}

BOOL CBufferDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CheckDlgButton(IDC_BUFFEREACH, m_nType==0);
	CheckDlgButton(IDC_BUFFERALL, m_nType==1);

	int nSel=-1;

	for (int i=0; i<MAX_UNITS; i++) {
		int n = m_cmbUnit.AddString(unitlist[i].m_szDescription);
		if (n != -1) {
			m_cmbUnit.SetItemData(n, unitlist[i].m_nUnit);
			if (m_nUnit == unitlist[i].m_nUnit) {
				nSel = n;
			}
		}
	}
	m_cmbUnit.SetCurSel(nSel);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -