142 lines
3.0 KiB
C++
142 lines
3.0 KiB
C++
// ProtectRadiusDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "ProtectRadiusDlg.h"
|
|
#include "globalFunc.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CProtectRadiusDlg dialog
|
|
|
|
|
|
double CProtectRadiusDlg::m_dScale = 1.0;
|
|
CProtectRadiusDlg::CProtectRadiusDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CProtectRadiusDlg::IDD, pParent)
|
|
{
|
|
m_nShowType = 0;
|
|
m_bModify = false;
|
|
}
|
|
|
|
|
|
void CProtectRadiusDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CProtectRadiusDlg)
|
|
DDX_Radio(pDX, IDC_RADIO1, m_nShowType);
|
|
DDX_Text(pDX, IDC_EDIT_SCALE, m_dScale);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CProtectRadiusDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CProtectRadiusDlg)
|
|
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
|
|
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
|
|
ON_BN_CLICKED(IDC_RADIO_PT, OnRadio3)
|
|
ON_BN_CLICKED(IDC_RADIO_CHANGE, OnRadio4)
|
|
ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
|
|
ON_WM_CLOSE()
|
|
ON_EN_KILLFOCUS(IDC_EDIT_SCALE, OnKillfocusEditScale)
|
|
ON_MESSAGE(WM_ACAD_KEEPFOCUS, onAcadKeepFocus)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CProtectRadiusDlg message handlers
|
|
|
|
void CProtectRadiusDlg::OnKillfocusEditScale()
|
|
{
|
|
if (!UpdateData(TRUE))// 输入非数字时提示并返回
|
|
{
|
|
UpdateData(FALSE);
|
|
return;
|
|
}
|
|
CRect rect;
|
|
this->GetWindowRect(&rect);
|
|
CPoint pt;
|
|
::GetCursorPos(&pt);
|
|
if (!rect.PtInRect(pt))
|
|
{
|
|
GlobalFunc::PostCommand(_T(" "), false);
|
|
m_bModify = true;
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
}
|
|
|
|
void CProtectRadiusDlg::OnRadio1()
|
|
{
|
|
UpdateData(TRUE);
|
|
if (m_nShowType != 0)// 对话框激活时进入执行一次,不是radio消息,故返回
|
|
{
|
|
return;
|
|
}
|
|
m_bModify = true;
|
|
GlobalFunc::PostCommand(_T(" "), false);
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
void CProtectRadiusDlg::OnRadio2()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_bModify = true;
|
|
GlobalFunc::PostCommand(_T(" "), false);
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
void CProtectRadiusDlg::OnRadio3()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_bModify = true;
|
|
GlobalFunc::PostCommand(_T(" "), false);
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
void CProtectRadiusDlg::OnRadio4()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_bModify = true;
|
|
GlobalFunc::PostCommand(_T(" "), false);
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
void CProtectRadiusDlg::OnRadio5()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_bModify = true;
|
|
GlobalFunc::PostCommand(_T(" "), false);
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
void CProtectRadiusDlg::OnClose()
|
|
{
|
|
GlobalFunc::PostCommand(_T(" "), false);
|
|
CDialog::OnClose();
|
|
}
|
|
|
|
LONG_PTR CProtectRadiusDlg::onAcadKeepFocus(UINT_PTR, LONG_PTR)
|
|
{
|
|
POINT pt;
|
|
::GetCursorPos(&pt);
|
|
CRect rect;
|
|
GetWindowRect(&rect);
|
|
if (!(rect.PtInRect(pt)))
|
|
{
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CProtectRadiusDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
UpdateData(FALSE);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|