142 lines
2.7 KiB
C++
142 lines
2.7 KiB
C++
#include "stdafx.h"
|
|
#include "BZWZDlg.h"
|
|
#include "PipelineTools.h"
|
|
|
|
IMPLEMENT_DYNAMIC(CBZWZDlg, CDialog)
|
|
|
|
CString CBZWZDlg::m_sTextStyle = _T("Pipe_Dim");
|
|
double CBZWZDlg::m_dTxtH = 3.0;
|
|
BOOL CBZWZDlg::m_bCustomR = FALSE;
|
|
double CBZWZDlg::m_dCustomR = 0;
|
|
|
|
CBZWZDlg::CBZWZDlg(bool bOption, CWnd *pParent)
|
|
: CDialog(CBZWZDlg::IDD, pParent), m_bOption(bOption)
|
|
{
|
|
m_sDimU = _T("");
|
|
m_sDimD = _T("");
|
|
m_dTxtH = 3.0;
|
|
m_sTextStyle = PipelineTools::gTextStyle_Pipe_Dim;
|
|
m_dCustomR = PipelineTools::getPScale() * m_dTxtH * 1.2;
|
|
|
|
GET_CACHE(CBZWZDlg
|
|
, %f%s%s%s%f%d
|
|
, &m_dTxtH
|
|
, &m_sDimU
|
|
, &m_sDimD
|
|
, &m_sTextStyle
|
|
, &m_dCustomR
|
|
, &m_bCustomR );
|
|
}
|
|
|
|
CBZWZDlg::~CBZWZDlg(void)
|
|
{
|
|
}
|
|
|
|
void CBZWZDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
DDX_Text(pDX, IDC_EDIT1, m_sDimU);
|
|
DDX_Text(pDX, IDC_EDIT2, m_sDimD);
|
|
DDX_Text(pDX, IDC_EDIT3, m_dTxtH);
|
|
DDX_Control(pDX, IDC_COMBO1, m_wndTextStyleCombo);
|
|
DDX_Check(pDX, IDC_CHK_CUSTOM_R, m_bCustomR);
|
|
DDX_Text(pDX, IDC_EDIT4, m_dCustomR);
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CBZWZDlg, CDialog)
|
|
ON_BN_CLICKED(IDOK, &CBZWZDlg::OnBnClickedOk)
|
|
ON_BN_CLICKED(IDC_CHK_CUSTOM_R, &CBZWZDlg::OnBnClickedChkCustomR)
|
|
END_MESSAGE_MAP()
|
|
|
|
void CBZWZDlg::SetDimText(CString& sDimU,CString& sDimD)
|
|
{
|
|
m_sDimU = sDimU;
|
|
m_sDimD = sDimD;
|
|
}
|
|
|
|
BOOL CBZWZDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
UpdateData(FALSE);
|
|
|
|
CWnd *pWnd(NULL);
|
|
if (m_bOption)
|
|
{
|
|
pWnd = GetDlgItem(IDC_EDIT1);
|
|
if (pWnd) pWnd->EnableWindow(FALSE);
|
|
pWnd = GetDlgItem(IDC_EDIT2);
|
|
if (pWnd) pWnd->EnableWindow(FALSE);
|
|
|
|
pWnd = GetDlgItem(IDC_EDIT4);
|
|
if (pWnd) pWnd->ShowWindow(SW_SHOW);
|
|
pWnd = GetDlgItem(IDC_CHK_CUSTOM_R);
|
|
if (pWnd) pWnd->ShowWindow(SW_SHOW);
|
|
}
|
|
else
|
|
{
|
|
pWnd = GetDlgItem(IDC_EDIT4);
|
|
if (pWnd) pWnd->ShowWindow(SW_HIDE);
|
|
pWnd = GetDlgItem(IDC_CHK_CUSTOM_R);
|
|
if (pWnd) pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
|
|
m_wndTextStyleCombo.init();
|
|
int nSel = m_wndTextStyleCombo.FindString(0,m_sTextStyle);
|
|
if (nSel != -1)
|
|
{
|
|
m_wndTextStyleCombo.SetCurSel(nSel);
|
|
}
|
|
|
|
OnBnClickedChkCustomR();
|
|
return TRUE;
|
|
}
|
|
|
|
void CBZWZDlg::OnBnClickedOk()
|
|
{
|
|
UpdateData();
|
|
|
|
m_sDimU.TrimLeft();
|
|
m_sDimU.TrimRight();
|
|
|
|
if (m_sDimU.IsEmpty() && !m_bOption)
|
|
{
|
|
AfxMessageBox(_T("上标注文字不能为空!请输入标注文字!"));
|
|
return;
|
|
}
|
|
|
|
if (m_dTxtH < 0.2)
|
|
{
|
|
AfxMessageBox(_T("文字高度太小!"));
|
|
return;
|
|
}
|
|
|
|
int nSel = m_wndTextStyleCombo.GetCurSel();
|
|
if (nSel == -1)
|
|
{
|
|
AfxMessageBox(_T("请选择文字样式!"));
|
|
return;
|
|
}
|
|
m_wndTextStyleCombo.GetLBText(nSel,m_sTextStyle);
|
|
|
|
SET_CACHE(CBZWZDlg
|
|
, %f%s%s%s%f%d
|
|
, m_dTxtH
|
|
, m_sDimU
|
|
, m_sDimD
|
|
, m_sTextStyle
|
|
, m_dCustomR
|
|
, m_bCustomR);
|
|
|
|
OnOK();
|
|
}
|
|
|
|
|
|
void CBZWZDlg::OnBnClickedChkCustomR()
|
|
{
|
|
UpdateData(TRUE);
|
|
CWnd *pWnd = GetDlgItem(IDC_EDIT4);
|
|
if (!pWnd) return;
|
|
pWnd->EnableWindow(m_bCustomR);
|
|
}
|