📄 setinsertionlayerdlg.cpp
字号:
// SetInsertionDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MapXMobileViewer.h"
#include "SetInsertionLayerDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetInsertionDlg dialog
CSetInsertionDlg::CSetInsertionDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSetInsertionDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetInsertionDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_nSelectedLayer=0;
m_pMap = NULL;
}
void CSetInsertionDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetInsertionDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetInsertionDlg, CDialog)
//{{AFX_MSG_MAP(CSetInsertionDlg)
ON_LBN_DBLCLK(IDC_LAYERS, OnDblclkLayers)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetInsertionDlg message handlers
void CSetInsertionDlg::OnDblclkLayers()
{
OnOK();
}
BOOL CSetInsertionDlg::OnInitDialog()
{
ASSERT(m_pMap);
if (!m_pMap) {
EndDialog(IDCANCEL);
return FALSE;
}
if (!m_strTitle.IsEmpty()) {
SetWindowText(m_strTitle);
}
TRY {
CListBox *pList = (CListBox *)GetDlgItem(IDC_LAYERS);
CMapXLayer lyrInsertion = m_pMap->GetLayers().GetInsertionLayer();
ASSERT(pList);
CString str;
str.LoadString(IDS_NOLAYERS);
pList->AddString(str);
str.Empty();
int n = m_pMap->GetLayers().GetCount();
for (int i=1; i<=n;i++) {
CMapXLayer lyr = m_pMap->GetLayers().Item(i);
if (lyrInsertion == lyr) {
m_nSelectedLayer=i;
}
str = lyr.GetName();
pList->AddString(str);
}
pList->SetCurSel(m_nSelectedLayer);
}
CATCH (COleDispatchException, e) {
//e->Delete();
}
AND_CATCH (COleException, e) {
//e->Delete();
}
END_CATCH
CDialog::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSetInsertionDlg::OnOK()
{
if (!UpdateData(TRUE)) {
return;
}
m_nSelectedLayer = max(0, ((CListBox *)GetDlgItem(IDC_LAYERS))->GetCurSel());
EndDialog(IDOK);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -